comparison MUMmer/nucmer_coords2ACT_galaxy.pl @ 2:479eb076cd23

Add revised mummer toolshed files to testtoolshed
author abossers
date Tue, 28 Oct 2014 16:59:33 +0100
parents 59f302448cf6
children
comparison
equal deleted inserted replaced
1:c1c38335322e 2:479eb076cd23
1 #!/usr/bin/perl
2
3 # converts the MUMmer-nucmer coords file in a file readable for Artemis Comparison Tool
4 # Output format is like crunch of BLAST
5 #
6 # [nov 2010] Galaxy wrapped up version
7 #
8 # Alex.Bossers@wur.nl
9
10
11 use warnings;
12 use strict;
13
14 #$filename=shift;
15 #$ARGV[0] =~ m/^([A-Z0-9_.-]+)$/ig;
16 my $filename = $ARGV[0];
17 #$ARGV[1] =~ m/^([A-Z0-9_.-]+)$/ig;
18 my $fileout = $ARGV[1];
19 #my $filename = "Curated_vs_noncurated_8067_01.nucmer.coords";
20 #my $fileout = "Curated_vs_noncurated_8067_01.nucmer.tab";
21
22 open (COORDS,$filename) || die "error opening input coords file";
23 open (OUT,">$fileout") || die "error opening tab output file";
24
25 while (<COORDS>)
26 {
27 unless ($_ =~ /^(\s*)\d/){next}
28 $_ =~ s/\|//g;
29
30 my @f = split;
31 # create crude match score = ((length_of_match * %identity)-(length_of_match * (100 - %identity))) /20
32 my $crude_plus_score=($f[4]*$f[6]);
33 my $crude_minus_score=($f[4]*(100-$f[6]));
34 my $crude_score= int(($crude_plus_score - $crude_minus_score) / 20);
35 # reorganise columns and print crunch format to stdout
36 # score %id S1 E1 seq1 S2 E2 seq2 (description)
37 print OUT " $crude_score $f[6] $f[0] $f[1] $f[7] $f[2] $f[3] $f[8] nucmer comparison coordinates\n"
38 }
39
40 close (COORDS);
41 close (OUT);
42 print "Done!\n\n";