Mercurial > repos > portiahollyoak > temp
annotate scripts/excision.clustering.pl @ 0:28d1a6f8143f draft
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
author | portiahollyoak |
---|---|
date | Mon, 25 Apr 2016 13:08:56 -0400 |
parents | |
children |
rev | line source |
---|---|
0
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
1 #! /usr/bin/perl |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
2 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
3 use strict; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
4 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
5 my %position=(); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
6 my %names=(); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
7 open (input, "<$ARGV[0]") or die "Can't open $ARGV[0] since $!\n"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
8 while (my $line=<input>) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
9 chomp($line); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
10 my @a=split(/\t/, $line); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
11 my @b=split(/\#/, $a[8]); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
12 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
13 if (defined $position{$b[0]}) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
14 my @c=split(/\:/, $position{$b[0]}); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
15 if (($c[0] eq $a[0])&&($a[1] < $c[1])) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
16 $position{$b[0]} =~ s/$c[1]/$a[1]/; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
17 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
18 if (($c[0] eq $a[0])&&($a[2] > $c[2])) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
19 $position{$b[0]} =~ s/$c[2]/$a[2]/; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
20 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
21 my $transposon=$a[3]; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
22 if ($names{$b[0]} !~ /$transposon/) {$names{$b[0]}=$names{$b[0]}.",$transposon";} |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
23 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
24 else { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
25 $position{$b[0]}="$a[0]\:$a[1]\:$a[2]"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
26 $names{$b[0]}=$a[3]; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
27 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
28 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
29 close input; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
30 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
31 open (output, ">>temp_for_sort") or die "Can't open temp_for_sort since $!\n"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
32 while ((my $key, my $value) = each (%position)) { |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
33 my @z=split(/\:/, $value); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
34 print output "$z[0]\t$z[1]\t$z[2]\t$names{$key}\n"; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
35 } |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
36 close output; |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
37 |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
38 system("sort +0 -1 +1n -2 +2n -3 temp_for_sort > sorted"); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
39 system("uniq -c sorted > $ARGV[1]"); |
28d1a6f8143f
planemo upload for repository https://github.com/portiahollyoak/Tools commit 132bb96bba8e7aed66a102ed93b7744f36d10d37-dirty
portiahollyoak
parents:
diff
changeset
|
40 system("rm sorted temp_for_sort"); |