comparison scripts/filterFalsePositive.ex.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
comparison
equal deleted inserted replaced
-1:000000000000 0:28d1a6f8143f
1 #! /usr/bin/perl
2
3 use strict;
4
5 open (input, "<$ARGV[0]") or die "Can't open $ARGV[0] since $!\n";
6 my %leng=();
7 my %trans=();
8 my %coordinate=();
9 while (my $line=<input>) {
10 chomp($line);
11 my @a=split(/\t/, $line);
12 if (defined $leng{$a[9]}) {
13 $trans{$a[9]} += $a[2]-$a[1];
14 }
15 else {
16 $leng{$a[9]}=$a[8]-$a[7]-10;
17 $trans{$a[9]}=$a[2]-$a[1];
18 $coordinate{$a[9]}="$a[6]\:$a[7]\:$a[8]";
19 }
20 }
21 close input;
22
23 open (output, ">>$ARGV[2]") or die "Can't open $ARGV[2] since $!\n";
24 while ((my $key, my $value) = each (%coordinate)) {
25 if ((($leng{$key}-$trans{$key}) <= $ARGV[1])&&(($leng{$key}-$trans{$key}) >= 0)) {
26 # if (($leng{$key}-$trans{$key}) <= 500) {
27 my @b=split(/\:/, $value);
28 print output "$b[0]\t$b[1]\t$b[2]\t$key\n";
29 }
30 }
31 close output;