Mercurial > repos > bornea > dotplot_runner
comparison Dotplot_Release/BaitCheck.pl @ 0:dfa3436beb67 draft
Uploaded
| author | bornea |
|---|---|
| date | Fri, 29 Jan 2016 09:56:02 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:dfa3436beb67 |
|---|---|
| 1 #!/usr/bin/perl | |
| 2 | |
| 3 # 27/04/2014 | |
| 4 | |
| 5 if($#ARGV==0){ | |
| 6 print "This program checks the number of baits in a Saint Output File.\n"; | |
| 7 print "\nusage:\n $0\n-i [csv saint output file]]\n\n"; | |
| 8 die; | |
| 9 } | |
| 10 else{ | |
| 11 $i=0; | |
| 12 $cutoff=0.01; | |
| 13 while($i<=$#ARGV){ | |
| 14 if($ARGV[$i] eq '-i'){ | |
| 15 $i++; | |
| 16 $ifile=$ARGV[$i]; | |
| 17 } | |
| 18 else{ | |
| 19 die "\Incorrect program usage\n\n"; | |
| 20 } | |
| 21 $i++; | |
| 22 } | |
| 23 } | |
| 24 | |
| 25 $file=''; | |
| 26 open(IFILE,"<$ifile") || die "$ifile can't be opened: $!"; | |
| 27 { local $/=undef; $file=<IFILE>; } | |
| 28 @lines=split /[\r\n]+/, $file; | |
| 29 foreach $line (@lines) { | |
| 30 if($line =~ /^Bait/){ | |
| 31 } | |
| 32 elsif($line =~ /^([^\t]+)/){ | |
| 33 if($1 ne $bait[$baitn]){ | |
| 34 $baitn++; | |
| 35 $bait[$baitn]=$1; | |
| 36 } | |
| 37 } | |
| 38 else{ | |
| 39 } | |
| 40 } | |
| 41 close(IFILE); | |
| 42 | |
| 43 print $baitn; | |
| 44 | |
| 45 |
