annotate Dotplot_Release/BaitCheck.pl @ 2:01854b858767 draft

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