annotate MUMmer/nucmer_coords2ACT_galaxy.pl @ 0:61f30d177448 default tip

initial commit on Mummer toolsuite on toolshed
author eric
date Tue, 31 Mar 2015 14:19:49 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
1 #!/usr/bin/perl
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
2
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
3 # converts the MUMmer-nucmer coords file in a file readable for Artemis Comparison Tool
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
4 # Output format is like crunch of BLAST
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
5 #
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
6 # [nov 2010] Galaxy wrapped up version
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
7 #
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
8 # Alex.Bossers@wur.nl
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
9
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
10
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
11 use warnings;
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
12 use strict;
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
13
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
14 #$filename=shift;
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
15 #$ARGV[0] =~ m/^([A-Z0-9_.-]+)$/ig;
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
16 my $filename = $ARGV[0];
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
17 #$ARGV[1] =~ m/^([A-Z0-9_.-]+)$/ig;
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
18 my $fileout = $ARGV[1];
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
19 #my $filename = "Curated_vs_noncurated_8067_01.nucmer.coords";
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
20 #my $fileout = "Curated_vs_noncurated_8067_01.nucmer.tab";
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
21
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
22 open (COORDS,$filename) || die "error opening input coords file";
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
23 open (OUT,">$fileout") || die "error opening tab output file";
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
24
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
25 while (<COORDS>)
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
26 {
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
27 unless ($_ =~ /^(\s*)\d/){next}
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
28 $_ =~ s/\|//g;
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
29
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
30 my @f = split;
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
31 # create crude match score = ((length_of_match * %identity)-(length_of_match * (100 - %identity))) /20
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
32 my $crude_plus_score=($f[4]*$f[6]);
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
33 my $crude_minus_score=($f[4]*(100-$f[6]));
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
34 my $crude_score= int(($crude_plus_score - $crude_minus_score) / 20);
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
35 # reorganise columns and print crunch format to stdout
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
36 # score %id S1 E1 seq1 S2 E2 seq2 (description)
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
37 print OUT " $crude_score $f[6] $f[0] $f[1] $f[7] $f[2] $f[3] $f[8] nucmer comparison coordinates\n"
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
38 }
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
39
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
40 close (COORDS);
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
41 close (OUT);
61f30d177448 initial commit on Mummer toolsuite on toolshed
eric
parents:
diff changeset
42 print "Done!\n\n";