annotate rapsodyn/rapsosnp_stats2x.pl @ 6:1776b8ddd87e draft

Uploaded
author mcharles
date Mon, 29 Sep 2014 03:02:16 -0400
parents 761fecc07fa9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
1 #!/usr/bin/perl
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
2 use strict;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
3 use warnings;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
4
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
5 my $read1_row = $ARGV[0];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
6 my $read2_row = $ARGV[1];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
7
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
8 my $read1_trimmed_part1 = $ARGV[2];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
9 my $read1_trimmed_part2 = $ARGV[3];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
10 my $read2_trimmed_part1 = $ARGV[4];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
11 my $read2_trimmed_part2 = $ARGV[5];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
12
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
13 my $sam_row_part1 = $ARGV[6];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
14 my $sam_row_part2 = $ARGV[7];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
15 my $sam_filtered_part1 = $ARGV[8];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
16 my $sam_filtered_part2 = $ARGV[9];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
17
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
18 my $mpileup_variant = $ARGV[10];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
19
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
20 my $list_filtered = $ARGV[11];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
21
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
22 my $blast_filtered_part1 = $ARGV[12];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
23 my $blast_filtered_part2 = $ARGV[13];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
24
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
25 my $snp_selected = $ARGV[14];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
26
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
27
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
28 open(INR1R, $read1_row) or die ("Can't open $read1_row\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
29 my $nbread=0;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
30 my $nbbase =0;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
31 while (my $line1=<INR1R>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
32 my $line2 = <INR1R>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
33 my $line3 = <INR1R>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
34 my $line4 = <INR1R>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
35 if ($line1 =~ /^@/){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
36 $nbread++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
37 if ($line2=~/([ATGCNX]+)/i){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
38 $nbbase += length($1);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
39 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
40 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
41 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
42 print "Row Reads 1\t\tNumber of reads : ",$nbread,"\tnumber of bases : ",$nbbase,"\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
43 close (INR1R);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
44
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
45
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
46
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
47
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
48 open(INR2R, $read2_row) or die ("Can't open $read2_row\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
49 $nbread=0;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
50 $nbbase =0;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
51 while (my $line1=<INR2R>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
52 my $line2 = <INR2R>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
53 my $line3 = <INR2R>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
54 my $line4 = <INR2R>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
55 if ($line1 =~ /^@/){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
56 $nbread++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
57 if ($line2=~/([ATGCNX]+)/i){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
58 $nbbase += length($1);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
59 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
60 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
61 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
62 print "Row Reads 2\t\tNumber of reads : ",$nbread,"\tnumber of bases : ",$nbbase,"\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
63 close (INR2R);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
64
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
65
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
66
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
67
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
68
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
69 open(INR1TP1, $read1_trimmed_part1) or die ("Can't open $read1_trimmed_part1\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
70 $nbread=0;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
71 $nbbase =0;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
72 while (my $line1=<INR1TP1>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
73 my $line2 = <INR1TP1>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
74 my $line3 = <INR1TP1>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
75 my $line4 = <INR1TP1>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
76 if ($line1 =~ /^@/){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
77 $nbread++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
78 if ($line2=~/([ATGCNX]+)/i){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
79 $nbbase += length($1);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
80 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
81 else {
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
82 print STDERR "$line1\n$line2\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
83 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
84 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
85 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
86 close (INR1TP1);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
87 open(INR1TP2, $read1_trimmed_part2) or die ("Can't open $read1_trimmed_part2\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
88 while (my $line1=<INR1TP2>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
89 my $line2 = <INR1TP2>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
90 my $line3 = <INR1TP2>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
91 my $line4 = <INR1TP2>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
92 if ($line1 =~ /^@/){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
93 $nbread++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
94 if ($line2=~/([ATGCNX]+)/i){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
95 $nbbase += length($1);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
96 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
97 else {
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
98 print STDERR "$line1\n$line2\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
99 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
100 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
101 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
102 close (INR1TP2);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
103 print "Trimmed Reads 1\t\tNumber of reads : ",$nbread,"\tnumber of bases : ",$nbbase,"\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
104
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
105
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
106
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
107
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
108 open(INR2TP1, $read2_trimmed_part1) or die ("Can't open $read2_trimmed_part1\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
109 $nbread=0;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
110 $nbbase =0;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
111 while (my $line1=<INR2TP1>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
112 my $line2 = <INR2TP1>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
113 my $line3 = <INR2TP1>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
114 my $line4 = <INR2TP1>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
115 if ($line1 =~ /^@/){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
116 $nbread++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
117 if ($line2=~/([ATGCNX]+)/i){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
118 $nbbase += length($1);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
119 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
120 else {
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
121 print STDERR "$line1\n$line2\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
122 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
123 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
124 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
125 close (INR2TP2);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
126 open(INR2TP2, $read2_trimmed_part2) or die ("Can't open $read2_trimmed_part2\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
127 while (my $line1=<INR2TP2>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
128 my $line2 = <INR2TP2>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
129 my $line3 = <INR2TP2>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
130 my $line4 = <INR2TP2>;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
131 if ($line1 =~ /^@/){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
132 $nbread++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
133 if ($line2=~/([ATGCNX]+)/i){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
134 $nbbase += length($1);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
135 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
136 else {
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
137 print STDERR "$line1\n$line2\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
138 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
139 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
140 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
141 close (INR2TP2);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
142 print "Trimmed Reads 2\t\tNumber of reads : ",$nbread,"\tnumber of bases : ",$nbbase,"\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
143
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
144
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
145
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
146
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
147 print "\nSAM row\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
148 open(SAMP1, $sam_row_part1) or die ("Can't open $sam_row_part1\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
149 my %bitscore;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
150 while (my $line=<SAMP1>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
151 if (($line !~ /^\@SQ/)&&($line !~ /^\@PG/)){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
152 my @fields = split(/\s+/,$line);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
153 my $bit = $fields[1];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
154 if ($bitscore{$bit}){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
155 $bitscore{$bit}++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
156 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
157 else {
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
158 $bitscore{$bit}=1;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
159 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
160 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
161 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
162 close (SAMP1);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
163 open(SAMP2, $sam_row_part2) or die ("Can't open $sam_row_part2\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
164 while (my $line=<SAMP2>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
165 if (($line !~ /^\@SQ/)&&($line !~ /^\@PG/)){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
166 my @fields = split(/\s+/,$line);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
167 my $bit = $fields[1];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
168 if ($bitscore{$bit}){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
169 $bitscore{$bit}++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
170 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
171 else {
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
172 $bitscore{$bit}=1;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
173 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
174 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
175 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
176 close (SAMP2);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
177 print "bitscore\t";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
178 foreach my $key (sort {$bitscore{$b} <=> $bitscore{$a}} keys %bitscore) {
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
179 print $key,"\t*\t";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
180 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
181 print "\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
182 print " number \t";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
183 foreach my $key (sort {$bitscore{$b} <=> $bitscore{$a}} keys %bitscore) {
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
184 print $bitscore{$key},"\t*\t";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
185 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
186 print "\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
187
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
188
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
189
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
190
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
191 print "\nSAM filtered\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
192 open(SAMFP1, $sam_filtered_part1) or die ("Can't open $sam_filtered_part1\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
193 undef %bitscore;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
194 while (my $line=<SAMFP1>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
195 if (($line !~ /^\@SQ/)&&($line !~ /^\@PG/)){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
196 my @fields = split(/\s+/,$line);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
197 my $bit = $fields[1];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
198 if ($bitscore{$bit}){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
199 $bitscore{$bit}++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
200 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
201 else {
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
202 $bitscore{$bit}=1;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
203 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
204 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
205 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
206 close (SAMFP1);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
207 open(SAMFP2, $sam_filtered_part2) or die ("Can't open $sam_filtered_part2\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
208 while (my $line=<SAMFP2>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
209 if (($line !~ /^\@SQ/)&&($line !~ /^\@PG/)){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
210 my @fields = split(/\s+/,$line);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
211 my $bit = $fields[1];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
212 if ($bitscore{$bit}){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
213 $bitscore{$bit}++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
214 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
215 else {
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
216 $bitscore{$bit}=1;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
217 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
218 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
219 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
220 close (SAMFP2);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
221 print "bitscore\t";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
222 foreach my $key (sort {$bitscore{$b} <=> $bitscore{$a}} keys %bitscore) {
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
223 print $key,"\t*\t";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
224 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
225 print "\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
226 print " number \t";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
227 foreach my $key (sort {$bitscore{$b} <=> $bitscore{$a}} keys %bitscore) {
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
228 print $bitscore{$key},"\t*\t";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
229 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
230 print "\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
231
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
232
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
233
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
234
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
235 print "\nMPILEUP variant\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
236 open(MPV, $mpileup_variant) or die ("Can't open $mpileup_variant\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
237 my $nbvariant=0;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
238 while (my $line=<MPV>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
239 my @fields = split(/\s+/,$line);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
240 if ($#fields >= 4){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
241 my $match = $fields[4];
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
242 $match =~ s/\$//g; #the read start at this position
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
243 $match =~ s/\^.//g; #the read end at this position followed by quality char
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
244 if ($match =~/[ACGTNacgtn]+/){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
245 $nbvariant++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
246 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
247 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
248 else {
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
249 #print STDERR "Erreur : $line\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
250 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
251 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
252 print "Variant detected :\t$nbvariant\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
253 close (MPV);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
254
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
255
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
256
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
257
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
258
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
259
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
260 print "\nMPILEUP filtered without dubious position\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
261 open(LF, $list_filtered) or die ("Can't open $list_filtered\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
262 $nbvariant=0;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
263 while (my $line=<LF>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
264 $nbvariant++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
265 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
266 print "Variant selected :\t$nbvariant\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
267 close (LF);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
268
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
269
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
270
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
271
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
272
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
273 print "\nMPILEUP filtered without dubious position and BLAST\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
274 open(BFP1, $blast_filtered_part1) or die ("Can't open $blast_filtered_part1\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
275 $nbvariant=0;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
276 while (my $line=<BFP1>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
277 $nbvariant++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
278 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
279 close (BFP1);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
280 open(BFP2, $blast_filtered_part2) or die ("Can't open $blast_filtered_part2\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
281 while (my $line=<BFP2>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
282 $nbvariant++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
283 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
284 close (BFP2);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
285 print "Variant selected :\t$nbvariant\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
286
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
287
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
288
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
289
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
290
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
291 print "\nSNP selected after mpileup filtering : \t";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
292 open(SNP, $snp_selected) or die ("Can't open $snp_selected\n");
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
293 $nbvariant=0;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
294 while (my $line=<SNP>){
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
295 $nbvariant++;
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
296 }
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
297
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
298 print "$nbvariant\n";
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
299 close (SNP);
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
300
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
301
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
302
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
303
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
304
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
305
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
306
761fecc07fa9 Uploaded
mcharles
parents:
diff changeset
307