Mercurial > repos > abossers > mummer_toolsuite
annotate 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 |
rev | line source |
---|---|
0
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
1 #!/usr/bin/perl |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
2 |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
3 # converts the MUMmer-nucmer coords file in a file readable for Artemis Comparison Tool |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
4 # Output format is like crunch of BLAST |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
5 # |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
6 # [nov 2010] Galaxy wrapped up version |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
7 # |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
8 # Alex.Bossers@wur.nl |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
9 |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
10 |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
11 use warnings; |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
12 use strict; |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
13 |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
14 #$filename=shift; |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
15 #$ARGV[0] =~ m/^([A-Z0-9_.-]+)$/ig; |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
16 my $filename = $ARGV[0]; |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
17 #$ARGV[1] =~ m/^([A-Z0-9_.-]+)$/ig; |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
18 my $fileout = $ARGV[1]; |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
19 #my $filename = "Curated_vs_noncurated_8067_01.nucmer.coords"; |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
20 #my $fileout = "Curated_vs_noncurated_8067_01.nucmer.tab"; |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
21 |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
22 open (COORDS,$filename) || die "error opening input coords file"; |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
23 open (OUT,">$fileout") || die "error opening tab output file"; |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
24 |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
25 while (<COORDS>) |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
26 { |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
27 unless ($_ =~ /^(\s*)\d/){next} |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
28 $_ =~ s/\|//g; |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
29 |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
30 my @f = split; |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
31 # create crude match score = ((length_of_match * %identity)-(length_of_match * (100 - %identity))) /20 |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
32 my $crude_plus_score=($f[4]*$f[6]); |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
33 my $crude_minus_score=($f[4]*(100-$f[6])); |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
34 my $crude_score= int(($crude_plus_score - $crude_minus_score) / 20); |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
35 # reorganise columns and print crunch format to stdout |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
36 # score %id S1 E1 seq1 S2 E2 seq2 (description) |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
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" |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
38 } |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
39 |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
40 close (COORDS); |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
41 close (OUT); |
59f302448cf6
Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
abossers
parents:
diff
changeset
|
42 print "Done!\n\n"; |