annotate Dotplot_Release/BaitCheck.pl @ 15:a6c081fcc0a9 draft

Uploaded
author bornea
date Wed, 16 Mar 2016 12:10:35 -0400
parents bc752a05f16d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
bc752a05f16d Uploaded
bornea
parents:
diff changeset
1 #!/usr/bin/perl
bc752a05f16d Uploaded
bornea
parents:
diff changeset
2
bc752a05f16d Uploaded
bornea
parents:
diff changeset
3 # 27/04/2014
bc752a05f16d Uploaded
bornea
parents:
diff changeset
4
bc752a05f16d Uploaded
bornea
parents:
diff changeset
5 if($#ARGV==0){
bc752a05f16d Uploaded
bornea
parents:
diff changeset
6 print "This program checks the number of baits in a Saint Output File.\n";
bc752a05f16d Uploaded
bornea
parents:
diff changeset
7 print "\nusage:\n $0\n-i [csv saint output file]]\n\n";
bc752a05f16d Uploaded
bornea
parents:
diff changeset
8 die;
bc752a05f16d Uploaded
bornea
parents:
diff changeset
9 }
bc752a05f16d Uploaded
bornea
parents:
diff changeset
10 else{
bc752a05f16d Uploaded
bornea
parents:
diff changeset
11 $i=0;
bc752a05f16d Uploaded
bornea
parents:
diff changeset
12 $cutoff=0.01;
bc752a05f16d Uploaded
bornea
parents:
diff changeset
13 while($i<=$#ARGV){
bc752a05f16d Uploaded
bornea
parents:
diff changeset
14 if($ARGV[$i] eq '-i'){
bc752a05f16d Uploaded
bornea
parents:
diff changeset
15 $i++;
bc752a05f16d Uploaded
bornea
parents:
diff changeset
16 $ifile=$ARGV[$i];
bc752a05f16d Uploaded
bornea
parents:
diff changeset
17 }
bc752a05f16d Uploaded
bornea
parents:
diff changeset
18 else{
bc752a05f16d Uploaded
bornea
parents:
diff changeset
19 die "\Incorrect program usage\n\n";
bc752a05f16d Uploaded
bornea
parents:
diff changeset
20 }
bc752a05f16d Uploaded
bornea
parents:
diff changeset
21 $i++;
bc752a05f16d Uploaded
bornea
parents:
diff changeset
22 }
bc752a05f16d Uploaded
bornea
parents:
diff changeset
23 }
bc752a05f16d Uploaded
bornea
parents:
diff changeset
24
bc752a05f16d Uploaded
bornea
parents:
diff changeset
25 $file='';
bc752a05f16d Uploaded
bornea
parents:
diff changeset
26 open(IFILE,"<$ifile") || die "$ifile can't be opened: $!";
bc752a05f16d Uploaded
bornea
parents:
diff changeset
27 { local $/=undef; $file=<IFILE>; }
bc752a05f16d Uploaded
bornea
parents:
diff changeset
28 @lines=split /[\r\n]+/, $file;
bc752a05f16d Uploaded
bornea
parents:
diff changeset
29 foreach $line (@lines) {
bc752a05f16d Uploaded
bornea
parents:
diff changeset
30 if($line =~ /^Bait/){
bc752a05f16d Uploaded
bornea
parents:
diff changeset
31 }
bc752a05f16d Uploaded
bornea
parents:
diff changeset
32 elsif($line =~ /^([^\t]+)/){
bc752a05f16d Uploaded
bornea
parents:
diff changeset
33 if($1 ne $bait[$baitn]){
bc752a05f16d Uploaded
bornea
parents:
diff changeset
34 $baitn++;
bc752a05f16d Uploaded
bornea
parents:
diff changeset
35 $bait[$baitn]=$1;
bc752a05f16d Uploaded
bornea
parents:
diff changeset
36 }
bc752a05f16d Uploaded
bornea
parents:
diff changeset
37 }
bc752a05f16d Uploaded
bornea
parents:
diff changeset
38 else{
bc752a05f16d Uploaded
bornea
parents:
diff changeset
39 }
bc752a05f16d Uploaded
bornea
parents:
diff changeset
40 }
bc752a05f16d Uploaded
bornea
parents:
diff changeset
41 close(IFILE);
bc752a05f16d Uploaded
bornea
parents:
diff changeset
42
bc752a05f16d Uploaded
bornea
parents:
diff changeset
43 print $baitn;
bc752a05f16d Uploaded
bornea
parents:
diff changeset
44
bc752a05f16d Uploaded
bornea
parents:
diff changeset
45