diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/filterFalsePositive.ex.pl	Mon Apr 25 13:08:56 2016 -0400
@@ -0,0 +1,31 @@
+#! /usr/bin/perl
+
+use strict;
+
+open (input, "<$ARGV[0]") or die "Can't open $ARGV[0] since $!\n";
+my %leng=();
+my %trans=();
+my %coordinate=();
+while (my $line=<input>) {
+    chomp($line);
+    my @a=split(/\t/, $line);
+    if (defined $leng{$a[9]}) {
+	$trans{$a[9]} += $a[2]-$a[1];
+    }
+    else {
+	$leng{$a[9]}=$a[8]-$a[7]-10;
+	$trans{$a[9]}=$a[2]-$a[1];
+	$coordinate{$a[9]}="$a[6]\:$a[7]\:$a[8]";
+    }
+}
+close input;
+
+open (output, ">>$ARGV[2]") or die "Can't open $ARGV[2] since $!\n";
+while ((my $key, my $value) = each (%coordinate)) {
+    if ((($leng{$key}-$trans{$key}) <= $ARGV[1])&&(($leng{$key}-$trans{$key}) >= 0)) {
+#    if (($leng{$key}-$trans{$key}) <= 500) {
+	my @b=split(/\:/, $value);
+	print output "$b[0]\t$b[1]\t$b[2]\t$key\n";
+    }
+}
+close output;