Mercurial > repos > dereeper > sniploid
comparison SNiPloid.pl @ 0:58111b3965b2 draft default tip
Uploaded
author | dereeper |
---|---|
date | Thu, 01 Nov 2012 09:35:05 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:58111b3965b2 |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 use Getopt::Long; | |
4 use Switch; | |
5 use Tie::File; | |
6 | |
7 ##################################################### | |
8 # # | |
9 # @@@@ @ @ @ @@@@ @ @ @ # | |
10 # @ @@ @ @ @ @ @ # | |
11 # @@@ @ @ @ @ @@@@ @ @@@ @ @@@@ # | |
12 # @ @ @@ @ @ @ @ @ @ @ @ # | |
13 # @@@@ @ @ @ @ @ @@@ @ @@@ # | |
14 # # | |
15 ##################################################### | |
16 | |
17 ############################################################################################################### | |
18 # | |
19 # SNiPloid | |
20 # Author : Marine PERALTA | |
21 # | |
22 ############################################################################################################### | |
23 # | |
24 # Galaxy Version | |
25 # | |
26 ############################################################################################################### | |
27 | |
28 #___________________________________ | |
29 # Samples names | |
30 #----------------------------------- | |
31 $polyploidName = "" ; | |
32 $polyploid2Name = "" ; # | |
33 $genome1Name = "" ; | |
34 $genome2Name = "" ; | |
35 #___________________________________ | |
36 # VCF files | |
37 #----------------------------------- | |
38 $VCFpolyploid = "" ; | |
39 $VCFpolyploid2 = "" ; # | |
40 $VCFgenome1 = "" ; | |
41 $VCFgenome2 = "" ; | |
42 $merged_VCF = "" ; # Polyploid + Genome1 + Genome 2 | |
43 #___________________________________ | |
44 # Depth of Coverage File | |
45 #----------------------------------- | |
46 $DOCpolyploid = "" ; | |
47 $DOCpolyploid2 = "" ; # | |
48 $DOCgenome1 = "" ; | |
49 $DOCgenome2 = "" ; | |
50 $merged_DOC = "" ; # Polyploid + Genome1 + Genome 2 | |
51 #___________________________________ | |
52 # Depth for each sample | |
53 #----------------------------------- | |
54 $depthPolyploid = 0 ; | |
55 $depthPolyploid2 = 0 ; # | |
56 $depthGenome1 = 0 ; | |
57 $depthGenome2 = 0 ; | |
58 #___________________________________ | |
59 # Output Files | |
60 #----------------------------------- | |
61 $SNP_csv = "SNP_tab.txt"; | |
62 $SNP_html = "SNP_view.html"; | |
63 $SNP_count = "SNP_synthesis_tab.html"; | |
64 $SNP_count_csv = "SNP_synthesis_tab.txt"; | |
65 #___________________________________ | |
66 # Other parameters | |
67 #----------------------------------- | |
68 $enableLowQuality = 0 ; #default value for enable quality SNP = only PASS SNP are considered | |
69 $ref = 0 ; # default parameter = extern | |
70 | |
71 $filtre_ouPas = 0 ; | |
72 $value_filter_p1 = 0 ; | |
73 $value_filter_p2 = 0 ; | |
74 | |
75 $REPimages = "img_sniploid/"; | |
76 | |
77 $poly_poly_analysis = 0 ; | |
78 | |
79 | |
80 my $usage = qq~ | |
81 Basic usage | |
82 | |
83 For comparison between a polyploid and its parental diploid genomes: | |
84 | |
85 $0 --vp <VCF_polyploid> --vg1 <VCF_diploid> --cpp <depth_polyploid> --cg1 <depth_diploid> --dp <min_depth_polyploid> --dg1 <min_depth_diploid> --ref 1 | |
86 | |
87 For comparison between 2 polyploids: | |
88 | |
89 $0 --vp <VCF_polyploid1> --vp2 <VCF_polyploid2> --cpp <depth_polyploid1> --cpp2 <depth_polyploid2> --dp <min_depth_polyploid1> --dp2 <min_depth_polyploid2> | |
90 | |
91 Usage:$0 <args> | |
92 where <args> are: | |
93 | |
94 --vp <VCF file for polyploid> | |
95 --vp2 <VCF file for polyploid 2> | |
96 --vg1 <VCF file for diploid genome 1> | |
97 --vg2 <VCF file for diploid genome 2> | |
98 | |
99 --cpp <Depth file for polyploid> | |
100 --cpp2 <Depth file for polyploid 2> | |
101 --cg1 <Depth file for diploid genome 1> | |
102 --cg2 <Depth file for diploid genome 2> | |
103 | |
104 --dp <Minimum read depth at a position to make a call for polyploid> | |
105 --dp2 <Minimum read depth at a position to make a call for polyploid 2> | |
106 --dg1 <Minimum read depth at a position to make a call for diploid genome 1> | |
107 --dg2 <Minimum read depth at a position to make a call for diploid genome 2> | |
108 | |
109 --oc <Output file name for SNP list in csv> | |
110 --oh <Output file name for SNP list in HTML> | |
111 --ocs <Output file name for SNP count per gene in csv> | |
112 --ohs <Output file name for SNP count per gene in HTML> | |
113 | |
114 --vfp1 <Minimul allele frequency to consider as variant for polyploid 1 (in %). Default: 0> | |
115 --vfp2 <Minimul allele frequency to consider as variant for polyploid 2 (in %). Default: 0> | |
116 | |
117 --elq <Enable low quality SNP tag. Default: 0> | |
118 --gn2 <Specify a name for diploid genome 2> | |
119 --ref <The reference must be included in the analysis as diploid genome. Default: 0> | |
120 ~; | |
121 $usage .= "\n"; | |
122 | |
123 | |
124 =pod | |
125 Add option for "Heterozygosity" | |
126 Enable "heterozygosity" for genome 1 (reference intern) - not necessary... | |
127 Enable "heterozygosity" for genome 1 and genome 2 (reference extern) | |
128 =cut | |
129 | |
130 GetOptions ( | |
131 # "pn=s" => \$polyploidName, | |
132 # "pn2=s" => \$polyploid2Name, # | |
133 # "gn1=s" => \$genome1Name, | |
134 "gn2=s" => \$genome2Name, | |
135 "vp=s" => \$VCFpolyploid, | |
136 "vp2=s" => \$VCFpolyploid2, # | |
137 "vg1=s" => \$VCFgenome1, | |
138 "vg2=s" => \$VCFgenome2, | |
139 "vm=s" => \$merged_VCF, | |
140 "cpp=s" => \$DOCpolyploid, | |
141 "cpp2=s" => \$DOCpolyploid2, # | |
142 "cg1=s" => \$DOCgenome1, | |
143 "cg2=s" => \$DOCgenome2, | |
144 "cm=s" => \$merged_DOC, | |
145 "dp=i" => \$depthPolyploid, | |
146 "dp2=i" => \$depthPolyploid2, # | |
147 "dg1=i" => \$depthGenome1, | |
148 "dg2=i" => \$depthGenome2, | |
149 "oc=s" => \$SNP_csv, | |
150 "oh=s" => \$SNP_html, | |
151 "ohs=s" => \$SNP_count, | |
152 "ocs=s" => \$SNP_count_csv, | |
153 "elq=i" => \$enableLowQuality, | |
154 "ref=i" => \$ref, | |
155 #"fop=i" => \$filtre_ouPas, | |
156 "vfp1=i" => \$value_filter_p1, | |
157 "vfp2=i" => \$value_filter_p2, | |
158 "img=s" => \$REPimages | |
159 # h = i = > \ $heterozygosity , | |
160 ); | |
161 | |
162 | |
163 # Validation - Samples names | |
164 | |
165 | |
166 die $usage | |
167 if ( (!$VCFgenome1 || !$DOCgenome1 ) && (!$VCFpolyploid || !$DOCpolyploid) || (!$VCFpolyploid2 || !$DOCpolyploid2 ) && (!$VCFpolyploid || !$DOCpolyploid)); | |
168 | |
169 | |
170 | |
171 %intervalle1 ; | |
172 %intervalle2 ; | |
173 %snp = () ; | |
174 my %snp_final ; | |
175 my %five = () ; | |
176 my %phased_regions = () ; | |
177 | |
178 $nbTotGenes = 0 ; | |
179 $nbTotGenesVal = 0 ; | |
180 $nbTotGenesAna = 0 ; | |
181 | |
182 | |
183 if ($VCFpolyploid2 ne "") { | |
184 $poly_poly_analysis = 1 ; | |
185 } | |
186 | |
187 # if ($polyploidName eq "") { | |
188 # print STDOUT "*** /!\\ ERROR: Missing name for polyploid - You have to specify a name for the polyploid species [--pn \"polyploid_name\"] $!" ; | |
189 # die ("*** /!\\ ERROR: Missing name for polyploid - You have to specify a name for the polyploid species [--pn \"polyploid_name\"] $!") ; | |
190 # } | |
191 | |
192 if ($poly_poly_analysis == 1) { | |
193 print STDOUT "\nAnalysis Type: Polyploid vs Polyploid\n---------------------------------------"; | |
194 # print STDOUT "\nPolyploid 1: ".$polyploidName ; | |
195 # print STDOUT "\nPolyploid 2:".$polyploid2Name ; | |
196 # if ($polyploid2Name eq "") { | |
197 # print STDOUT "*** /!\\ ERROR: Missing name for polyploid 2 - You have to specify a name for the polyploid species 2 [--pn2 \"polyploid_2_name\"] $!" ; | |
198 # die ("*** /!\\ ERROR: Missing name for polyploid - You have to specify a name for the polyploid species 2 [--pn \"polyploid_2_name\"] $!") ; | |
199 # } | |
200 } | |
201 else { | |
202 print STDOUT "\nAnalysis Type: Polyploid vs Parental Genomes\n---------------------------------------"; | |
203 # print STDOUT "\nPolyploid: ".$polyploidName ; | |
204 # print STDOUT "\nGenome 1: ".$genome1Name ; | |
205 # print STDOUT "\nGenome 2: ".$genome2Name ; | |
206 # if ($genome1Name eq "") { | |
207 # die ("*** /!\\ ERROR: Missing name for genome 1 - You have to specify a name for the genome 1 species") ; | |
208 # } | |
209 # if ($genome2Name eq "") { | |
210 # die ("*** /!\\ ERROR: Missing name for genome 2 - You have to specify a name for the genome 2 species") ; | |
211 # } | |
212 # Validation - depth | |
213 if ($depthPolyploid == 0) { | |
214 die ("*** /!\\ ERROR: Missing depth information for polyploid"); | |
215 } | |
216 if ($depthGenome1 == 0) { | |
217 die ("*** /!\\ ERROR: Missing depth information for genome 1"); | |
218 } | |
219 if ($ref == 0 && $depthGenome2 == 0) { | |
220 die ("*** /!\\ ERROR: Missing depth information for genome 2"); | |
221 } | |
222 } | |
223 | |
224 | |
225 | |
226 | |
227 $time = time ; | |
228 | |
229 | |
230 ################################################################ | |
231 # 1) Polyploid vs Polyploid analysis | |
232 ################################################################ | |
233 if ($poly_poly_analysis == 1) { | |
234 #print STDOUT "\n PASS"; | |
235 &Intervall_part1($DOCpolyploid) ; | |
236 &Intervall_part2($DOCpolyploid2,$depthPolyploid2) ; | |
237 | |
238 &VCF_Analysis($VCFpolyploid); | |
239 &VCF_Analysis($VCFpolyploid2); | |
240 # CSS, titles, img, etc. | |
241 &intro_output ; | |
242 &poly_poly_output ; | |
243 } | |
244 ################################################################ | |
245 # 2) Polyploid vs Parental Diploid Genomes Analysis | |
246 ################################################################ | |
247 else { | |
248 | |
249 # PART 1 : CREATING COMMON INTERVALS | |
250 | |
251 &Intervall_part1($DOCpolyploid) ; | |
252 &Intervall_part2($DOCgenome1,$depthGenome1) ; | |
253 if ($ref == 0) { # genome2 => no parental genome as reference | |
254 &Intervall_part2($DOCgenome2,$depthGenome2) ; | |
255 } | |
256 | |
257 # PART 2 and 3 : CREATING SNP TAB AND OUTPUTS | |
258 | |
259 # VCF_Analysis : Create SNP hash and phasing | |
260 | |
261 &VCF_Analysis($VCFpolyploid); | |
262 if ($ref == 1) { # Reference = one of two parental genomes | |
263 &VCF_Analysis($VCFgenome1); | |
264 # CSS, titles, img, etc. | |
265 &intro_output ; | |
266 # SNP Comparison and display | |
267 &int_output ; | |
268 } | |
269 else { # Extern Reference | |
270 &VCF_Analysis($VCFgenome1); | |
271 &VCF_Analysis($VCFgenome2); | |
272 # CSS, titles, img, etc. | |
273 &intro_output ; | |
274 # SNP Comparison and display | |
275 &ext_output ; | |
276 } | |
277 } | |
278 | |
279 | |
280 | |
281 | |
282 sub Intervall_part1 { | |
283 my(@args) = @_; | |
284 #print STDOUT "\nTEST ::: ".$args[0] ; | |
285 open (TABSNP, $args[0]) or die ("Pbm a l'ouverture du fichier : $args[0]"); | |
286 @DOC = <TABSNP> ; | |
287 close TABSNP ; | |
288 | |
289 $rec = 0 ; | |
290 $position_pre ; | |
291 $val_deb = ""; | |
292 $val_fin = ""; | |
293 $name_pre = ""; | |
294 | |
295 | |
296 foreach $line(@DOC) { | |
297 if ($line ne $DOC[0]) { | |
298 @ligne = split(/\t/ , $line); | |
299 @position = split(/:/ , $ligne[0]); | |
300 $name_gene = $position[0] ; | |
301 | |
302 if ($merged == 0) { # 1st File - Polyploid | |
303 $depthcov = $ligne[1] ; | |
304 if ($name_gene){ | |
305 if ($depthcov >= $depthPolyploid){ | |
306 if ($rec == 0) { | |
307 $position_deb = $position[1] ; | |
308 $val_deb = $position_deb."-"; # Intervalle start position | |
309 } | |
310 $rec = 1 ; | |
311 } | |
312 if ($depthcov < $depthPolyploid){ | |
313 if ($rec == 1) { | |
314 $position_fin = $position_pre ; | |
315 $val_fin = $val_deb.$position_fin ; # Intervalle end position | |
316 $intervalle1{$gene_pre}{$val_fin} = "ok" ; | |
317 } | |
318 $rec = 0 ; | |
319 } | |
320 } | |
321 } | |
322 else { # Merged files (2 or 3 species) | |
323 if ($ref == 0) { # 3 species | |
324 $depthcov1 = $ligne[$indiceGenome2] ; | |
325 $depthcov2 = $ligne[$indicePolyploid1] ; | |
326 $depthcov3 = $ligne[$indiceGenome1] ; | |
327 if ($name_gene){ | |
328 if (($depthcov1 >= $depthGenome2) && ($depthcov2 >= $depthPolyploid)&& ($depthcov3 >= $depthGenome1)){ | |
329 if ($rec == 0) { | |
330 $position_deb = $position[1] ; | |
331 $val_deb = $position_deb."-"; | |
332 } | |
333 $rec = 1 ; | |
334 } | |
335 if (($depthcov1 < $depthGenome2) || ($depthcov2 < $depthPolyploid) || ($depthcov3 < $depthGenome1)){ | |
336 if ($rec == 1) { | |
337 $position_fin = $position_pre ; | |
338 $val_fin = $val_deb.$position_fin ; | |
339 $intervalle1{$gene_pre}{$val_fin} = "ok" ; | |
340 } | |
341 $rec = 0 ; | |
342 } | |
343 } | |
344 } | |
345 else { # 2 species | |
346 $depthcov1 = $ligne[$indicePolyploid1] ; | |
347 $depthcov2 = $ligne[$indiceGenome1] ; | |
348 if ($name_gene){ | |
349 if (($depthcov1 >= $depthPolyploid) && ($depthcov2 >= $depthGenome1)){ | |
350 if ($rec == 0) { | |
351 $position_deb = $position[1] ; | |
352 $val_deb = $position_deb."-"; | |
353 } | |
354 $rec = 1 ; | |
355 } | |
356 if (($depthcov1 < $depthPolyploid) || ($depthcov2 < $depthGenome1)){ | |
357 if ($rec == 1) { | |
358 $position_fin = $position_pre ; | |
359 $val_fin = $val_deb.$position_fin ; | |
360 $intervalle1{$gene_pre}{$val_fin} = "ok" ; | |
361 } | |
362 $rec = 0 ; | |
363 } | |
364 } | |
365 } | |
366 } | |
367 $position_pre = $position[1] ; | |
368 $gene_pre = $name_gene ; | |
369 } | |
370 } | |
371 | |
372 return (%intervalle1) ; | |
373 | |
374 } | |
375 sub Intervall_part2 { | |
376 | |
377 my(@args) = @_; | |
378 #print "\nintervall part 2 : $args[1]"; | |
379 | |
380 open (TABSNP, $args[0]) or die ("Pbm a l'ouverture du fichier : $args[0]"); | |
381 #print STDOUT "\n$args[0]"; | |
382 @DOC = <TABSNP> ; | |
383 my %tab ; | |
384 foreach $li(@DOC) { | |
385 if ($li =~ /^(.+):(.+)\t(.+)\t.+\t.+$/) { | |
386 $tab{$1}{$2} = $3; | |
387 } | |
388 } | |
389 close TABSNP ; | |
390 | |
391 | |
392 | |
393 $rec = 0 ; | |
394 $position_pre ; | |
395 $val_deb = ""; | |
396 $val_fin = ""; | |
397 | |
398 foreach my $interval(sort (keys(%intervalle1))){ | |
399 | |
400 my $ref = $intervalle1{$interval}; | |
401 my %intervalls = %$ref; | |
402 $name_gene = $interval ; | |
403 | |
404 foreach my $intervall(sort (keys(%intervalls))){ | |
405 $final = 2 ; | |
406 $rec = 0 ; | |
407 ($debut,$fin) = split(/-/,$intervall); | |
408 for ($i=$debut; $i <=$fin; $i++) { | |
409 if ($tab{$interval}{$i} >= $args[1]){ | |
410 if ($rec == 0) { | |
411 $position_deb = $i ; | |
412 $val_deb = $position_deb."-"; | |
413 } | |
414 $rec = 1 ; | |
415 $final = 0 ; | |
416 } | |
417 if ($tab{$interval}{$i} < $args[1]){ | |
418 $final = 1 ; | |
419 if ($rec == 1) { | |
420 $position_fin = $i-1 ; | |
421 $val_fin = $val_deb.$position_fin ; | |
422 $intervalle2{$name_gene}{$val_fin} = "ok" ; | |
423 } | |
424 $rec = 0 ; | |
425 } | |
426 } | |
427 if ($final == 0) { | |
428 $val_fin = $val_deb.$fin ; | |
429 $intervalle2{$name_gene}{$val_fin} = "ok" ; | |
430 } | |
431 } | |
432 } | |
433 if ($VCFgenome2 ne ""){ | |
434 %intervalle1 = %intervalle2 ; | |
435 } | |
436 | |
437 foreach my $interval(sort (keys(%intervalle2))){ | |
438 my $ref = $intervalle2{$interval}; | |
439 my %intervalls = %$ref; | |
440 $name_gene = $interval ; | |
441 } | |
442 | |
443 return (%intervalle2) ; | |
444 } | |
445 | |
446 sub VCF_Analysis { | |
447 %snp_final = () ; | |
448 $compt_phasing = 0 ; | |
449 $compt_five = 0 ; | |
450 my(@args) = @_; | |
451 | |
452 open (TABSNP, "$args[0]") or die ("ERROR : file $args[0] don't exists"); | |
453 @VCF = <TABSNP> ; | |
454 close TABSNP ; | |
455 | |
456 ########################################### | |
457 # test if VCF was filtered | |
458 ########################################### | |
459 my $vcf_file = $args[0]; | |
460 my $is_filtered = `grep PASS $vcf_file`; | |
461 my $pass = "."; | |
462 if ($is_filtered) | |
463 { | |
464 $pass = "PASS"; | |
465 } | |
466 | |
467 print "$pass\n"; | |
468 | |
469 foreach $line(@VCF){ | |
470 if ($line =~ /^#CHROM.+FORMAT\t(.+)$/) { | |
471 $name_record = $1 ; | |
472 } | |
473 if ($line !~ /^#/){ | |
474 @infos_line = split(/\t/,$line) ; | |
475 $gene = $infos_line[0]; | |
476 $position = $infos_line[1]; | |
477 $ref_allele = $infos_line[3]; | |
478 $alt_allele = $infos_line[4]; | |
479 $snp_code = "[$ref_allele/$alt_allele]"; | |
480 $quality_of_snp = $infos_line[6]; | |
481 $depth_recuperation = $infos_line[7]; | |
482 $alleles = $infos_line[9]; | |
483 | |
484 ($GT,$AD,$FDP,$GQ,$PL) = split(":",$alleles); | |
485 | |
486 | |
487 # PHASING | |
488 | |
489 if (($GT =~ /\|/) && ($previous_GT =~ /\//)) { # initialisation région | |
490 $compt_phasing ++ ; | |
491 $phased_regions{$gene}{$compt_phasing}{$previous_position} = $previous_GT ; | |
492 $phased_regions{$gene}{$compt_phasing}{$position} = $GT ; | |
493 } | |
494 if (($GT =~ /\|/) && ($previous_GT =~ /\|/)) { # extension région | |
495 $phased_regions{$gene}{$compt_phasing}{$position} = $GT ; | |
496 } | |
497 | |
498 | |
499 # $FDP = Filtered Depth | |
500 # $DP = Total Depth | |
501 | |
502 ($AC,$AF,$AN,$DP,$DS,$Dels,$HRun,$HaplotypeScore,$MQ,$MQ0,$QD,$SB,$sumGLbyD) = split(";",$depth_recuperation); | |
503 | |
504 ($sub1,$sub2) = split(",",$AD); | |
505 $somme = $sub1 + $sub2 ; | |
506 | |
507 if ($somme == 0 ) { | |
508 print STDOUT "ERROR : Cannot calculate ratio for ".$gene." [pos:".$position."]\n\"".$line."\""; | |
509 die ("ERROR : Cannot calculate ratio for ".$gene." [pos:".$position."]\n\"".$line."\""); | |
510 } | |
511 else { | |
512 $ratio = ($sub1/($sub1+$sub2))*100; | |
513 $ratio = sprintf("%.0f", $ratio); | |
514 } | |
515 | |
516 @DP = split ("=",$DP) ; | |
517 | |
518 $test_inside_interval = 0 ; | |
519 | |
520 my $ref = $intervalle2{$gene}; | |
521 my %hash = %$ref; | |
522 | |
523 foreach my $interval(keys(%hash)){ | |
524 my @pos = split(/-/,$interval) ; | |
525 if ($position >= $pos[0] && $position <= $pos[1]) { | |
526 $test_inside_interval = 1 ; | |
527 last ; | |
528 } | |
529 } | |
530 | |
531 # ENABLE LOW_QUALITY SNP | |
532 if ($enableLowQuality == 1) { | |
533 | |
534 if ($test_inside_interval == 1 ){ # | |
535 if ($args[0] eq $VCFpolyploid) { # Polyploid | |
536 $polyploidName = $name_record ; | |
537 $snp{$gene}{$position} = $snp_code."\t".$AD."\t".$GT."\t".$DP[1]."-".$FDP ; | |
538 } | |
539 else { | |
540 if ($args[0] eq $VCFgenome1) { # genome1 | |
541 $genome1Name = $name_record ; | |
542 if (exists $snp{$gene}{$position}) { # if polyploid SNP | |
543 $snp{$gene}{$position} = $snp{$gene}{$position}."\t".$snp_code."\t".$GT ; | |
544 | |
545 ($code_snp,$ratio,$GT_poly,$DP_P,$code_G1,$GT_G1) = split(/\t/,$snp{$gene}{$position}); | |
546 @recupAlleles = split(/\[/,$code_snp); | |
547 @recupAlleles = split(/\]/,$recupAlleles[1]); | |
548 ($alRef,$alAltP) = split(/\//,$recupAlleles[0]); | |
549 @recupAlleles = split(/\[/,$code_G1); | |
550 @recupAlleles = split(/\]/,$recupAlleles[1]); | |
551 ($alRef,$code_G1) = split(/\//,$recupAlleles[0]); | |
552 | |
553 #print "\nINFOS\n".$GT_poly."\t"; | |
554 #print $GT_G1."\t"; | |
555 #print $code_G1."\t"; | |
556 #print $alAltP."\n"; | |
557 if ((($GT_poly =~ /^0.1$/)||($GT_poly =~ /^1.0$/)) && (($GT_G1 =~ /^1.1$/)) && ($code_G1 eq $alAltP)) { | |
558 $five{$gene}{$position} = $GT_poly ; | |
559 } | |
560 } | |
561 else { # if no polyploid SNP, key is empty | |
562 $snp{$gene}{$position} = $ref_allele."\t\t\t\t".$snp_code."\t".$GT ; | |
563 } | |
564 } | |
565 else { # genome2 | |
566 if ($args[0] eq $VCFgenome2) { | |
567 $genome2Name = $name_record ; | |
568 if (exists $snp{$gene}{$position}) { # if polyploid SNP | |
569 $snp{$gene}{$position} = $snp{$gene}{$position}."\t".$snp_code."\t".$GT; | |
570 } | |
571 else { # if no polyploid SNP and no genome1, key is empty | |
572 $snp{$gene}{$position} = $ref_allele."\t\t\t\t".$ref_allele."\t\t".$snp_code."\t".$GT ; | |
573 } | |
574 } | |
575 } | |
576 if ($args[0] eq $VCFpolyploid2) { # polyploid2 | |
577 $polyploid2Name = $name_record ; | |
578 if (exists $snp{$gene}{$position}) { # if polyploid SNP | |
579 $snp{$gene}{$position} = $snp{$gene}{$position}."\t".$snp_code."\t".$AD."\t".$GT."\t".$DP[1]."-".$FDP ; | |
580 } | |
581 else { # if no polyploid SNP, key is empty | |
582 $snp{$gene}{$position} = $ref_allele."\t\t\t\t".$snp_code."\t".$AD."\t".$GT."\t".$DP[1]."-".$FDP ; | |
583 } | |
584 } | |
585 } | |
586 } | |
587 } | |
588 # ONLY PASS SNP CONSIDERED | |
589 else { | |
590 if (($test_inside_interval == 1 ) && ($quality_of_snp eq $pass) && ($snp{$gene}{$position} ne "LQ")){ # | |
591 if ($args[0] eq $VCFpolyploid) { # Polyploid | |
592 $polyploidName = $name_record ; | |
593 $snp{$gene}{$position} = $snp_code."\t".$AD."\t".$GT."\t".$DP[1]."-".$FDP ; | |
594 } | |
595 else { | |
596 if ($args[0] eq $VCFgenome1) { # genome1 | |
597 $genome1Name = $name_record ; | |
598 if (exists $snp{$gene}{$position}) { # if polyploid SNP | |
599 $snp{$gene}{$position} = $snp{$gene}{$position}."\t".$snp_code."\t".$GT ; | |
600 | |
601 ($code_snp,$ratio,$GT_poly,$DP_P,$code_G1,$GT_G1) = split(/\t/,$snp{$gene}{$position}); | |
602 @recupAlleles = split(/\[/,$code_snp); | |
603 @recupAlleles = split(/\]/,$recupAlleles[1]); | |
604 ($alRef,$alAltP) = split(/\//,$recupAlleles[0]); | |
605 @recupAlleles = split(/\[/,$code_G1); | |
606 @recupAlleles = split(/\]/,$recupAlleles[1]); | |
607 ($alRef,$code_G1) = split(/\//,$recupAlleles[0]); | |
608 | |
609 #print "\nINFOS\n".$GT_poly."\t"; | |
610 #print $GT_G1."\t"; | |
611 #print $code_G1."\t"; | |
612 #print $alAltP."\n"; | |
613 if ((($GT_poly =~ /^0.1$/)||($GT_poly =~ /^1.0$/)) && (($GT_G1 =~ /^1.1$/)) && ($code_G1 eq $alAltP)) { | |
614 $five{$gene}{$position} = $GT_poly ; | |
615 } | |
616 } | |
617 else { # if no polyploid SNP, key is empty | |
618 $snp{$gene}{$position} = $ref_allele."\t\t\t\t".$snp_code."\t".$GT ; | |
619 } | |
620 } | |
621 else { # genome2 | |
622 if ($args[0] eq $VCFgenome2) { | |
623 $genome2Name = $name_record ; | |
624 if (exists $snp{$gene}{$position}) { # if polyploid SNP | |
625 $snp{$gene}{$position} = $snp{$gene}{$position}."\t".$snp_code."\t".$GT; | |
626 } | |
627 else { # if no polyploid SNP and no genome1, key is empty | |
628 $snp{$gene}{$position} = $ref_allele."\t\t\t\t".$ref_allele."\t\t".$snp_code."\t".$GT ; | |
629 } | |
630 } | |
631 } | |
632 if ($args[0] eq $VCFpolyploid2) { # polyploid2 | |
633 $polyploid2Name = $name_record ; | |
634 if (exists $snp{$gene}{$position}) { # if polyploid SNP | |
635 $snp{$gene}{$position} = $snp{$gene}{$position}."\t".$snp_code."\t".$AD."\t".$GT."\t".$DP[1]."-".$FDP ; | |
636 } | |
637 else { # if no polyploid SNP, key is empty | |
638 $snp{$gene}{$position} = $ref_allele."\t\t\t\t".$snp_code."\t".$AD."\t".$GT."\t".$DP[1]."-".$FDP ; | |
639 } | |
640 } | |
641 } | |
642 } | |
643 else { | |
644 if ($quality_of_snp ne $pass) { | |
645 $snp{$gene}{$position} = "LQ"; | |
646 } | |
647 } | |
648 } | |
649 ################################################################################################################################ | |
650 } | |
651 $previous_GT = $GT ; | |
652 $previous_position = $position ; | |
653 } | |
654 foreach my $s(sort(keys(%snp))){ | |
655 my $ref = $snp{$s}; | |
656 my %hash = %$ref; | |
657 foreach my $snip(keys(%hash)){ | |
658 if ($snp{$s}{$snip} ne "LQ"){ | |
659 $snp_final{$s}{$snip} = $snp{$s}{$snip} ; | |
660 } | |
661 } | |
662 } | |
663 return (%snp_final) ; | |
664 } | |
665 | |
666 sub intro_output { | |
667 | |
668 ########################################################### | |
669 # ANALYSE - CREATION FICHIERS DE SORTIE # | |
670 ########################################################### | |
671 | |
672 # Ouverture des fichiers | |
673 open (HTMLSNP, ">$SNP_html"); | |
674 open (TABSNP, ">$SNP_csv"); | |
675 open (HTMLCOUNT, ">$SNP_count"); | |
676 open (TABCOUNT, ">$SNP_count_csv"); | |
677 | |
678 print HMTL "<html>\n"; | |
679 print HTMLCOUNT "<html>\n"; | |
680 | |
681 print HTMLSNP "<head>\n"; | |
682 print HTMLCOUNT "<head>\n"; | |
683 | |
684 ##################################################### | |
685 # CSS # | |
686 ##################################################### | |
687 print HTMLSNP "<style type=\"text/css\">\n"; | |
688 | |
689 print HTMLSNP "th {\n"; | |
690 print HTMLSNP " border-color:black;\n"; | |
691 print HTMLSNP " border-style:solid; \n"; | |
692 print HTMLSNP " border-width:3px;\n"; | |
693 print HTMLSNP " font-family: calibri;\n"; | |
694 print HTMLSNP " }\n"; | |
695 | |
696 print HTMLSNP "body {text-align:center;}\n"; | |
697 | |
698 print HTMLSNP "table {\n"; | |
699 print HTMLSNP " border-color:black;\n"; | |
700 print HTMLSNP " margin:auto;\n"; | |
701 print HTMLSNP " border-collapse: collapse;\n"; | |
702 print HTMLSNP " border-width:3px; \n"; | |
703 print HTMLSNP " border-style:solid; \n"; | |
704 print HTMLSNP " }\n"; | |
705 | |
706 print HTMLSNP ".bord1 { \n"; | |
707 | |
708 print HTMLSNP " font-size: 11pt;\n"; | |
709 print HTMLSNP " font-family: calibri;\n"; | |
710 print HTMLSNP " border-width:1px;\n"; | |
711 print HTMLSNP " border-top:3px;\n"; | |
712 print HTMLSNP " border-left:3px;\n"; | |
713 print HTMLSNP " border-right:3px;\n"; | |
714 print HTMLSNP " border-style:solid; \n"; | |
715 print HTMLSNP " border-color:black;\n"; | |
716 print HTMLSNP " background-color : #c6c3bd; \n"; | |
717 print HTMLSNP " }\n"; | |
718 | |
719 print HTMLSNP ".bord2 { \n"; | |
720 | |
721 print HTMLSNP " font-size: 11pt;\n"; | |
722 print HTMLSNP " font-family: calibri;\n"; | |
723 print HTMLSNP " border-width:1px;\n"; | |
724 print HTMLSNP " border-top:3px;\n"; | |
725 print HTMLSNP " border-left:3px;\n"; | |
726 print HTMLSNP " border-right:3px;\n"; | |
727 print HTMLSNP " border-style:solid; \n"; | |
728 print HTMLSNP " border-color:black;\n"; | |
729 print HTMLSNP " background-color : #c6c3ee; \n"; | |
730 print HTMLSNP " }\n"; | |
731 | |
732 | |
733 print HTMLSNP "td { \n"; | |
734 print HTMLSNP " border-color:black;\n"; | |
735 print HTMLSNP " }\n"; | |
736 | |
737 print HTMLSNP ".tdm { \n"; | |
738 print HTMLSNP " border-color:black;\n"; | |
739 print HTMLSNP " border-left:3px;\n"; | |
740 print HTMLSNP " }\n"; | |
741 | |
742 | |
743 print HTMLSNP ".td1 { \n"; | |
744 print HTMLSNP " border-color:black;\n"; | |
745 print HTMLSNP " font-size: 11pt;\n"; | |
746 print HTMLSNP " font-family: calibri;\n"; | |
747 print HTMLSNP " border-width:1px;\n"; | |
748 print HTMLSNP " border-left:3px;\n"; | |
749 print HTMLSNP " border-right:3px;\n"; | |
750 print HTMLSNP " border-style:solid; \n"; | |
751 print HTMLSNP " background-color : #c6c3bd; \n"; | |
752 print HTMLSNP " }\n"; | |
753 | |
754 print HTMLSNP ".td2 { \n"; | |
755 print HTMLSNP " border-color:black;\n"; | |
756 print HTMLSNP " font-size: 11pt;\n"; | |
757 print HTMLSNP " font-family: calibri;\n"; | |
758 print HTMLSNP " border-width:1px;\n"; | |
759 print HTMLSNP " border-left:3px;\n"; | |
760 print HTMLSNP " border-right:3px;\n"; | |
761 print HTMLSNP " border-style:solid; \n"; | |
762 print HTMLSNP " background-color : #c6c3ee; \n"; | |
763 print HTMLSNP " }\n"; | |
764 | |
765 print HTMLSNP ".ted { \n"; | |
766 print HTMLSNP " border-color:black;\n"; | |
767 print HTMLSNP " font-weight : bold;\n"; | |
768 print HTMLSNP " background-color : #A19EED; \n"; | |
769 print HTMLSNP " }\n"; | |
770 | |
771 print HTMLSNP ".ted2 { \n"; | |
772 print HTMLSNP " border-color:black;\n"; | |
773 print HTMLSNP " font-weight : bold;\n"; | |
774 print HTMLSNP " background-color : #9A9D7C; \n"; | |
775 print HTMLSNP " }\n"; | |
776 | |
777 print HTMLSNP ".tedG { \n"; | |
778 print HTMLSNP " border-left:3px;\n"; | |
779 print HTMLSNP " border-style:solid; \n"; | |
780 print HTMLSNP " border-color:black;\n"; | |
781 print HTMLSNP " font-weight : bold;\n"; | |
782 print HTMLSNP " background-color : #A19EED; \n"; | |
783 print HTMLSNP " }\n"; | |
784 | |
785 print HTMLSNP ".tedG2 { \n"; | |
786 print HTMLSNP " border-left:3px;\n"; | |
787 print HTMLSNP " border-style:solid; \n"; | |
788 print HTMLSNP " border-color:black;\n"; | |
789 print HTMLSNP " font-weight : bold;\n"; | |
790 print HTMLSNP " background-color : #9A9D7C; \n"; | |
791 print HTMLSNP " }\n"; | |
792 | |
793 print HTMLSNP ".final { \n"; | |
794 print HTMLSNP " border-left:3px;\n"; | |
795 print HTMLSNP " border-right:0px;\n"; | |
796 print HTMLSNP " border-top:0px;\n"; | |
797 print HTMLSNP " border-bottom:0px;\n"; | |
798 print HTMLSNP " border-style:solid; \n"; | |
799 print HTMLSNP " border-color:black;\n"; | |
800 print HTMLSNP " background-color : white; \n"; | |
801 print HTMLSNP " }\n"; | |
802 | |
803 print HTMLSNP ".auto-style1 {"; | |
804 print HTMLSNP " font-weight: normal;"; | |
805 print HTMLSNP " font-size: x-small;"; | |
806 print HTMLSNP "}"; | |
807 | |
808 | |
809 print HTMLSNP "</style>\n"; | |
810 | |
811 print HTMLCOUNT "<style type=\"text/css\">\n"; | |
812 | |
813 print HTMLCOUNT "th {\n"; | |
814 print HTMLCOUNT " border-style:solid; \n"; | |
815 print HTMLCOUNT " border-color:black;\n"; | |
816 print HTMLCOUNT " border-width:3px;\n"; | |
817 print HTMLCOUNT " font-family:calibri;\n"; | |
818 print HTMLCOUNT " }\n"; | |
819 | |
820 print HTMLCOUNT "table {\n"; | |
821 print HTMLCOUNT " margin:auto;\n"; | |
822 print HTMLCOUNT " border-collapse: collapse;\n"; | |
823 print HTMLCOUNT " border-width:3px; \n"; | |
824 print HTMLCOUNT " border-style:solid; \n"; | |
825 print HTMLCOUNT " border-color:black;\n"; | |
826 print HTMLCOUNT " }\n"; | |
827 | |
828 print HTMLCOUNT ".th {\n"; | |
829 print HTMLCOUNT " font-weight : normal;\n"; | |
830 print HTMLCOUNT " border-style:solid; \n"; | |
831 print HTMLCOUNT " border-color:white;\n"; | |
832 print HTMLCOUNT " border-width:0px;\n"; | |
833 print HTMLCOUNT " font-family:consolas;\n"; | |
834 print HTMLCOUNT " }\n"; | |
835 | |
836 print HTMLCOUNT ".tab2 {\n"; | |
837 print HTMLCOUNT " margin:auto;\n"; | |
838 print HTMLCOUNT " border-collapse: collapse;\n"; | |
839 print HTMLCOUNT " border-style:solid; \n"; | |
840 print HTMLCOUNT " border-width:3px; \n"; | |
841 print HTMLCOUNT " border-color:white;\n"; | |
842 print HTMLCOUNT " }\n"; | |
843 | |
844 print HTMLCOUNT ".tab {\n"; | |
845 print HTMLCOUNT " margin:auto;\n"; | |
846 print HTMLCOUNT " border-collapse: collapse;\n"; | |
847 print HTMLCOUNT " border-width:3px;\n "; | |
848 print HTMLCOUNT " border-style:solid;\n "; | |
849 print HTMLCOUNT " border-color:black;\n"; | |
850 print HTMLCOUNT " }\n"; | |
851 | |
852 print HTMLCOUNT ".td1 { \n"; | |
853 print HTMLCOUNT " border-color:black;\n"; | |
854 print HTMLCOUNT " font-size: 11pt;\n"; | |
855 print HTMLCOUNT " font-family: calibri;\n"; | |
856 print HTMLCOUNT " border-width:1px;\n"; | |
857 print HTMLCOUNT " border-left:3px;\n"; | |
858 print HTMLCOUNT " border-right:3px;\n"; | |
859 print HTMLCOUNT " border-style:solid; \n"; | |
860 print HTMLCOUNT " background-color : #c6c3bd; \n"; | |
861 print HTMLCOUNT " }\n"; | |
862 | |
863 print HTMLCOUNT ".td2 { \n"; | |
864 print HTMLCOUNT " border-color:black;\n"; | |
865 print HTMLCOUNT " font-size: 11pt;\n"; | |
866 print HTMLCOUNT " font-family: calibri;\n"; | |
867 print HTMLCOUNT " border-width:1px;\n"; | |
868 print HTMLCOUNT " border-left:3px;\n"; | |
869 print HTMLCOUNT " border-right:3px;\n"; | |
870 print HTMLCOUNT " border-style:solid; \n"; | |
871 print HTMLCOUNT " background-color : #c6c3ee; \n"; | |
872 print HTMLCOUNT " }\n"; | |
873 | |
874 print HTMLCOUNT ".td3 { \n"; | |
875 print HTMLCOUNT " border-color:black;\n"; | |
876 print HTMLCOUNT " font-size: 11pt;\n"; | |
877 print HTMLCOUNT " font-weight: bold;\n"; | |
878 print HTMLCOUNT " font-family: calibri;\n"; | |
879 print HTMLCOUNT " border-width:3px;\n"; | |
880 print HTMLCOUNT " border-left:3px;\n"; | |
881 print HTMLCOUNT " border-right:3px;\n"; | |
882 print HTMLCOUNT " border-style:solid; \n"; | |
883 print HTMLCOUNT " background-color : white; \n"; | |
884 print HTMLCOUNT " }\n"; | |
885 | |
886 | |
887 print HTMLCOUNT ".ted { \n"; | |
888 print HTMLCOUNT " border-color:black;\n"; | |
889 print HTMLCOUNT " font-weight : bold;\n"; | |
890 print HTMLCOUNT " background-color : #A19EED; \n"; | |
891 print HTMLCOUNT " }\n"; | |
892 | |
893 print HTMLCOUNT ".ted2 { \n"; | |
894 print HTMLCOUNT " border-color:black;\n"; | |
895 print HTMLCOUNT " font-weight : bold;\n"; | |
896 print HTMLCOUNT " background-color : #9A9D7C; \n"; | |
897 print HTMLCOUNT " }\n"; | |
898 | |
899 print HTMLCOUNT ".ted3 { \n"; | |
900 print HTMLCOUNT " border-color:black;\n"; | |
901 print HTMLCOUNT " font-family: calibri;\n"; | |
902 print HTMLCOUNT " color: white;\n"; | |
903 print HTMLCOUNT " background-color : #333333; \n"; | |
904 print HTMLCOUNT " }\n"; | |
905 | |
906 print HTMLCOUNT ".auto-style1 {"; | |
907 print HTMLCOUNT " font-weight: normal;"; | |
908 print HTMLCOUNT " font-size: x-small;"; | |
909 print HTMLCOUNT "}"; | |
910 | |
911 print HTMLCOUNT "</style>\n"; | |
912 | |
913 ################################################################################################################################################################################### | |
914 | |
915 print HTMLSNP "</head>\n"; | |
916 | |
917 print HTMLSNP "<center><img src=\"".$REPimages."SNiPloid7.png\" WIDTH=250></center>"; | |
918 if ($poly_poly_analysis == 0) { | |
919 print HTMLSNP "<center><img src=\"".$REPimages."arbre.png\" WIDTH=400></center>"; | |
920 } | |
921 print HTMLSNP "<p>\n"; | |
922 #---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
923 print HTMLCOUNT "</head>\n"; | |
924 print HTMLCOUNT "<table><tr><td class=\"tab2\"><img src=\"".$REPimages."SNiPloid7.png\" WIDTH=250>"; | |
925 | |
926 print HTMLCOUNT "<h3><font face=\"calibri\">Synthesis of the analysis</font></h3></td>"; | |
927 if ($poly_poly_analysis == 0) { | |
928 | |
929 print HTMLCOUNT "<td class=\"tab2\" width=50></td>"; | |
930 print HTMLCOUNT "<td class=\"tab2\"><table border=\"1\" border cellpadding=\"5\" style=\"text-align:center;\">"; | |
931 print HTMLCOUNT "<tr><th>Diploids</th><th>Polyploid</th><th>Identity</th><th>Interpretation</th></tr>"; | |
932 print HTMLCOUNT "<tr><td>[1/2]</td><td>[1]</td><td>!=</td><td><img src=\"".$REPimages."1.png\" height=30></td></tr>"; | |
933 print HTMLCOUNT "<tr><td>[1/2]</td><td>[2]</td><td>!=</td><td><img src=\"".$REPimages."2.png\" height=30></td></tr>"; | |
934 print HTMLCOUNT "<tr><td>[1]</td><td>[1/2]</td><td>!=</td><td><img src=\"".$REPimages."3.png\" height=30></td></tr>"; | |
935 print HTMLCOUNT "<tr><td>[2]</td><td>[1/2]</td><td>!=</td><td><img src=\"".$REPimages."4.png\" height=30></td></tr>"; | |
936 print HTMLCOUNT "<tr><td>[1/2]</td><td>[1/2]</td><td>=</td><td><img src=\"".$REPimages."5v.png\" height=30></td></tr>"; | |
937 print HTMLCOUNT "<tr><td>[1]</td><td>[2]</td><td>!=</td><td><img src=\"".$REPimages."other.png\" height=30></td></tr>"; | |
938 print HTMLCOUNT "<tr><td>[1]</td><td>[2/3]</td><td>!=</td><td><img src=\"".$REPimages."other.png\" height=30></td></tr>"; | |
939 print HTMLCOUNT "<tr><td>[1/2]</td><td>[2/3]</td><td>!=</td><td><img src=\"".$REPimages."other.png\" height=30></td></tr>"; | |
940 print HTMLCOUNT "<tr><td>[1/2]</td><td>[1/2]</td><td>!=</td><td><img src=\"".$REPimages."other.png\" height=30><img src=\"".$REPimages."HG1.png\" height=30></td></tr>"; | |
941 print HTMLCOUNT "<tr><td>[1]</td><td>[1/2]</td><td>!=</td><td><img src=\"".$REPimages."other.png\" height=30><img src=\"".$REPimages."HG1.png\" height=30></td></tr>"; | |
942 print HTMLCOUNT "</table></td>"; | |
943 print HTMLCOUNT "<td class=\"tab2\" width=50></td>"; | |
944 print HTMLCOUNT "<td class=\"tab2\"><center><img src=\"".$REPimages."arbre.png\" WIDTH=400></center></td>"; | |
945 #print HTMLCOUNT "<td><table border=\"1\" border cellpadding=\"5\" style=\"text-align:center;\"><tr><th>Diploids</th><th>Polyploid</th><th>Identity</th><th>Interpretation</th></tr></table></td>"; | |
946 print HTMLCOUNT "</tr></table>"; | |
947 } | |
948 print HTMLCOUNT "<p>\n"; | |
949 #---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
950 | |
951 print HTMLSNP "<body>\n"; | |
952 | |
953 if ($poly_poly_analysis == 1) { | |
954 print HTMLSNP "<center><h3><font face=\"calibri\">Result of SNP comparison of two Polyploids</font></h3></center>"; | |
955 } | |
956 else { | |
957 print HTMLSNP "<center><h3><font face=\"calibri\">Result of SNP comparison of a Polyploid and its Parental Genomes (Genome 1 and Genome 2 as reference)</font></h3></center>"; | |
958 } | |
959 | |
960 print HTMLSNP "<p>\n"; | |
961 | |
962 # COLUMNS - HTMLSNP SNP VIEW | |
963 print HTMLSNP "<table border=\"1\" border cellpadding=\"5\" style=\"text-align:center;\"> \n"; | |
964 print HTMLSNP "<tr>\n"; | |
965 print HTMLSNP "<th>Gene</th>"; # (1) Gene | |
966 print HTMLSNP "<th>Position</th>"; # (2) Position | |
967 | |
968 if ($poly_poly_analysis == 1) { | |
969 print HTMLSNP "<th>REF<br></th>"; | |
970 print HTMLSNP "<th>Polyploid 1<br><span class=\"auto-style1\">".$polyploidName."</span></th>"; # (3) Polyploid | |
971 print HTMLSNP "<th>Polyploid 2<br><span class=\"auto-style1\">".$polyploid2Name."</span></th>"; # (4) Polyploid 2 | |
972 | |
973 print HTMLSNP "<th>[Filtered/Total] Depth<br>Polyploid 1<br><span class=\"auto-style1\">".$polyploidName."</span></th>"; # (8) Filtered Depth | |
974 print HTMLSNP "<th>[Filtered/Total] Depth<br>Polyploid 2<br><span class=\"auto-style1\">".$polyploid2Name."</span></th>"; # (9) Total Depth | |
975 | |
976 # Entête fichier SNP VIEW TAB | |
977 print TABSNP "Gene\t"; # (1) Gene | |
978 print TABSNP "Position\t"; # (2) Position | |
979 print TABSNP "REF\t"; # (2) Position | |
980 print TABSNP "Polyploid 1: ".$polyploidName."\t"; # (3) Polyploid | |
981 print TABSNP "Polyploid 2: ".$genome1Name."\t"; # (4) Genome 1 | |
982 print TABSNP "P1 Filtered Depth\t"; # (9) Filtered Depth | |
983 print TABSNP "P1 Total Depth\t"; # (10) Total Depth | |
984 print TABSNP "P2 Filtered Depth\t"; # (9) Filtered Depth | |
985 print TABSNP "P2 Total Depth\n"; # (10) Total Depth | |
986 } | |
987 else { | |
988 # (3) Reference | |
989 print HTMLSNP "<th>Polyploid<br><span class=\"auto-style1\">".$polyploidName."</span></th>"; # (3) Polyploid | |
990 print HTMLSNP "<th>Genome 1<br><span class=\"auto-style1\">".$genome1Name."</span></th>"; # (4) Genome 1 | |
991 print HTMLSNP "<th>Genome 2<br><span class=\"auto-style1\">".$genome2Name."</span></th>"; # (5) Genome 2 | |
992 print HTMLSNP "<th>Validation</th>"; | |
993 print HTMLSNP "<th>Ratio (%)<br><span class=\"auto-style1\">".$genome2Name." : ".$genome1Name."</span></th>"; # (7) Ratio | |
994 print HTMLSNP "<th>Filtered<br>Depth</th>"; # (8) Filtered Depth | |
995 print HTMLSNP "<th>Total<br>Depth</th>"; # (9) Total Depth | |
996 | |
997 # Entête fichier SNP VIEW TAB | |
998 print TABSNP "Gene\t"; # (1) Gene | |
999 print TABSNP "Position\t"; # (2) Position | |
1000 print TABSNP "Polyploid: ".$polyploidName."\t"; # (3) Polyploid | |
1001 print TABSNP "Genome 1: ".$genome1Name."\t"; # (4) Genome 1 | |
1002 print TABSNP "Genome 2: ".$genome2Name."\t"; # (5) Genome 2 | |
1003 print TABSNP "Validation\t"; # (6) Validation | |
1004 print TABSNP "Ratio (%) ".$genome2Name."\t"; # (7) Ratio Genome 1 | |
1005 print TABSNP "Ratio (%) ".$genome1Name."\t"; # (8) Ratio Genome 2 | |
1006 print TABSNP "Filtered Depth\t"; # (9) Filtered Depth | |
1007 print TABSNP "Total Depth\n"; # (10) Total Depth | |
1008 } | |
1009 print HTMLSNP "</tr>\n"; | |
1010 | |
1011 | |
1012 | |
1013 #---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
1014 print HTMLCOUNT "<body>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; | |
1015 print HTMLCOUNT "<p>\n"; | |
1016 # COLUMNS - HTML SYNTHESIS | |
1017 print HTMLCOUNT "<table border=\"1\" border cellpadding=\"5\" style=\"text-align:center;\"> \n"; | |
1018 print HTMLCOUNT "<tr>\n"; | |
1019 print HTMLCOUNT "<th>Gene</th>"; # (1) Gene | |
1020 print HTMLCOUNT "<th>Interval Size<br>Analysed (pb)</th>"; # (2) Interval Size Analyzed | |
1021 print HTMLCOUNT "<th>nb Positions<br>with SNP</th>"; | |
1022 if ($poly_poly_analysis == 0) { # (3) nB Positions With SNP | |
1023 print HTMLCOUNT "<th><img src=\"".$REPimages."1.png\" height=30></th>"; # (4) [1] | |
1024 print HTMLCOUNT "<th><img src=\"".$REPimages."2.png\" height=30></th>"; # (5) [2] | |
1025 print HTMLCOUNT "<th><img src=\"".$REPimages."3ou4.png\" height=30></th>"; # (6) [3 or 4] | |
1026 print HTMLCOUNT "<th><img src=\"".$REPimages."3.png\" height=30></th>"; # (6) [3 or 4] | |
1027 print HTMLCOUNT "<th><img src=\"".$REPimages."4.png\" height=30></th>"; # (6) [3 or 4] | |
1028 print HTMLCOUNT "<th><img src=\"".$REPimages."5v.png\" height=30></th>"; # (11) [5] | |
1029 print HTMLCOUNT "<th><img src=\"".$REPimages."other.png\" height=30></th>"; # (7) [other] | |
1030 print HTMLCOUNT "<th><img src=\"".$REPimages."HG1.png\" height=30><br><span class=\"auto-style1\">".$genome1Name."</span></th>"; # (8) Heterozygosity For Genome 1 | |
1031 print HTMLCOUNT "<th>SNP Intra-Diploids <br><img src=\"".$REPimages."5v.png\" height=30> + <img src=\"".$REPimages."1.png\" height=30> + <img src=\"".$REPimages."2.png\" height=30> + <img src=\"".$REPimages."other.png\" height=30></th>"; # (9) SNP Diploids | |
1032 print HTMLCOUNT "<th>SNP Intra-Polyploid <br> <img src=\"".$REPimages."5v.png\" height=30> + <img src=\"".$REPimages."3ou4.png\" height=30> + <img src=\"".$REPimages."other.png\" height=30></th>"; # (10) SNP Polyploid | |
1033 print HTMLCOUNT "<th>Ratio (%)<br><span class=\"auto-style1\">".$genome2Name." : ".$genome1Name."</span></th>\n\n\n\n\n\n\n\n"; # (12) Ratio % | |
1034 | |
1035 print HTMLCOUNT "</tr>\n"; | |
1036 # Entête HTMLSNP Synthesis | |
1037 print TABCOUNT "Gene\t"; # (1) Gene | |
1038 print TABCOUNT "Interval Size Analysed (pb)\t"; # (2) Interval Size Analysed (pb) | |
1039 print TABCOUNT "nb SNP positions\t"; # (3) nb SNP positions | |
1040 print TABCOUNT "1\t"; # (4) [1] | |
1041 print TABCOUNT "2\t"; # (5) [2] | |
1042 print TABCOUNT "3 or 4\t"; # (6) [3 or 4] | |
1043 print TABCOUNT "3\t"; # (6) [3 or 4] | |
1044 print TABCOUNT "4\t"; # (6) [3 or 4] | |
1045 print TABCOUNT "5\t"; # (11) [5] | |
1046 print TABCOUNT "other\t"; # (7) [other] | |
1047 print TABCOUNT "SNP Heterozygosity Genome 1\t"; # (8) SNP Heterozygosity Genome 1 | |
1048 print TABCOUNT "SNP Diploids\t"; # (9) SNP Diploids | |
1049 print TABCOUNT "SNP Polyploid\t"; # (10) SNP Polyploid | |
1050 print TABCOUNT "Ratio (%) ".$genome2Name."\t"; # (12) Ratio (%) Genome 2 | |
1051 print TABCOUNT "Ratio (%) ".$genome1Name."\n"; # (13) Ratio (%) Genome 1 | |
1052 } | |
1053 else { | |
1054 print HTMLCOUNT "<th>P1 = P2<br><span style=\"font-weight: normal\"><span style=\"background:#DE8A8A\">[1/2]</span> vs <span style=\"background:#DE8A8A\">[1/2]</span></span></th>"; # (4) [1] | |
1055 print HTMLCOUNT "<th>P1 = P2<br><span style=\"font-weight: normal\"><span style=\"background:#5CAAD2\">[1]</span> vs <span style=\"background:#5CAAD2\">[1]</span></span></th>"; # (4) [1] | |
1056 print HTMLCOUNT "<th>SNP<br>interpolyploids<br>P1 ≠ P2<br><span style=\"auto-style1\"></span></th>"; # (4) [1] #DE8A8A | |
1057 print HTMLCOUNT "<th>P1 ≠ P2<br>2 Alleles<br><span style=\"font-weight: normal\"><span style=\"background:#5CAAD2\">[1]</span> vs <span style=\"background:#5CAAD2\">[2]</span></span></th>"; # (4) [1] | |
1058 print HTMLCOUNT "<th>P1 ≠ P2<br>2 Alleles<br><span style=\"font-weight: normal\"><span style=\"background:#DE8A8A\">[1/2]</span> vs <span style=\"background:#5CAAD2\">[1]</span> or <span style=\"background:#5CAAD2\">[2]</span></span></th>"; # (4) [1] | |
1059 print HTMLCOUNT "<th>P1 ≠ P2<br>3 Alleles<br><span style=\"font-weight: normal\"><span style=\"background:#DE8A8A\">[1/2]</span> vs <span style=\"background:#5CAAD2\">[3]</span></span></th>"; # (4) [1] | |
1060 print HTMLCOUNT "<th>P1 ≠ P2<br>3 Alleles<br><span style=\"font-weight: normal\"><span style=\"background:#DE8A8A\">[1/2]</span> vs <span style=\"background:#DE8A8A\">[1/3]</span></span></th>"; # (4) [1] | |
1061 print HTMLCOUNT "<th>SNP<br>intra P1<br><span class=\"auto-style1\">".$polyploidName."</span></th>"; # (4) [1] | |
1062 print HTMLCOUNT "<th>SNP<br>intra P2<br><span class=\"auto-style1\">".$polyploid2Name."</span></th>"; # (4) [1] | |
1063 | |
1064 print HTMLCOUNT "</tr>\n"; | |
1065 # Entête HTMLSNP Synthesis | |
1066 print TABCOUNT "Gene\t"; # (1) Gene | |
1067 print TABCOUNT "Interval Size Analysed (pb)\t"; # (2) Interval Size Analysed (pb) | |
1068 print TABCOUNT "nb positions with SNP\t"; # (3) nb SNP positions | |
1069 print TABCOUNT "P1 = P2 [1/2] vs [1/2]\t"; # (4) [1] | |
1070 print TABCOUNT "P1 = P2 [1] vs [1]\t"; # (4) [1] | |
1071 print TABCOUNT "SNP interpolyploids P1 diff P2\t"; # (4) [1] #DE8A8A | |
1072 print TABCOUNT "P1 diff P2 2 Alleles [1] vs [2]\t"; # (4) [1] | |
1073 print TABCOUNT "P1 diff P2 2 Alleles [1/2] vs [1] or [2]\t"; # (4) [1] | |
1074 print TABCOUNT "P1 diff P2 3 Alleles [1/2] vs [3]\t"; # (4) [1] | |
1075 print TABCOUNT "P1 diff P2 3 Alleles [1/2] vs [1/3]\t"; # (4) [1] | |
1076 print TABCOUNT "SNP intra P1 ".$polyploidName."\t" ; # (4) [1] | |
1077 print TABCOUNT "SNP intra P2 ".$polyploid2Name."\n" ; # (4) [1] | |
1078 | |
1079 } | |
1080 #---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
1081 $ligneInter = 0 ; | |
1082 $totalSNP = 0 ; | |
1083 $totalSize = 0 ; | |
1084 | |
1085 $total11 = 0 ; | |
1086 $total22 = 0 ; | |
1087 $total3ou4 = 0 ; | |
1088 $total5 = 0 ; | |
1089 $total512 = 0 ; | |
1090 $total534 = 0 ; | |
1091 $totalOther = 0 ; | |
1092 $totalGenome2 = 0 ; | |
1093 | |
1094 $total3 = 0 ; | |
1095 $total4 = 0 ; | |
1096 | |
1097 $totalNbPolyploid1 = 0 ; # SNP heterozygosity for P1 | |
1098 $totalNbPolyploid2 = 0 ; # SNP heterozygosity for P2 | |
1099 $totalNbCommuns = 0 ; # SNP heterozygosity [P1] = [P2] | |
1100 $totalNbCommunsHomo = 0 ; # SNP homozygosity [P1] = [P2] | |
1101 $totalNbDifferent = 0 ; # [P1] ne [P2] | |
1102 $totalNbHomoDiff = 0 ; # Example : P1 = [A] ; P2 = [G] | |
1103 $totalNbAlleleCommun = 0 ; # Example : P1 = [A/G] ; P2 = [A] | |
1104 $totalAlleleDifferent = 0 ; # Example : P1 = [A/G] ; P2 = [C] or [T] | |
1105 $totalAlleleCommunH = 0 ; # Example : P1 = [A/G] ; P2 = [A/C] | |
1106 | |
1107 } | |
1108 | |
1109 sub int_output { # intern reference | |
1110 | |
1111 foreach my $s(sort(keys(%snp_final))){ | |
1112 ####################################### | |
1113 if ($ligneInter == 0) { | |
1114 print HTMLSNP "<tr class=\"bord1\">\n"; | |
1115 print HTMLCOUNT "<tr class=\"td1\ border-width =\"3px\">\n"; | |
1116 } | |
1117 else { | |
1118 print HTMLSNP "<tr class=\"bord2\">\n"; | |
1119 print HTMLCOUNT "<tr class=\"td2\">\n"; | |
1120 } | |
1121 ####################################### | |
1122 | |
1123 my $ref = $snp_final{$s}; | |
1124 my %hash = %$ref; | |
1125 $taille = keys(%hash); | |
1126 | |
1127 # taille de la ligne gene | |
1128 print HTMLSNP "<td rowspan=\"".$taille."\"><b>".$s."</b></td>"; | |
1129 | |
1130 $ligneOK = 0 ; | |
1131 | |
1132 $nbPolyploid = 0; | |
1133 $nbGenomes = 0 ; | |
1134 $nbGenome2 = 0 ; # SNP chez les diploides dans un cas "Other" avec genome 1 heterozygote | |
1135 $nbCommuns = 0; | |
1136 $nbPoly_only = 0 ; | |
1137 $nbSub_only = 0 ; | |
1138 | |
1139 $case5 = 0 ; | |
1140 $case1 = 0 ; | |
1141 $case2 = 0 ; | |
1142 $case3ou4 = 0; | |
1143 $case3 = 0 ; | |
1144 $case4 = 0 ; | |
1145 $caseOther = 0; | |
1146 $casePolyplother = 0 ; # SNP chez le polyploide dans un cas "Other" | |
1147 $caseDiplother = 0 ; # SNP chez les diploides dans un cas "Other" | |
1148 | |
1149 | |
1150 | |
1151 # Moyenne Ponderee | |
1152 $moyenneSNPindep1 = 0 ; | |
1153 $moyenneSNPindep2 = 0 ; | |
1154 | |
1155 @tabTrie = sort ({ $a <=> $b }keys %hash); | |
1156 | |
1157 #foreach my $c(sort ({$hash{$a} <=> $hash{$b}} keys %hash)) { | |
1158 foreach my $c(@tabTrie) { | |
1159 if ($ligneOK == 1) { | |
1160 if ($ligneInter == 0) { | |
1161 print HTMLSNP "<tr class=\"td1\">\n"; | |
1162 } | |
1163 else { | |
1164 print HTMLSNP "<tr class=\"td2\">\n"; | |
1165 } | |
1166 } | |
1167 ################################################################################ | |
1168 ### Recuperation des informations ### | |
1169 | |
1170 ($code_snp,$ratio,$GT_poly,$DP_P,$code_G1,$GT_G1) = split(/\t/,$snp_final{$s}{$c}); | |
1171 ($DP_P, $FDP) = split(/-/, $DP_P); | |
1172 #print STDOUT "\n($code_snp:$GT_poly) - ($code_G1:$GT_G1)" ; | |
1173 if ($GT_poly ne "") { # Polyploide = [0.0] ou [0.1] ou [1.1] | |
1174 @recupAlleles = split(/\[/,$code_snp); | |
1175 @recupAlleles = split(/\]/,$recupAlleles[1]); | |
1176 ($alRef,$alAltP) = split(/\//,$recupAlleles[0]); | |
1177 # Attribution des alleles au polyploide si pas de SNP | |
1178 if ($GT_poly =~ /^0.0$/) { $code_snp = $alRef ; } | |
1179 if ($GT_poly =~ /^1.1$/) { $code_snp = $alAltP ; } | |
1180 # Attribution des alleles au genome 1 si pas de SNP | |
1181 if (($GT_G1 eq "") || ($GT_G1 =~ /^0.0$/)) { $code_G1 = $alRef ; } | |
1182 if ($GT_G1 =~ /^1.1$/) { | |
1183 @recupAlleles = split(/\[/,$code_G1); | |
1184 @recupAlleles = split(/\]/,$recupAlleles[1]); | |
1185 ($alRef,$alAlt) = split(/\//,$recupAlleles[0]); | |
1186 $code_G1 = $alAlt; | |
1187 } | |
1188 } | |
1189 elsif ($GT_G1 ne "") { # pas de SNP polyploide dans le fichier 1 (fichiers non mergés) -> equivalent de [0.0] | |
1190 @recupAlleles = split(/\[/,$code_G1); | |
1191 @recupAlleles = split(/\]/,$recupAlleles[1]); | |
1192 ($alRef,$alAlt) = split(/\//,$recupAlleles[0]); | |
1193 # Attribution des Alleles au genome 1 | |
1194 if ($GT_G1 =~ /^1.1$/) { $code_G1 = $alAlt ; } | |
1195 if ($GT_G1 =~ /^0.0$/) { $code_G1 = $alRef ; } | |
1196 } | |
1197 | |
1198 ################################################################################ | |
1199 $noSNPpoly = "ok" ; | |
1200 | |
1201 | |
1202 | |
1203 | |
1204 if ((($GT_poly =~ /^0.1$/)||($GT_poly =~ /^1.0$/)) && (($GT_G1 =~ /^1.1$/)) && ($code_G1 eq $alAltP)) { | |
1205 if ($ligneInter == 0) { | |
1206 print HTMLSNP "<td class=\"tedG2\">".$c."</td>"; | |
1207 print HTMLSNP "<td class=\"ted2\">".$code_snp."</td>"; | |
1208 print HTMLSNP "<td class=\"ted2\">".$code_G1."</td>"; | |
1209 print HTMLSNP "<td class=\"ted2\">".$alRef."</td>"; #REF | |
1210 print HTMLSNP "<td class=\"ted2\">OK</td>"; | |
1211 | |
1212 } | |
1213 else { | |
1214 print HTMLSNP "<td class=\"tedG\">".$c."</td>"; | |
1215 print HTMLSNP "<td class=\"ted\">".$code_snp."</td>"; | |
1216 print HTMLSNP "<td class=\"ted\">".$code_G1."</td>"; | |
1217 print HTMLSNP "<td class=\"ted\">".$alRef."</td>"; #REF | |
1218 print HTMLSNP "<td class=\"ted\">OK</td>"; | |
1219 } | |
1220 } | |
1221 else { | |
1222 print HTMLSNP "<td style=\"border-left:3px solid black\">".$c."</td>"; | |
1223 print HTMLSNP "<td>".$code_snp."</td>"; | |
1224 print HTMLSNP "<td>".$code_G1."</td>"; | |
1225 print HTMLSNP "<td>".$alRef."</td>"; #REF | |
1226 print HTMLSNP "<td></td><td></td><td></td><td></td>"; | |
1227 } | |
1228 print TABSNP $s."\t".$c."\t".$code_snp."\t".$code_G1."\t".$alRef."\t"; | |
1229 | |
1230 | |
1231 | |
1232 $tailleImg = 35 ; | |
1233 | |
1234 | |
1235 if (($GT_poly =~ /^0.1$/)||($GT_poly =~ /^1.0$/)) { # SNP POLYPLOID - [0/1] [0|1] [1|0] | |
1236 # Moyenne du Ratio ----------------------------------- | |
1237 ($sub1,$sub2) = split(",",$ratio); | |
1238 $somme = $sub1 + $sub2 ; | |
1239 | |
1240 if ($somme == 0 ) { | |
1241 print STDOUT "ERROR : Cannot calculate ratio for ".$gene." [pos:".$position."]\n\"".$line."\""; | |
1242 die ("ERROR : Cannot calculate ratio for ".$gene." [pos:".$position."]\n\"".$line."\""); | |
1243 } | |
1244 else { | |
1245 $ratio = ($sub1/($sub1+$sub2))*100; | |
1246 $ratio = sprintf("%.0f", $ratio); | |
1247 } | |
1248 #$ratio = sprintf("%.0f", $ratio); | |
1249 $ratio2 = 100-$ratio ; | |
1250 | |
1251 #----------------------------------------------------- | |
1252 if (($GT_G1 =~ /^1.1$/)){ # Pas de SNP Genome1 [1/1] [1|1] SNP entre genome1 et genome2 | |
1253 if ($code_G1 eq $alAltP) { # 5 | |
1254 $moyenneSNPindep1 = $moyenneSNPindep1 + $ratio ; | |
1255 $moyenneSNPindep2 = $moyenneSNPindep2 + $ratio2 ; | |
1256 if ($ligneInter == 0) { | |
1257 print HTMLSNP "<td class=\"ted2\">".$ratio.":".$ratio2."<br>"; # RATIO % | |
1258 print HTMLSNP "<img src=\"".$REPimages."r1.png\" height=10 width=".$ratio.">"; # IMG RATIO 1 | |
1259 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=10 width=".$ratio2."></td>"; # IMG RATIO 2 | |
1260 print HTMLSNP "<td class=\"ted2\">".$FDP."</td>"; | |
1261 print HTMLSNP "<td class=\"ted2\">".$DP_P."</td>"; | |
1262 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5v.png\" height=".$tailleImg."></td>"; | |
1263 | |
1264 } | |
1265 else { | |
1266 print HTMLSNP "<td class=\"ted\">".$ratio.":".$ratio2."<br>"; # RATIO % | |
1267 print HTMLSNP "<img src=\"".$REPimages."r1.png\" height=10 width=".$ratio.">"; # IMG RATIO 1 | |
1268 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=10 width=".$ratio2.">"; # IMG RATIO 2 | |
1269 print HTMLSNP "<td class=\"ted\">".$FDP."</td>"; | |
1270 print HTMLSNP "<td class=\"ted\">".$DP_P."</td>"; | |
1271 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5v.png\" height=".$tailleImg."></td>"; | |
1272 | |
1273 } | |
1274 print TABSNP "OK\t".$ratio."\t".$ratio2."\t".$FDP."\t".$DP_P."\t5"; | |
1275 $case5 ++ ; | |
1276 } | |
1277 else { # Other 0.1 - 1.1 (O GA A) # Other [SNP DIPLO + SNP POLY] | |
1278 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."other.png\" height=".$tailleImg."></td>"; | |
1279 print TABSNP "\t\t\t\t\tother"; | |
1280 $caseOther ++ ; | |
1281 $casePolyplother ++ ; | |
1282 $caseDiplother ++ ; | |
1283 } | |
1284 } | |
1285 else { | |
1286 if (($GT_G1 =~ /^0.0$/)||($GT_G1 =~ /^$/)){ # 3 ou 4 | |
1287 | |
1288 ############################################################################################### | |
1289 # PHASING | |
1290 ############################################################################################### | |
1291 $phasedornot = 0 ; | |
1292 if ($GT_poly =~/\|/){ | |
1293 | |
1294 #print STDOUT $s."\n"; | |
1295 my $ref = $phased_regions{$s}; | |
1296 my %hash = %$ref ; | |
1297 foreach my $num_reg(sort(keys(%hash))){ | |
1298 if (exists $phased_regions{$s}{$num_reg}{$c}) { | |
1299 $genotype = $phased_regions{$s}{$num_reg}{$c} ; | |
1300 my $ref2 = $phased_regions{$s}{$num_reg}; | |
1301 my %hash2 = %$ref2 ; | |
1302 foreach my $pos(sort(keys(%hash2))){ | |
1303 if (exists $five{$s}{$pos}){ | |
1304 if (($five{$s}{$pos} =~ /0.1/ && $GT_poly =~ /0.1/) or ($five{$s}{$pos} =~ /1.0/ && $GT_poly =~ /1.0/)){ | |
1305 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."3.png\" height=".$tailleImg."></td>"; | |
1306 $case3 ++ ; | |
1307 } | |
1308 else { | |
1309 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."4.png\" height=".$tailleImg."></td>"; | |
1310 $case4 ++ ; | |
1311 } | |
1312 $phasedornot = 1 ; | |
1313 last ; | |
1314 } | |
1315 } | |
1316 } | |
1317 } | |
1318 #print STDOUT "\n"; | |
1319 } | |
1320 if ($phasedornot == 0) { | |
1321 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."3ou4.png\" height=".$tailleImg."></td>"; | |
1322 $case3ou4 ++ ; | |
1323 } | |
1324 | |
1325 ############################################################################################### | |
1326 | |
1327 | |
1328 | |
1329 | |
1330 print TABSNP "\t\t\t\t\t3or4"; | |
1331 | |
1332 } | |
1333 else { #0/1 # heterozygosity G1 | |
1334 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."other.png\" height=".$tailleImg."><img src=\"".$REPimages."HG1.png\" height=".$tailleImg."></td>"; | |
1335 print TABSNP "\t\t\t\t\tother,heterozygosity for genome 1"; | |
1336 $nbGenome2 ++ ; | |
1337 $casePolyplother ++ ; | |
1338 $caseOther ++ ; | |
1339 } | |
1340 } | |
1341 } | |
1342 | |
1343 if (($GT_poly =~ /^1.1$/)) { # POLYPLOID NE REFERENCE - [1/1] | |
1344 if ($GT_G1 && ($GT_G1 !~ /^0.0$/) && ($GT_G1 !~ /^1.1$/)){ # SNP Genome1 intra [0/1] [0|1] [1|0] | |
1345 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."other.png\" height=".$tailleImg."><img src=\"".$REPimages."HG1.png\" height=".$tailleImg."></td>"; | |
1346 print TABSNP "\t\t\t\t\tother,heterozygosity for genome 1"; | |
1347 $nbGenome2 ++ ; | |
1348 $caseOther ++ ; | |
1349 } | |
1350 elsif (!$GT_G1){ # POLYPLOID A/A DIPLOIDS T/T | |
1351 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."other.png\" height=".$tailleImg."></td>"; | |
1352 print TABSNP "\t\t\t\t\tother"; | |
1353 $caseOther ++ ; | |
1354 } | |
1355 | |
1356 else { # Pas de SNP Genome1 [0/0] [0|0] [1/1] [1|1] SNP entre genome1 et genome2 | |
1357 if ($GT_G1 =~ /^0.0$/){ # Other [NOTHING] | |
1358 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."other.png\" height=".$tailleImg."></td>"; | |
1359 print TABSNP "\t\t\t\t\tother"; | |
1360 $caseOther ++ ; | |
1361 } | |
1362 else { | |
1363 if ($code_G1 eq $alAltP) { # 2 | |
1364 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."2.png\" height=".$tailleImg."></td>"; | |
1365 print TABSNP "\t\t\t\t\t2"; | |
1366 $case2 ++ ; | |
1367 } | |
1368 else { # Other [SNP DIPLO] | |
1369 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."other.png\" height=".$tailleImg."></td>"; | |
1370 print TABSNP "\t\t\t\t\tother"; | |
1371 $caseOther ++ ; | |
1372 $caseDiplother ++ ; | |
1373 } | |
1374 } | |
1375 } | |
1376 } | |
1377 | |
1378 if (($GT_poly =~ /^0.0$/)||($GT_poly =~ /^$/)) { #POLYPLOID == REFERENCE - [0|0] | |
1379 #################################### | |
1380 if (($GT_G1 !~ /^0.0$/) && ($GT_G1 !~ /^1.1$/)){ # SNP Genome1 intra [0/1] [0|1] [1|0] | |
1381 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."other.png\" height=".$tailleImg."><img src=\"".$REPimages."HG1.png\" height=".$tailleImg."></td>"; | |
1382 print TABSNP "\t\t\t\t\tother,heterozygosity for genome 1"; | |
1383 $nbGenome2 ++ ; | |
1384 $caseOther++; | |
1385 } | |
1386 else { # Pas de SNP Genome1 [0/0] [0|0] [1/1] [1|1] SNP entre genome1 et genome2 | |
1387 if ($GT_G1 =~ /^1.1$/){ | |
1388 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."1.png\" height=".$tailleImg."></td>"; | |
1389 print TABSNP "\t\t\t\t\t1"; | |
1390 $case1 ++ ; | |
1391 } | |
1392 } | |
1393 } | |
1394 | |
1395 print TABSNP "\n"; | |
1396 print HTMLSNP "</tr>\n"; | |
1397 $ligneOK = 1 ; | |
1398 } | |
1399 | |
1400 if ($ligneInter == 0) { | |
1401 print HTMLCOUNT "<td class=\"ted2\" style=\"border-right:3px solid black\">".$s."</td>"; | |
1402 } | |
1403 else { | |
1404 print HTMLCOUNT "<td class=\"ted\" style=\"border-right:3px solid black\">".$s."</td>"; | |
1405 } | |
1406 print TABCOUNT $s."\t"; | |
1407 | |
1408 ####################################### | |
1409 if ($ligneInter == 0) { $ligneInter = 1 ; } | |
1410 else { $ligneInter = 0 ; } | |
1411 ####################################### | |
1412 | |
1413 # Calcul des intervalles # | |
1414 ########################## | |
1415 $taille_totale = 0 ; | |
1416 my $ref = $intervalle2{$s}; | |
1417 my %hash = %$ref; | |
1418 | |
1419 foreach my $interval(keys(%hash)){ | |
1420 my @pos = split(/-/,$interval); | |
1421 $taille_inter = $pos[1]-$pos[0]+1 ; | |
1422 $taille_totale = $taille_totale + $taille_inter; | |
1423 } | |
1424 $total1 = $case5 + $case1 + $case2 + $caseDiplother + $nbGenome2; | |
1425 $total2 = $case5 + $case3ou4 + $casePolyplother; | |
1426 | |
1427 | |
1428 | |
1429 # SYNTHESIS | |
1430 print HTMLCOUNT "<td>".$taille_totale."</td><td style=\"border-left:3px solid black\">".$taille."</td></td>"; | |
1431 print HTMLCOUNT "<td style=\"border-left:3px solid black\">"; | |
1432 print HTMLCOUNT $case1."</td><td>".$case2."</td><td>".$case3ou4."</td><td>"; | |
1433 print HTMLCOUNT $case3."</td><td>".$case4."</td><td>".$case5."</td><td>"; | |
1434 print HTMLCOUNT $caseOther."</td><td style=\"border-left:3px solid black\">".$nbGenome2."</td><td style=\"border-left:3px solid black\">".$total1."</td>"; | |
1435 print HTMLCOUNT "<td style=\"border-left:3px solid black\">".$total2."</td>"; | |
1436 print TABCOUNT $taille_totale."\t".$taille."\t"; | |
1437 print TABCOUNT $case1."\t".$case2."\t".$case3ou4."\t".$case3."\t".$case4."\t".$case5."\t".$caseOther."\t".$nbGenome2."\t".$total1."\t".$total2."\t"; | |
1438 | |
1439 $nbTotGenesAna ++ ; | |
1440 | |
1441 if ($case5 != 0) { | |
1442 $nbTotGenesVal ++ ; | |
1443 if ($ligneInter == 1) { | |
1444 print HTMLCOUNT "<td class=\"ted2\" style=\"border-left:3px solid black\">"; | |
1445 print HTMLCOUNT sprintf("%.0f", $moyenneSNPindep1/$case5).":".sprintf("%.0f", $moyenneSNPindep2/$case5)."<br>"; | |
1446 print HTMLCOUNT "<img src=\"".$REPimages."r1.png\" height=10 width=".sprintf("%.0f", $moyenneSNPindep1/$case5).">"; | |
1447 print HTMLCOUNT "<img src=\"".$REPimages."r2.png\" height=10 width=".sprintf("%.0f", $moyenneSNPindep2/$case5)."></td>"; | |
1448 } | |
1449 else { | |
1450 print HTMLCOUNT "<td class=\"ted\" style=\"border-left:3px solid black\">"; | |
1451 print HTMLCOUNT sprintf("%.0f", $moyenneSNPindep1/$case5).":".sprintf("%.0f", $moyenneSNPindep2/$case5)."<br>"; | |
1452 print HTMLCOUNT "<img src=\"".$REPimages."r1.png\" height=10 width=".sprintf("%.0f", $moyenneSNPindep1/$case5).">"; | |
1453 print HTMLCOUNT "<img src=\"".$REPimages."r2.png\" height=10 width=".sprintf("%.0f", $moyenneSNPindep2/$case5)."></td>"; | |
1454 } | |
1455 print TABCOUNT sprintf("%.0f", $moyenneSNPindep1/$case5)."\t".sprintf("%.0f", $moyenneSNPindep2/$case5)."\t"; | |
1456 } | |
1457 else { | |
1458 print HTMLCOUNT "<td style=\"border-left:3px solid black\"></td>"; | |
1459 print TABCOUNT "\t"; | |
1460 } | |
1461 print HTMLCOUNT "</tr>"; | |
1462 print TABCOUNT "\n"; | |
1463 | |
1464 $totalSize = $totalSize + $taille_totale ; | |
1465 $totalSNP = $totalSNP + $taille ; | |
1466 $total11 = $total11 + $case1 ; | |
1467 $total22 = $total22 + $case2 ; | |
1468 $total3ou4 = $total3ou4 + $case3ou4 ; | |
1469 $total3 = $total3 + $case3 ; | |
1470 $total4 = $total4 + $case4 ; | |
1471 $total5 = $total5 + $case5 ; | |
1472 $total512 = $total512 + $total1 ; | |
1473 $total534 = $total534 + $total2 ; | |
1474 $totalOther = $totalOther + $caseOther ; | |
1475 $totalGenome2 = $totalGenome2 + $nbGenome2 ; | |
1476 } | |
1477 ########## MODIF DERNIERE MINUTE ################" | |
1478 print HTMLCOUNT "<tr class=\"td3\">\n<td>"; | |
1479 | |
1480 print HTMLCOUNT $nbTotGenesAna."<td style=\"border-left:3px solid black\">"; | |
1481 print HTMLCOUNT $totalSize."</td><td style=\"border-left:3px solid black\">"; | |
1482 print HTMLCOUNT $totalSNP."</td><td style=\"border-left:3px solid black\">"; | |
1483 print HTMLCOUNT $total11."</td><td>"; | |
1484 print HTMLCOUNT $total22."</td><td>"; | |
1485 print HTMLCOUNT $total3ou4."</td><td>"; | |
1486 print HTMLCOUNT $total3."</td><td>"; | |
1487 print HTMLCOUNT $total4."</td><td>"; | |
1488 print HTMLCOUNT $total5."</td><td>"; | |
1489 print HTMLCOUNT $totalOther."</td><td style=\"border-left:3px solid black\">"; | |
1490 print HTMLCOUNT $totalGenome2."</td><td style=\"border-left:3px solid black\">"; | |
1491 print HTMLCOUNT $total512."</td><td style=\"border:3px solid black\">"; | |
1492 print HTMLCOUNT $total534."</td><td style=\"border:3px solid black\">"; | |
1493 | |
1494 print HTMLCOUNT $nbTotGenesVal."</td>"; | |
1495 | |
1496 print HTMLCOUNT "</tr>"; | |
1497 | |
1498 | |
1499 print TABCOUNT "$nbTotGenesAna\t$totalSize\t$totalSNP\t$total11\t$total22\t$total3ou4\t$total3\t$total4\t$total5\t$totalOther\t$totalGenome2\t$total512\t$total534\t"; | |
1500 print TABCOUNT "\n"; | |
1501 | |
1502 #################################################### | |
1503 print HTMLSNP "</table>\n"; | |
1504 print HTMLSNP "</html>\n"; | |
1505 close HTMLSNP ; | |
1506 | |
1507 print HTMLCOUNT "</table>\n"; | |
1508 print HTMLCOUNT "</html>\n"; | |
1509 close HTMLCOUNT ; | |
1510 | |
1511 close TABSNP; | |
1512 close TABCOUNT ; | |
1513 | |
1514 tie @array, 'Tie::File', $SNP_count or die ; | |
1515 | |
1516 $array[113] = "<tr><td class=\"ted3\">".$nbTotGenesAna."</td><td class=\"ted3\" style=\"border-left:3px solid black\">".$totalSize."</td><td class=\"ted3\" style=\"border-left:3px solid black\">".$totalSNP."</td></td>"; | |
1517 $array[114] = "<td class=\"ted3\" style=\"border-left:3px solid black\">"; | |
1518 $array[115] = $total11."</td><td class=\"ted3\">".$total22."</td><td class=\"ted3\">".$total3ou4."</td><td class=\"ted3\">"; | |
1519 $array[116] = $total3."</td><td class=\"ted3\">".$total4."</td><td class=\"ted3\">".$total5."</td><td class=\"ted3\">"; | |
1520 $array[117] = $totalOther."</td><td class=\"ted3\" style=\"border-left:3px solid black\">".$totalGenome2."</td><td class=\"ted3\" style=\"border-left:3px solid black\">".$total512."</td>"; | |
1521 $array[118] = "<td class=\"ted3\" style=\"border-left:3px solid black\">".$total534."</td><td class=\"ted3\">".$nbTotGenesVal."</td></tr>"; | |
1522 } | |
1523 sub ext_output { # Extern reference | |
1524 | |
1525 print TABCOUNT "Gene;Interval Size Analysed (pb);nb SNP;1;2;3 or 4;5;other;SNP Diploids;SNP Polyploid;Ratio (%) $genome2Name:$genome1Name\n"; | |
1526 | |
1527 foreach my $s(sort(keys(%snp))){ | |
1528 | |
1529 ####################################### | |
1530 if ($ligneInter == 0) { | |
1531 print HTMLSNP "<tr class=\"bord1\">\n"; | |
1532 print HTMLCOUNT "<tr class=\"td1\ border-width =\"3px\">\n"; | |
1533 } | |
1534 else { | |
1535 print HTMLSNP "<tr class=\"bord2\">\n"; | |
1536 print HTMLCOUNT "<tr class=\"td2\">\n"; | |
1537 } | |
1538 ####################################### | |
1539 | |
1540 | |
1541 my $ref = $snp{$s}; | |
1542 my %hash = %$ref; | |
1543 $taille = keys(%hash); | |
1544 # taille de la ligne gene | |
1545 print HTMLSNP "<td rowspan=\"$taille\"><b>$s</b></td>"; | |
1546 | |
1547 $ligneOK = 0 ; | |
1548 | |
1549 $nbPolyploid = 0; | |
1550 $nbGenomes = 0 ; | |
1551 $nbCommuns = 0; | |
1552 $nbPoly_only = 0 ; | |
1553 $nbSub_only = 0 ; | |
1554 | |
1555 $case5 = 0 ; | |
1556 $case1 = 0 ; | |
1557 $case2 = 0 ; | |
1558 $case3ou4 = 0; | |
1559 $caseOther = 0; | |
1560 $caseGenome2 = 0 ; | |
1561 | |
1562 #Moyenne Ponderee | |
1563 $moyenneSNPindep1 = 0 ; | |
1564 $moyenneSNPindep2 = 0 ; | |
1565 | |
1566 @tabTrie = sort ({ $a <=> $b }keys %hash); | |
1567 | |
1568 #foreach my $c(sort ({$hash{$a} <=> $hash{$b}} keys %hash)) { | |
1569 foreach my $c(@tabTrie) { | |
1570 $nb1 = 0 ; | |
1571 $nb2 = 0 ; | |
1572 $nb3 = 0 ; | |
1573 if ($ligneOK == 1) { | |
1574 if ($ligneInter == 0) { | |
1575 print HTMLSNP "<tr class=\"td1\">\n"; | |
1576 } | |
1577 else { | |
1578 print HTMLSNP "<tr class=\"td2\">\n"; | |
1579 } | |
1580 } | |
1581 ### Recuperation des informations ### | |
1582 ($code_snp,$ratio,$GT_poly,$GT_G1,$GT_G2,$DP_P) = split(/\t/,$snp{$s}{$c}); | |
1583 @recupAlleles = split(/\[/,$code_snp); | |
1584 @recupAlleles = split(/\]/,$recupAlleles[1]); | |
1585 ($alRef,$alAlt) = split(/\//,$recupAlleles[0]); | |
1586 $noSNPpoly = "ok" ; | |
1587 | |
1588 #print STDOUT "\n $c $GT_poly $GT_G1 $GT_G2"; | |
1589 print HTMLSNP "<td>$c</td>"; | |
1590 print TABSNP "$c;"; | |
1591 ##################################################################### | |
1592 # SNP POLYPLOID - [0/1] [0|1] [1|0] | |
1593 ##################################################################### | |
1594 if (($GT_poly =~ /^0.1$/) || ($GT_poly =~ /^1.0$/) ) { # Polyploid [0.1] [1.0] | |
1595 $ratio = sprintf("%.0f", $ratio); | |
1596 $ratio2 = 100-$ratio ; | |
1597 $moyenneSNPindep1 = $moyenneSNPindep1 + $ratio ; | |
1598 $moyenneSNPindep2 = $moyenneSNPindep2 + $ratio2 ; | |
1599 print HTMLSNP "<td>$code_snp</td>"; | |
1600 print TABSNP "$code_snp;"; | |
1601 if (($GT_G1 =~ /^1.1$/)){ # Genome1 [1/1] [1|1] | |
1602 print HTMLSNP "<td>$alAlt</td>"; | |
1603 print TABSNP "$alAlt;"; | |
1604 if($GT_G2 =~ /^1.1$/){ # Genome2 = Alt [1.1] | |
1605 print HTMLSNP "<td>$alAlt</td>"; | |
1606 print HTMLSNP "<td></td>"; | |
1607 print HTMLSNP "<td></td>"; | |
1608 print HTMLSNP "<td></td>"; | |
1609 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."3ou4.png\" height=30></td>"; | |
1610 print TABSNP "$alAlt;"; | |
1611 print TABSNP ";"; | |
1612 print TABSNP ";"; | |
1613 print TABSNP ";"; | |
1614 print TABSNP "3 or 4;"; | |
1615 } | |
1616 else { | |
1617 if($GT_G2 =~ /^0.0$/){ # Genome2 = Ref [0.0] | |
1618 print HTMLSNP "<td>$alRef</td>"; | |
1619 print HTMLSNP "<td>OK</td>"; | |
1620 print HTMLSNP "<td>[$ratio/$ratio2]</td>"; | |
1621 print HTMLSNP "<td></td>"; | |
1622 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5v.png\" height=30></td>"; | |
1623 print TABSNP "$alRef"; | |
1624 print TABSNP "OK"; | |
1625 print TABSNP "[$ratio/$ratio2;]"; | |
1626 print TABSNP "$DP_P;"; | |
1627 print TABSNP "<td class=\"final\"><img src=\"".$REPimages."5v.png\" height=30></td>"; | |
1628 } | |
1629 else { # Genome2 = SNP [0.1] | |
1630 print HTMLSNP "<td>$code_snp</td>"; | |
1631 print HTMLSNP "<td>OK</td>"; | |
1632 print HTMLSNP "<td>[$ratio/$ratio2]</td>"; | |
1633 print HTMLSNP "<td></td>"; | |
1634 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5prime.png\" height=30></td>"; | |
1635 print TABSNP "$code_snp;"; | |
1636 print TABSNP "OK;"; | |
1637 print TABSNP "[$ratio/$ratio2];"; | |
1638 print TABSNP "$DP_P;"; | |
1639 print TABSNP "5';"; | |
1640 } | |
1641 } | |
1642 } | |
1643 else{ | |
1644 if ($GT_G1 =~ /^0.0$/){ # # Genome1 [0/0] [0|0] | |
1645 print HTMLSNP "<td>$alRef</td>"; | |
1646 print TABSNP "$alRef;"; | |
1647 if($GT_G2 =~ /^1.1$/){ # Genome2 = Alt [1.1] | |
1648 print HTMLSNP "<td>$alAlt</td>"; | |
1649 print HTMLSNP "<td>OK</td>"; | |
1650 print HTMLSNP "<td>[$ratio/$ratio2]</td>"; | |
1651 print HTMLSNP "<td></td>"; | |
1652 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5v.png\" height=30></td>"; | |
1653 print TABSNP "$alAlt;"; | |
1654 print TABSNP "OK;"; | |
1655 print TABSNP "[$ratio/$ratio2];"; | |
1656 print TABSNP ";"; | |
1657 print TABSNP "5;"; | |
1658 } | |
1659 else { | |
1660 if($GT_G2 =~ /^0.0$/){ # Genome2 = Ref [0.0] | |
1661 print HTMLSNP "<td>$alRef</td>"; | |
1662 print HTMLSNP "<td></td>"; | |
1663 print HTMLSNP "<td></td>"; | |
1664 print HTMLSNP "<td></td>"; | |
1665 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."3ou4.png\" height=30></td>"; | |
1666 print TABSNP "$alRef;"; | |
1667 print TABSNP ";"; | |
1668 print TABSNP ";"; | |
1669 print TABSNP ";"; | |
1670 print TABSNP "3 or 4;"; | |
1671 } | |
1672 else { # Genome2 = SNP [0.1] | |
1673 print HTMLSNP "<td>$code_snp</td>"; | |
1674 print HTMLSNP "<td>OK</td>"; | |
1675 print HTMLSNP "<td>[$ratio/$ratio2]</td>"; | |
1676 print HTMLSNP "<td></td>"; | |
1677 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5prime.png\" height=30></td>"; | |
1678 print TABSNP "$code_snp;"; | |
1679 print TABSNP "OK;"; | |
1680 print TABSNP "[$ratio/$ratio2];"; | |
1681 print TABSNP ";"; | |
1682 print TABSNP "5';"; | |
1683 } | |
1684 } | |
1685 } | |
1686 else { # SNP Genome1 [0/1] [0|1] [1|0] | |
1687 print HTMLSNP "<td>$code_snp</td>"; #REF | |
1688 print HTMLSNP "$code_snp;"; #REF | |
1689 if($GT_G2 =~ /^1.1$/){ # Genome2 = Alt [1.1] | |
1690 print HTMLSNP "<td>$alAlt</td>"; | |
1691 print HTMLSNP "<td>OK</td>"; | |
1692 print HTMLSNP "<td>[$ratio/$ratio2]</td>"; | |
1693 print HTMLSNP "<td></td>"; | |
1694 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5prime.png\" height=30></td>"; | |
1695 print TABSNP "$alAlt;"; | |
1696 print TABSNP "OK;"; | |
1697 print TABSNP "[$ratio/$ratio2];"; | |
1698 print TABSNP ";"; | |
1699 print TABSNP "5'"; | |
1700 } | |
1701 else { | |
1702 if($GT_G2 =~ /^0.0$/){ # Genome2 = Ref [0.0] | |
1703 print HTMLSNP "<td>$alRef</td>"; | |
1704 print HTMLSNP "<td>OK</td>"; | |
1705 print HTMLSNP "<td>[$ratio/$ratio2]</td>"; | |
1706 print HTMLSNP "<td></td>"; | |
1707 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5prime.png\" height=30></td>"; | |
1708 print TABSNP "$alRef;"; | |
1709 print TABSNP "OK;"; | |
1710 print TABSNP "[$ratio/$ratio2];"; | |
1711 print TABSNP ";"; | |
1712 print TABSNP "5';"; | |
1713 } | |
1714 else { # Genome2 = SNP [0.1] | |
1715 print HTMLSNP "<td>$code_snp</td>"; | |
1716 print HTMLSNP "<td></td>"; | |
1717 print HTMLSNP "<td></td>"; | |
1718 print HTMLSNP "<td></td>"; | |
1719 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5second.png\" height=30></td>"; | |
1720 print TABSNP "$code_snp;"; | |
1721 print TABSNP ";"; | |
1722 print TABSNP ";"; | |
1723 print TABSNP ";"; | |
1724 print TABSNP "5''"; | |
1725 } | |
1726 } | |
1727 } | |
1728 print TABSNP "\n"; | |
1729 $ligneOK = 1 ; | |
1730 print HTMLSNP "</tr>\n"; | |
1731 } | |
1732 } | |
1733 ##################################################################### | |
1734 # POLYPLOID NE REFERENCE - [1/1] | |
1735 ##################################################################### | |
1736 #print STDOUT "GTPOLY:$GT_poly@"; | |
1737 if (($GT_poly =~ /^1.1$/) ) { | |
1738 print HTMLSNP "<td>$alAlt</td>"; | |
1739 print TABSNP "$alAlt;"; | |
1740 #################################### | |
1741 if (($GT_G1 !~ /^0.0$/) && ($GT_G1 !~ /^1.1$/)){ # Genome 1 [0/1] [0|1] [1|0] | |
1742 print HTMLSNP "<td>$code_snp</td>"; | |
1743 print TABSNP "$code_snp"; | |
1744 if ($GT_G2 =~ /^1.1$/) { | |
1745 print HTMLSNP "<td>$alAlt</td>"; | |
1746 print HTMLSNP "<td></td>"; | |
1747 print HTMLSNP "<td></td>"; | |
1748 print HTMLSNP "<td></td>"; | |
1749 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5primeou1.png\" height=30></td>"; | |
1750 print TABSNP "$alAlt;;;;5' or 1;"; | |
1751 } | |
1752 else { | |
1753 if ($GT_G2 =~ /^0.0$/) { | |
1754 print HTMLSNP "<td>$alRef</td>"; | |
1755 print HTMLSNP "<td></td>"; | |
1756 print HTMLSNP "<td></td>"; | |
1757 print HTMLSNP "<td></td>"; | |
1758 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5primeou1.png\" height=30></td>"; | |
1759 print TABSNP "$altRef;;;;5' or 1;"; | |
1760 } | |
1761 else { # Genome2 = SNP [0.1] | |
1762 print HTMLSNP "<td>$code_snp</td>"; | |
1763 print HTMLSNP "<td></td>"; | |
1764 print HTMLSNP "<td></td>"; | |
1765 print HTMLSNP "<td></td>"; | |
1766 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5second.png\" height=30></td>"; | |
1767 print TABSNP "$code_snp;;;;5'';"; | |
1768 } | |
1769 } | |
1770 } | |
1771 else { | |
1772 if ($GT_G1 =~ /^0.0$/){ # Genome1 [0/0] [0|0] | |
1773 ################### | |
1774 print HTMLSNP "<td>$alRef</td>"; | |
1775 print TABSNP "$alRef"; | |
1776 if ($GT_G2 =~ /^1.1$/) { # Genome2 = Alt [1.1] | |
1777 print HTMLSNP "<td>$alAlt</td>"; | |
1778 print HTMLSNP "<td></td>"; | |
1779 print HTMLSNP "<td></td>"; | |
1780 print HTMLSNP "<td></td>"; | |
1781 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."1.png\" height=30></td>"; | |
1782 print TABSNP "$alAlt;;;;1;"; | |
1783 } | |
1784 else { | |
1785 if ($GT_G2 =~ /^0.0$/) { | |
1786 print HTMLSNP "<td>$alAlt</td>"; | |
1787 print HTMLSNP "<td></td>"; | |
1788 print HTMLSNP "<td></td>"; | |
1789 print HTMLSNP "<td></td>"; | |
1790 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."3ou4.png\" height=30></td>"; | |
1791 print TABSNP "$alAlt;;;;3 or 4;"; | |
1792 } | |
1793 else { # Genome2 = SNP [0.1] | |
1794 print HTMLSNP "<td>$code_snp</td>"; | |
1795 print HTMLSNP "<td></td>"; | |
1796 print HTMLSNP "<td></td>"; | |
1797 print HTMLSNP "<td></td>"; | |
1798 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5primeou2.png\" height=30></td>"; | |
1799 print TABSNP "$code_snp;;;;5' or 2"; | |
1800 } | |
1801 } | |
1802 } | |
1803 else { # [1/1] [1|1] Genome 1 | |
1804 print HTMLSNP "<td>$alAlt</td>"; | |
1805 print TABSNP "$alAlt"; | |
1806 if ($GT_G2 =~ /^1.1$/) { # Genome2 = Alt [1.1] | |
1807 print HTMLSNP "<td>$alAlt</td>"; | |
1808 print HTMLSNP "<td>OK</td>"; | |
1809 print HTMLSNP "<td>[$ratio/$ratio2]</td>"; | |
1810 print HTMLSNP "<td>$DP_P</td>"; | |
1811 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5v.png\" height=30></td>"; | |
1812 print TABSNP "$alAlt;OK;[$ratio/$ratio2];$DP_P;5;"; | |
1813 } | |
1814 else { | |
1815 if ($GT_G2 =~ /^0.0$/) { | |
1816 print HTMLSNP "<td>$alRef</td>"; | |
1817 print HTMLSNP "<td></td>"; | |
1818 print HTMLSNP "<td></td>"; | |
1819 print HTMLSNP "<td></td>"; | |
1820 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."2.png\" height=30></td>"; | |
1821 print TABSNP "$alRef;;;;2;"; | |
1822 } | |
1823 else { # Genome2 = SNP [0.1] | |
1824 print HTMLSNP "<td>$code_snp</td>"; | |
1825 print HTMLSNP "<td></td>"; | |
1826 print HTMLSNP "<td></td>"; | |
1827 print HTMLSNP "<td></td>"; | |
1828 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5primeou2.png\" height=30></td>"; | |
1829 print TABSNP "$code_snp;;;;5' or 2" ; | |
1830 } | |
1831 } | |
1832 } | |
1833 } | |
1834 $nbPolyploid ++ ; | |
1835 print TABSNP "\n"; | |
1836 $ligneOK = 1 ; | |
1837 print HTMLSNP "</tr>\n"; | |
1838 | |
1839 } | |
1840 ##################################################################### | |
1841 # POLYPLOID == REFERENCE - [0|0] | |
1842 ##################################################################### | |
1843 if (($GT_poly =~ /^0.0$/) ) { | |
1844 print HTMLSNP "<td>$alRef</td>"; | |
1845 print TABSNP "$alRef;"; | |
1846 if (($GT_G1 !~ /^0.1$/) && ($GT_G1 !~ /^1.0$/)){ # Genome1 intra [0/1] [0|1] [1|0] | |
1847 print HTMLSNP "<td>$code_snp</td>"; | |
1848 print TABSNP "$code_snp"; | |
1849 if ($GT_G2 =~ /^1.1$/) { # Genome2 = Alt [1.1] | |
1850 print HTMLSNP "<td>$alAlt</td>"; | |
1851 print HTMLSNP "<td></td>"; | |
1852 print HTMLSNP "<td></td>"; | |
1853 print HTMLSNP "<td></td>"; | |
1854 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5primeou1.png\" height=30></td>"; | |
1855 print TABSNP "$alAlt;;;;5' or 1"; | |
1856 } | |
1857 else { | |
1858 if ($GT_G2 =~ /^0.0$/) { # Genome2 = Ref [0.0] | |
1859 print HTMLSNP "<td>$alRef</td>"; | |
1860 print HTMLSNP "<td></td>"; | |
1861 print HTMLSNP "<td></td>"; | |
1862 print HTMLSNP "<td></td>"; | |
1863 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5primeou1.png\" height=30></td>"; | |
1864 print TABSNP "$alRef;;;;5' or 1"; | |
1865 } | |
1866 else { # Genome2 = SNP [0.1] | |
1867 if ( ($GT_G2 =~ /^0.1$/) || ($GT_G2 =~ /^1.0$/)){ # Genome2 = SNP [0.1] | |
1868 print HTMLSNP "<td>$code_snp</td>"; | |
1869 print HTMLSNP "<td></td>"; | |
1870 print HTMLSNP "<td></td>"; | |
1871 print HTMLSNP "<td></td>"; | |
1872 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5second.png\" height=30></td>"; | |
1873 print TABSNP "$code_snp;;;;5''"; | |
1874 } | |
1875 } | |
1876 } | |
1877 } | |
1878 | |
1879 else { | |
1880 if ($GT_G1 =~ /^0.0$/){ # Pas de SNP Genome1 [0/0] [0|0] | |
1881 print HTMLSNP "<td>$alRef</td>"; | |
1882 print TABSNP "$alRef"; | |
1883 if ($GT_G2 =~ /^1.1$/) { # Genome2 = Alt [1.1] | |
1884 print HTMLSNP "<td>$alAlt</td>"; | |
1885 print HTMLSNP "<td></td>"; | |
1886 print HTMLSNP "<td></td>"; | |
1887 print HTMLSNP "<td></td>"; | |
1888 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."2.png\" height=30></td>"; | |
1889 print TABSNP "$alAlt;;;;2;"; | |
1890 } | |
1891 else { | |
1892 if ( ($GT_G2 =~ /^0.1$/) || ($GT_G2 =~ /^1.0$/)){ | |
1893 print HTMLSNP "<td>$code_snp</td>"; | |
1894 print HTMLSNP "<td>OK</td>"; | |
1895 print HTMLSNP "<td>[$ratio/$ratio2]</td>"; | |
1896 print HTMLSNP "<td>$DP_P</td>"; | |
1897 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5primeou2.png\" height=30></td>"; | |
1898 print TABSNP "$code_snp;OK;[$ratio/$ratio2];$DP_P;5' or 2"; | |
1899 } | |
1900 } | |
1901 } | |
1902 | |
1903 else { # [1/1] [1|1] SNP entre genome1 et genome2 | |
1904 print HTMLSNP "<td>$alAlt</td>"; | |
1905 print TABSNP "$alAlt"; | |
1906 if ($GT_G2 =~ /^1.1$/) { # Genome2 = Alt [1.1] | |
1907 print HTMLSNP "<td>$alAlt</td>"; | |
1908 print HTMLSNP "<td></td>"; | |
1909 print HTMLSNP "<td></td>"; | |
1910 print HTMLSNP "<td></td>"; | |
1911 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."other.png\" height=30></td>"; | |
1912 print TABSNP "$alAlt;;;;other;"; | |
1913 } | |
1914 else { | |
1915 if ($GT_G2 =~ /^0.0$/) { | |
1916 print HTMLSNP "<td>$alRef</td>"; | |
1917 print HTMLSNP "<td></td>"; | |
1918 print HTMLSNP "<td></td>"; | |
1919 print HTMLSNP "<td></td>"; | |
1920 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."1.png\" height=30></td>"; | |
1921 print TABSNP "$alRef;;;;1;"; | |
1922 } | |
1923 else { # Genome2 = SNP [0.1] | |
1924 print HTMLSNP "<td>$code_snp</td>"; | |
1925 print HTMLSNP "<td></td>"; | |
1926 print HTMLSNP "<td></td>"; | |
1927 print HTMLSNP "<td></td>"; | |
1928 print HTMLSNP "<td class=\"final\"><img src=\"".$REPimages."5primeou2.png\" height=30></td>"; | |
1929 print TABSNP "$code_snp;;;;5' or 2;"; | |
1930 } | |
1931 } | |
1932 } | |
1933 | |
1934 } | |
1935 } | |
1936 $nbSub_only ++; | |
1937 print TABSNP "\n"; | |
1938 $ligneOK = 1 ; | |
1939 print HTMLSNP "</tr>\n"; | |
1940 } | |
1941 | |
1942 if ($ligneInter == 0) { | |
1943 print HTMLCOUNT "<td class=\"ted2\" style=\"border-right:3px solid black\">$s</td>"; | |
1944 } | |
1945 else { | |
1946 print HTMLCOUNT "<td class=\"ted\" style=\"border-right:3px solid black\">$s</td>"; | |
1947 } | |
1948 | |
1949 print TABCOUNT "Gene;Interval Size;Analysed (pb);nb SNP;1;2;3 or 4;5;5';5'';5' or 1;5'' or 2;other;SNP Diploids;SNP Polyploid;Ratio (%) $genome2Name:$genome1Name;"; | |
1950 | |
1951 ####################################### | |
1952 if ($ligneInter == 0) { | |
1953 $ligneInter = 1 ; | |
1954 } | |
1955 else { | |
1956 $ligneInter = 0 ; | |
1957 } | |
1958 ####################################### | |
1959 | |
1960 # Calcul des intervalles | |
1961 $taille_totale = 0 ; | |
1962 my $ref = $intervalle2{$s}; | |
1963 my %hash = %$ref; | |
1964 | |
1965 foreach my $interval(keys(%hash)){ | |
1966 my @pos = split(/-/,$interval); | |
1967 $taille_inter = $pos[1]-$pos[0]-1 ; | |
1968 $taille_totale = $taille_totale + $taille_inter; | |
1969 } | |
1970 | |
1971 $total1 = $case5 + $case1 + $case2 ; | |
1972 $total2 = $case5 + $case3ou4 ; | |
1973 | |
1974 print HTMLCOUNT "<td>$taille_totale</td><td style=\"border-left:3px solid black\">$taille</td></td>"; | |
1975 print HTMLCOUNT "<td style=\"border-left:3px solid black\">$case1</td><td>$case2</td><td>$case3ou4</td><td>$case5</td><td>$caseGenome2</td><td>$caseOther</td><td style=\"border-left:3px solid black\">$total1</td><td style=\"border-left:3px solid black\">$total2</td>"; | |
1976 if ($case5 != 0) { | |
1977 print HTMLCOUNT "<td style=\"border-left:3px solid black\">".sprintf("%.0f", $moyenneSNPindep1/$case5).":".sprintf("%.0f", $moyenneSNPindep2/$case5)."</td>"; | |
1978 } | |
1979 else { | |
1980 print HTMLCOUNT "<td style=\"border-left:3px solid black\"></td>"; | |
1981 } | |
1982 print HTMLCOUNT "</tr>"; | |
1983 | |
1984 $totalSize = $totalSize + $taille_totale ; | |
1985 $totalSNP = $totalSNP + $taille ; | |
1986 $total11 = $total11 + $case1 ; | |
1987 $total22 = $total22 + $case2 ; | |
1988 $total3ou4 = $total3ou4 + $case3ou4 ; | |
1989 $total5 = $total5 + $case5 ; | |
1990 $total512 = $total512 + $total1 ; | |
1991 $total534 = $total534 + $total2 ; | |
1992 $totalOther = $totalOther + $caseOther ; | |
1993 $totalGenome2 = $totalGenome2 + $caseGenome2 ; | |
1994 } | |
1995 ########## MODIF DERNIERE MINUTE ################" | |
1996 print HTMLCOUNT "<tr class=\"td3\">\n"; | |
1997 print HTMLCOUNT "<td></td><td style=\"border-left:3px solid black\">$totalSize</td><td style=\"border-left:3px solid black\">$totalSNP</td><td style=\"border-left:3px solid black\">$total11</td><td>$total22</td><td>$total3ou4</td><td>$total5</td><td>$totalGenome2</td><td>$totalOther</td><td style=\"border-left:3px solid black\">$total512</td><td style=\"border-left:3px solid black\">$total534</td><td style=\"border-left:3px solid black\"></td>"; | |
1998 print HTMLCOUNT "</tr>"; | |
1999 #################################################### | |
2000 print HTMLSNP "</table>\n"; | |
2001 print HTMLSNP "</html>\n"; | |
2002 print HTMLCOUNT "</table>\n"; | |
2003 print HTMLCOUNT "</html>\n"; | |
2004 | |
2005 close TABSNP; | |
2006 close HTMLSNP ; | |
2007 close HTMLCOUNT ; | |
2008 } | |
2009 | |
2010 sub poly_poly_output { | |
2011 foreach my $s(sort(keys(%snp_final))){ | |
2012 ####################################### | |
2013 if ($ligneInter == 0) { | |
2014 print HTMLSNP "<tr class=\"bord1\">\n"; | |
2015 print HTMLCOUNT "<tr class=\"td1\ border-width =\"3px\">\n"; | |
2016 } | |
2017 else { | |
2018 print HTMLSNP "<tr class=\"bord2\">\n"; | |
2019 print HTMLCOUNT "<tr class=\"td2\">\n"; | |
2020 } | |
2021 ####################################### | |
2022 | |
2023 my $ref = $snp_final{$s}; | |
2024 my %hash = %$ref; | |
2025 $taille = keys(%hash); | |
2026 | |
2027 # taille de la ligne gene | |
2028 print HTMLSNP "<td rowspan=\"".$taille."\"><b>".$s."</b></td>"; | |
2029 | |
2030 $ligneOK = 0 ; | |
2031 | |
2032 $nbPolyploid1 = 0 ; # SNP heterozygosity for P1 | |
2033 $nbPolyploid2 = 0 ; # SNP heterozygosity for P2 | |
2034 $nbCommuns = 0 ; # SNP heterozygosity [P1] = [P2] | |
2035 $nbCommunHomo = 0 ; # SNP homozygosity [P1] = [P2] | |
2036 $nbDifferent = 0 ; # [P1] ne [P2] | |
2037 $alleleCommun = 0 ; # Example : P1 = [A/G] ; P2 = [A] | |
2038 $alleleDifferent = 0 ; # Example : P1 = [A/G] ; P2 = [C] or [T] | |
2039 $alleleCommunH = 0 ; # Example : P1 = [A/G] ; P2 = [A/C] | |
2040 $nbHomoDiff = 0 ; | |
2041 | |
2042 @tabTrie = sort ({ $a <=> $b }keys %hash); | |
2043 | |
2044 $taille = 0; | |
2045 | |
2046 | |
2047 | |
2048 #foreach my $c(sort ({$hash{$a} <=> $hash{$b}} keys %hash)) { | |
2049 foreach my $c(@tabTrie) { | |
2050 | |
2051 if ($ligneOK == 1) { | |
2052 if ($ligneInter == 0) { | |
2053 print HTMLSNP "<tr class=\"td1\">\n"; | |
2054 } | |
2055 else { | |
2056 print HTMLSNP "<tr class=\"td2\">\n"; | |
2057 } | |
2058 } | |
2059 | |
2060 #print STDOUT "\n\n\n".$snp_final{$s}{$c} ; | |
2061 ($code_snp,$AD,$GT_poly,$DP_P,$code_snp2,$AD_2,$GT_poly2,$DP_P2) = split(/\t/,$snp_final{$s}{$c}); | |
2062 ($DP_P, $FDP) = split(/-/, $DP_P); | |
2063 ($DP_P2, $FDP2) = split(/-/, $DP_P2); | |
2064 | |
2065 #print STDOUT "\nALLELES :".$AD." - ".$AD_2; | |
2066 | |
2067 ($sub1_1,$sub1_2) = split(",",$AD); | |
2068 ($sub2_1,$sub2_2) = split(",",$AD_2); | |
2069 | |
2070 # $sub1_1 = sprintf("%.0f", $sub1_1); | |
2071 # $sub1_2 = sprintf("%.0f", $sub1_2); | |
2072 # $sub2_1 = sprintf("%.0f", $sub2_1); | |
2073 # $sub2_2 = sprintf("%.0f", $sub2_2); | |
2074 if ($DP_P > 0) { | |
2075 $SG1 = ($sub1_1/$DP_P*100) ; | |
2076 $SG2 = ($sub1_2/$DP_P*100) ; | |
2077 } | |
2078 if ($DP_P2 > 0) { | |
2079 $SG3 = ($sub2_1/$DP_P2*100) ; | |
2080 $SG4 = ($sub2_2/$DP_P2*100) ; | |
2081 } | |
2082 | |
2083 | |
2084 if ($GT_poly ne "") { # Polyploide 1 = [0.0] ou [0.1] ou [1.1] | |
2085 @recupAlleles = split(/\[/,$code_snp); | |
2086 @recupAlleles = split(/\]/,$recupAlleles[1]); | |
2087 ($alRef,$alAltP) = split(/\//,$recupAlleles[0]); | |
2088 # Attribution des alleles au polyploide 1 si pas de SNP | |
2089 if ($GT_poly =~ /^0.0$/) { $code_snp = $alRef ; } | |
2090 if ($GT_poly =~ /^1.1$/) { $code_snp = $alAltP ; } | |
2091 # Attribution des alleles au polyploide 2 si pas de SNP | |
2092 if (($GT_poly2 eq "") || ($GT_poly2 =~ /^0.0$/)) { $code_snp2 = $alRef ; } | |
2093 if ($GT_poly2 =~ /^1.1$/) { | |
2094 @recupAlleles = split(/\[/,$code_snp2); | |
2095 @recupAlleles = split(/\]/,$recupAlleles[1]); | |
2096 ($alRef,$alAlt2) = split(/\//,$recupAlleles[0]); | |
2097 $code_snp2 = $alAlt2 ; | |
2098 } | |
2099 } | |
2100 elsif ($GT_poly2 ne "") { # pas de SNP polyploide 1 dans le fichier 1 (fichiers non mergés) -> equivalent de [0.0] | |
2101 @recupAlleles = split(/\[/,$code_snp2); | |
2102 @recupAlleles = split(/\]/,$recupAlleles[1]); | |
2103 ($alRef,$alAlt2) = split(/\//,$recupAlleles[0]); | |
2104 # Attribution des Alleles au polyploide 2 | |
2105 if ($GT_poly2 =~ /^1.1$/) { $code_snp2 = $alAlt2 ; } | |
2106 if ($GT_poly2 =~ /^0.0$/) { $code_snp2 = $alRef ; } | |
2107 } | |
2108 #print STDOUT "\n($code_snp:$GT_poly) - ($code_snp2:$GT_poly2)" ; | |
2109 $noSNPpoly = "ok" ; | |
2110 #____________________________________________________________________________________________________________________________________________ | |
2111 # [1] P1 = 0/1 ; P2 = 0/1 (2 alleles) | |
2112 #print STDOUT "\n".($code_snp2 eq $code_snp); | |
2113 if ((($GT_poly =~ /^0.1$/)||($GT_poly =~ /^1.0$/)) && (($GT_poly2 =~ /^0.1$/)||($GT_poly2 =~ /^1.0$/))) { | |
2114 | |
2115 if (($SG1 > $value_filter_p1) && ($SG2 > $value_filter_p1) && ($SG3 > $value_filter_p2) && ($SG4 > $value_filter_p2) && $code_snp2 eq $code_snp) { | |
2116 | |
2117 | |
2118 if ($ligneInter == 0) { | |
2119 | |
2120 print HTMLSNP "<td class=\"tedG2\">".$c."</td>"; | |
2121 print HTMLSNP "<td class=\"tedG2\">".$alRef."</td>"; | |
2122 print HTMLSNP "<td class=\"ted2\">".$code_snp."</td>"; | |
2123 print HTMLSNP "<td class=\"ted2\">".$code_snp2."</td>"; | |
2124 | |
2125 print TABSNP $s . "\t"; | |
2126 print TABSNP $c . "\t"; | |
2127 print TABSNP $alRef . "\t"; | |
2128 print TABSNP $code_snp . "\t"; | |
2129 print TABSNP $code_snp2 . "\t"; | |
2130 print TABSNP $FDP."/".$DP_P; | |
2131 | |
2132 print HTMLSNP "<td class=\"ted2\">".$FDP."/".$DP_P; | |
2133 if (($DP_P) != 0) { | |
2134 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP/$DP_P*100).">"; | |
2135 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP/$DP_P*100).">"; | |
2136 print HTMLSNP "<br>".$sub1_1." - ".$sub1_2."</td>"; | |
2137 print TABSNP "," . $sub1_1." - ".$sub1_2."\t"; | |
2138 } | |
2139 else { | |
2140 print HTMLSNP "</td>"; | |
2141 print TABSNP "\t"; | |
2142 } | |
2143 | |
2144 print TABSNP $FDP2."/".$DP_P2; | |
2145 print HTMLSNP "<td class=\"ted2\">".$FDP2."/".$DP_P2; | |
2146 if (($DP_P2) != 0) { | |
2147 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP2/$DP_P2*100).">"; | |
2148 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP2/$DP_P2*100).">"; | |
2149 print HTMLSNP "<br>".$sub2_1." - ".$sub2_2."</td>"; | |
2150 print TABSNP "," . $sub2_1." - ".$sub2_2."\t"; | |
2151 } | |
2152 else { | |
2153 print HTMLSNP "</td>"; | |
2154 print TABSNP "\t"; | |
2155 } | |
2156 print TABSNP "\n"; | |
2157 print HTMLSNP "</tr>\n"; | |
2158 } | |
2159 else { | |
2160 # | |
2161 print HTMLSNP "<td class=\"tedG\">".$c."</td>"; | |
2162 print HTMLSNP "<td class=\"tedG\">".$alRef."</td>"; | |
2163 print HTMLSNP "<td class=\"ted\">".$code_snp."</td>"; | |
2164 print HTMLSNP "<td class=\"ted\">".$code_snp2."</td>"; | |
2165 print HTMLSNP "<td class=\"ted\">".$FDP." / ".$DP_P; | |
2166 print TABSNP $s . "\t"; | |
2167 print TABSNP $c . "\t"; | |
2168 print TABSNP $alRef . "\t"; | |
2169 print TABSNP $code_snp . "\t"; | |
2170 print TABSNP $code_snp2 . "\t"; | |
2171 print TABSNP $FDP."/".$DP_P; | |
2172 if (($DP_P) != 0) { | |
2173 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP/$DP_P*100).">"; | |
2174 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP/$DP_P*100).">"; | |
2175 print HTMLSNP "<br>".$sub1_1." - ".$sub1_2."</td>"; | |
2176 print TABSNP "," . $sub1_1." - ".$sub1_2."\t"; | |
2177 } | |
2178 else { | |
2179 print HTMLSNP "</td>"; | |
2180 print TABSNP "\t"; | |
2181 } | |
2182 print TABSNP $FDP2."/".$DP_P2; | |
2183 print HTMLSNP "<td class=\"ted\">".$FDP2." / ".$DP_P2; | |
2184 if (($DP_P2) != 0) { | |
2185 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP2/$DP_P2*100).">"; | |
2186 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP2/$DP_P2*100).">"; | |
2187 print HTMLSNP "<br>".$sub2_1." - ".$sub2_2."</td>"; | |
2188 print TABSNP "," . $sub2_1." - ".$sub2_2."\t"; | |
2189 } | |
2190 else { | |
2191 print HTMLSNP "</td>"; | |
2192 print TABSNP "\t"; | |
2193 } | |
2194 print TABSNP "\n"; | |
2195 print HTMLSNP "</tr>\n"; | |
2196 } | |
2197 $nbPolyploid1 ++ ; # SNP heterozygosity for P1 | |
2198 $nbPolyploid2 ++ ; # SNP heterozygosity for P2 | |
2199 $nbCommuns ++ ; # SNP heterozygosity [P1] = [P2] | |
2200 $taille++; | |
2201 | |
2202 } | |
2203 else { | |
2204 if (($SG1 > $value_filter_p1) && ($SG2 > $value_filter_p1) && ($SG3 > $value_filter_p2) && ($SG4 > $value_filter_p2)) { | |
2205 if ($alAlt2 ne $alAlt) { # P1 [A/G] P2 [A/C] (3 alleles) | |
2206 | |
2207 | |
2208 | |
2209 print HTMLSNP "<td style=\"border-left:3px solid black\">".$c."</td>"; | |
2210 print HTMLSNP "<td style=\"border-left:3px solid black\">".$alRef."</td>"; | |
2211 print HTMLSNP "<td>".$code_snp."</td>"; | |
2212 print HTMLSNP "<td>".$code_snp2."</td>"; | |
2213 print HTMLSNP "<td>".$FDP."/".$DP_P; | |
2214 print TABSNP $s . "\t"; | |
2215 print TABSNP $c . "\t"; | |
2216 print TABSNP $alRef . "\t"; | |
2217 print TABSNP $code_snp . "\t"; | |
2218 print TABSNP $code_snp2 . "\t"; | |
2219 print TABSNP $FDP."/".$DP_P; | |
2220 if (($DP_P) != 0) { | |
2221 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP/$DP_P*100).">"; | |
2222 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP/$DP_P*100).">"; | |
2223 print HTMLSNP "<br>".$sub1_1." - ".$sub1_2."</td>"; | |
2224 print TABSNP "," . $sub1_1." - ".$sub1_2."\t"; | |
2225 } | |
2226 else { | |
2227 print HTMLSNP "</td>"; | |
2228 print TABSNP "\t"; | |
2229 } | |
2230 print TABSNP $FDP2."/".$DP_P2; | |
2231 print HTMLSNP "<td>".$FDP2."/".$DP_P2; | |
2232 if (($DP_P2) != 0) { | |
2233 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP2/$DP_P2*100).">"; | |
2234 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP2/$DP_P2*100).">"; | |
2235 print HTMLSNP "<br>".$sub2_1." - ".$sub2_2."</td>"; | |
2236 print TABSNP "," . $sub2_1." - ".$sub2_2."\t"; | |
2237 } | |
2238 else { | |
2239 print HTMLSNP "</td>"; | |
2240 print TABSNP "\t"; | |
2241 } | |
2242 print TABSNP "\n"; | |
2243 print HTMLSNP "</tr>\n"; | |
2244 $nbDifferent ++ ; | |
2245 $alleleCommunH ++ ; | |
2246 $taille++; | |
2247 } | |
2248 } | |
2249 } | |
2250 } | |
2251 | |
2252 else { # ALL | |
2253 # COMMON PART | |
2254 #print STDOUT "\nBOUM : ".$SG1." + ".$SG2." + ".$SG3." + ".$SG4 ; | |
2255 #if (($SG1> $value_filter_p1) && ($SG2> $value_filter_p1) && ($SG3> $value_filter_p2) && ($SG4> $value_filter_p2)) { | |
2256 | |
2257 # print HTMLSNP "<td></td><td></td>"; | |
2258 | |
2259 # [5] P1 = 1/1 ; P2 = 1/1 (1 allele) P1 [A] P2 [A] | |
2260 if (($GT_poly =~ /^1.1$/) && ($GT_poly2 =~ /^1.1$/)) { | |
2261 | |
2262 | |
2263 print HTMLSNP "<td style=\"border-left:3px solid black\">".$c."</td>"; | |
2264 print HTMLSNP "<td class=\"border-left:3px solid black\">".$alRef."</td>"; | |
2265 print HTMLSNP "<td>".$code_snp."</td>"; | |
2266 print HTMLSNP "<td>".$code_snp2."</td>"; | |
2267 print HTMLSNP "<td>".$FDP."/".$DP_P; | |
2268 print TABSNP $s . "\t"; | |
2269 print TABSNP $c . "\t"; | |
2270 print TABSNP $alRef . "\t"; | |
2271 print TABSNP $code_snp . "\t"; | |
2272 print TABSNP $code_snp2 . "\t"; | |
2273 print TABSNP $FDP."/".$DP_P; | |
2274 if (($DP_P) != 0) { | |
2275 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP/$DP_P*100).">"; | |
2276 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP/$DP_P*100).">"; | |
2277 print HTMLSNP "<br>".$sub1_1." - ".$sub1_2."</td>"; | |
2278 print TABSNP "," . $sub1_1." - ".$sub1_2."\t"; | |
2279 } | |
2280 else { | |
2281 print HTMLSNP "</td>"; | |
2282 print TABSNP "\t"; | |
2283 } | |
2284 print TABSNP $FDP2."/".$DP_P2; | |
2285 print HTMLSNP "<td>".$FDP2."/".$DP_P2; | |
2286 if (($DP_P2) != 0) { | |
2287 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP2/$DP_P2*100).">"; | |
2288 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP2/$DP_P2*100).">"; | |
2289 print HTMLSNP "<br>".$sub2_1." - ".$sub2_2."</td>"; | |
2290 print TABSNP "," . $sub2_1." - ".$sub2_2."\t"; | |
2291 } | |
2292 else { | |
2293 print HTMLSNP "</td>"; | |
2294 print TABSNP "\t"; | |
2295 } | |
2296 print TABSNP "\n"; | |
2297 print HTMLSNP "</tr>\n"; | |
2298 #********************************************************************************************************************* | |
2299 if ($code_snp2 eq $code_snp) { | |
2300 $nbCommunHomo ++ ; | |
2301 $taille++; | |
2302 } | |
2303 else { # (2 alleles) P1 [A] P2 [C] | |
2304 $nbDifferent ++ ; | |
2305 $nbHomoDiff ++ ; | |
2306 $taille++; | |
2307 } | |
2308 } | |
2309 # [2] [4] P1 = 0/1 ; P2 = 1/1 | |
2310 if (((($GT_poly =~ /^0.1$/) || ($GT_poly =~ /^0.1$/)) && ($GT_poly2 =~ /^1.1$/))) { | |
2311 if (($SG1> $value_filter_p1) && ($SG2> $value_filter_p1)) { | |
2312 | |
2313 | |
2314 | |
2315 print HTMLSNP "<td style=\"border-left:3px solid black\">".$c."</td>"; | |
2316 print HTMLSNP "<td class=\"border-left:3px solid black\">".$alRef."</td>"; | |
2317 print HTMLSNP "<td>".$code_snp."</td>"; | |
2318 print HTMLSNP "<td>".$code_snp2."</td>"; | |
2319 print HTMLSNP "<td>".$FDP."/".$DP_P; | |
2320 print TABSNP $s . "\t"; | |
2321 print TABSNP $c . "\t"; | |
2322 print TABSNP $alRef . "\t"; | |
2323 print TABSNP $code_snp . "\t"; | |
2324 print TABSNP $code_snp2 . "\t"; | |
2325 print TABSNP $FDP."/".$DP_P; | |
2326 if (($DP_P) != 0) { | |
2327 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP/$DP_P*100).">"; | |
2328 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP/$DP_P*100).">"; | |
2329 print HTMLSNP "<br>".$sub1_1." - ".$sub1_2."</td>"; | |
2330 print TABSNP "," . $sub1_1." - ".$sub1_2."\t"; | |
2331 } | |
2332 else { | |
2333 print HTMLSNP "</td>"; | |
2334 print TABSNP "\t"; | |
2335 } | |
2336 print TABSNP $FDP2."/".$DP_P2; | |
2337 print HTMLSNP "<td>".$FDP2."/".$DP_P2; | |
2338 if (($DP_P2) != 0) { | |
2339 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP2/$DP_P2*100).">"; | |
2340 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP2/$DP_P2*100).">"; | |
2341 print HTMLSNP "<br>".$sub2_1." - ".$sub2_2."</td>"; | |
2342 print TABSNP "," . $sub2_1." - ".$sub2_2."\t"; | |
2343 } | |
2344 else { | |
2345 print HTMLSNP "</td>"; | |
2346 print TABSNP "\t"; | |
2347 } | |
2348 print TABSNP "\n"; | |
2349 print HTMLSNP "</tr>\n"; | |
2350 if ($alAlt2 ne $alAlt) { # (2 alleles) P1 [A/G] P2 [G] | |
2351 $nbDifferent ++ ; | |
2352 $alleleCommun ++ ; | |
2353 $nbPolyploid1 ++ ; | |
2354 $taille++; | |
2355 } | |
2356 else { # (3 alleles) P1 [A/G] P2 [C] | |
2357 $nbDifferent ++ ; | |
2358 $alleleDifferent ++ ; | |
2359 $nbPolyploid1 ++ ; | |
2360 $taille++; | |
2361 } | |
2362 } | |
2363 } | |
2364 if ((($GT_poly2 =~ /^0.1$/) || ($GT_poly2 =~ /^0.1$/)) && ($GT_poly =~ /^1.1$/)) { | |
2365 if (($SG3> $value_filter_p2) && ($SG4> $value_filter_p2)) { | |
2366 print HTMLSNP "<td style=\"border-left:3px solid black\">".$c."</td>"; | |
2367 print HTMLSNP "<td class=\"border-left:3px solid black\">".$alRef."</td>"; | |
2368 print HTMLSNP "<td>".$code_snp."</td>"; | |
2369 print HTMLSNP "<td>".$code_snp2."</td>"; | |
2370 print HTMLSNP "<td>".$FDP."/".$DP_P; | |
2371 print TABSNP $s . "\t"; | |
2372 print TABSNP $c . "\t"; | |
2373 print TABSNP $alRef . "\t"; | |
2374 print TABSNP $code_snp . "\t"; | |
2375 print TABSNP $code_snp2 . "\t"; | |
2376 print TABSNP $FDP."/".$DP_P; | |
2377 if (($DP_P) != 0) { | |
2378 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP/$DP_P*100).">"; | |
2379 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP/$DP_P*100).">"; | |
2380 print HTMLSNP "<br>".$sub1_1." - ".$sub1_2."</td>"; | |
2381 print TABSNP "," . $sub1_1." - ".$sub1_2."\t"; | |
2382 } | |
2383 else { | |
2384 print HTMLSNP "</td>"; | |
2385 print TABSNP "\t"; | |
2386 } | |
2387 print TABSNP $FDP2."/".$DP_P2; | |
2388 print HTMLSNP "<td>".$FDP2."/".$DP_P2; | |
2389 if (($DP_P2) != 0) { | |
2390 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP2/$DP_P2*100).">"; | |
2391 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP2/$DP_P2*100).">"; | |
2392 print HTMLSNP "<br>".$sub2_1." - ".$sub2_2."</td>"; | |
2393 print TABSNP "," . $sub2_1." - ".$sub2_2."\t"; | |
2394 } | |
2395 else { | |
2396 print HTMLSNP "</td>"; | |
2397 print TABSNP "\t"; | |
2398 } | |
2399 print TABSNP "\n"; | |
2400 print HTMLSNP "</tr>\n"; | |
2401 if ($alAlt2 ne $alAlt) { # (2 alleles) P1 [A/G] P2 [G] | |
2402 $nbDifferent ++ ; | |
2403 $alleleCommun ++ ; | |
2404 $nbPolyploid2 ++ ; | |
2405 $taille++; | |
2406 } | |
2407 else { # (3 alleles) P1 [A/G] P2 [C] | |
2408 $nbDifferent ++ ; | |
2409 $alleleDifferent ++ ; | |
2410 $nbPolyploid2 ++ ; | |
2411 $taille++; | |
2412 } | |
2413 } | |
2414 } | |
2415 # [3] [7] P1 = 0/1 ; P2 = 0/0 (2 alleles) P1 [A/G] P2 [A] | |
2416 if ((($GT_poly =~ /^0.1$/) || ($GT_poly =~ /^0.1$/)) && (($GT_poly2 =~ /^0.0$/) || ($GT_poly2 eq ""))) { | |
2417 if (($SG1> $value_filter_p1) && ($SG2> $value_filter_p1)) { | |
2418 print HTMLSNP "<td style=\"border-left:3px solid black\">".$c."</td>"; | |
2419 print HTMLSNP "<td class=\"border-left:3px solid black\">".$alRef."</td>"; | |
2420 print HTMLSNP "<td>".$code_snp."</td>"; | |
2421 print HTMLSNP "<td>".$code_snp2."</td>"; | |
2422 print HTMLSNP "<td>".$FDP."/".$DP_P; | |
2423 print TABSNP $s . "\t"; | |
2424 print TABSNP $c . "\t"; | |
2425 print TABSNP $alRef . "\t"; | |
2426 print TABSNP $code_snp . "\t"; | |
2427 print TABSNP $code_snp2 . "\t"; | |
2428 print TABSNP $FDP."/".$DP_P; | |
2429 if (($DP_P) != 0) { | |
2430 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP/$DP_P*100).">"; | |
2431 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP/$DP_P*100).">"; | |
2432 print HTMLSNP "<br>".$sub1_1." - ".$sub1_2."</td>"; | |
2433 print TABSNP "," . $sub1_1." - ".$sub1_2."\t"; | |
2434 } | |
2435 else { | |
2436 print HTMLSNP "</td>"; | |
2437 print TABSNP "\t"; | |
2438 } | |
2439 print TABSNP $FDP2."/".$DP_P2; | |
2440 print HTMLSNP "<td>".$FDP2."/".$DP_P2; | |
2441 if (($DP_P2) != 0) { | |
2442 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP2/$DP_P2*100).">"; | |
2443 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP2/$DP_P2*100).">"; | |
2444 print HTMLSNP "<br>".$sub2_1." - ".$sub2_2."</td>"; | |
2445 print TABSNP "," . $sub2_1." - ".$sub2_2."\t"; | |
2446 } | |
2447 else { | |
2448 print HTMLSNP "</td>"; | |
2449 print TABSNP "\t"; | |
2450 } | |
2451 print TABSNP "\n"; | |
2452 print HTMLSNP "</tr>\n"; | |
2453 | |
2454 $nbDifferent ++ ; | |
2455 $alleleCommun ++ ; | |
2456 $nbPolyploid1 ++ ; | |
2457 $taille++; | |
2458 } | |
2459 } | |
2460 if ((($GT_poly2 =~ /^0.1$/) || ($GT_poly2 =~ /^0.1$/)) && (($GT_poly =~ /^0.0$/) || ($GT_poly eq ""))) { | |
2461 if (($SG3> $value_filter_p2) && ($SG4> $value_filter_p2)) { | |
2462 print HTMLSNP "<td style=\"border-left:3px solid black\">".$c."</td>"; | |
2463 print HTMLSNP "<td class=\"border-left:3px solid black\">".$alRef."</td>"; | |
2464 print HTMLSNP "<td>".$code_snp."</td>"; | |
2465 print HTMLSNP "<td>".$code_snp2."</td>"; | |
2466 print HTMLSNP "<td>".$FDP."/".$DP_P; | |
2467 print TABSNP $s . "\t"; | |
2468 print TABSNP $c . "\t"; | |
2469 print TABSNP $alRef . "\t"; | |
2470 print TABSNP $code_snp . "\t"; | |
2471 print TABSNP $code_snp2 . "\t"; | |
2472 print TABSNP $FDP."/".$DP_P; | |
2473 if (($DP_P) != 0) { | |
2474 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP/$DP_P*100).">"; | |
2475 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP/$DP_P*100).">"; | |
2476 print HTMLSNP "<br>".$sub1_1." - ".$sub1_2."</td>"; | |
2477 print TABSNP "," . $sub1_1." - ".$sub1_2."\t"; | |
2478 } | |
2479 else { | |
2480 print HTMLSNP "</td>"; | |
2481 print TABSNP "\t"; | |
2482 } | |
2483 print TABSNP $FDP2."/".$DP_P2; | |
2484 print HTMLSNP "<td>".$FDP2."/".$DP_P2; | |
2485 if (($DP_P2) != 0) { | |
2486 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP2/$DP_P2*100).">"; | |
2487 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP2/$DP_P2*100).">"; | |
2488 print HTMLSNP "<br>".$sub2_1." - ".$sub2_2."</td>"; | |
2489 print TABSNP "," . $sub2_1." - ".$sub2_2."\t"; | |
2490 } | |
2491 else { | |
2492 print HTMLSNP "</td>"; | |
2493 print TABSNP "\t"; | |
2494 } | |
2495 print TABSNP "\n"; | |
2496 print HTMLSNP "</tr>\n"; | |
2497 ############ | |
2498 # HERE P2 # | |
2499 ############ | |
2500 $nbDifferent ++ ; | |
2501 $alleleCommun ++ ; | |
2502 $nbPolyploid2 ++ ; | |
2503 $taille++; | |
2504 } | |
2505 } | |
2506 # [6] [8] P1 = 1/1 ; P2 = 0/0 | |
2507 if (($GT_poly =~ /^1.1$/) && (($GT_poly2 =~ /^0.0$/) || ($GT_poly2 eq ""))) { | |
2508 print HTMLSNP "<td style=\"border-left:3px solid black\">".$c."</td>"; | |
2509 print HTMLSNP "<td class=\"border-left:3px solid black\">".$alRef."</td>"; | |
2510 print HTMLSNP "<td>".$code_snp."</td>"; | |
2511 print HTMLSNP "<td>".$code_snp2."</td>"; | |
2512 print HTMLSNP "<td>".$FDP."/".$DP_P; | |
2513 print TABSNP $s . "\t"; | |
2514 print TABSNP $c . "\t"; | |
2515 print TABSNP $alRef . "\t"; | |
2516 print TABSNP $code_snp . "\t"; | |
2517 print TABSNP $code_snp2 . "\t"; | |
2518 print TABSNP $FDP."/".$DP_P; | |
2519 if (($DP_P) != 0) { | |
2520 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP/$DP_P*100).">"; | |
2521 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP/$DP_P*100).">"; | |
2522 print HTMLSNP "<br>".$sub1_1." - ".$sub1_2."</td>"; | |
2523 print TABSNP "," . $sub1_1." - ".$sub1_2."\t"; | |
2524 } | |
2525 else { | |
2526 print HTMLSNP "</td>"; | |
2527 print TABSNP "\t"; | |
2528 } | |
2529 print TABSNP $FDP2."/".$DP_P2; | |
2530 print HTMLSNP "<td>".$FDP2."/".$DP_P2; | |
2531 if (($DP_P2) != 0) { | |
2532 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP2/$DP_P2*100).">"; | |
2533 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP2/$DP_P2*100).">"; | |
2534 print HTMLSNP "<br>".$sub2_1." - ".$sub2_2."</td>"; | |
2535 print TABSNP "," . $sub2_1." - ".$sub2_2."\t"; | |
2536 } | |
2537 else { | |
2538 print HTMLSNP "</td>"; | |
2539 print TABSNP "\t"; | |
2540 } | |
2541 print TABSNP "\n"; | |
2542 print HTMLSNP "</tr>\n"; | |
2543 $nbDifferent ++ ; | |
2544 $alleleCommun ++ ; | |
2545 $nbPolyploid1 ++ ; | |
2546 $taille++; | |
2547 } | |
2548 if (($GT_poly2 =~ /^1.1$/) && (($GT_poly =~ /^0.0$/) || ($GT_poly eq ""))) { | |
2549 print HTMLSNP "<td style=\"border-left:3px solid black\">".$c."</td>"; | |
2550 print HTMLSNP "<td class=\"border-left:3px solid black\">".$alRef."</td>"; | |
2551 print HTMLSNP "<td>".$code_snp."</td>"; | |
2552 print HTMLSNP "<td>".$code_snp2."</td>"; | |
2553 print HTMLSNP "<td>".$FDP."/".$DP_P; | |
2554 print TABSNP $s . "\t"; | |
2555 print TABSNP $c . "\t"; | |
2556 print TABSNP $alRef . "\t"; | |
2557 print TABSNP $code_snp . "\t"; | |
2558 print TABSNP $code_snp2 . "\t"; | |
2559 print TABSNP $FDP."/".$DP_P; | |
2560 if (($DP_P) != 0) { | |
2561 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP/$DP_P*100).">"; | |
2562 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP/$DP_P*100).">"; | |
2563 print HTMLSNP "<br>".$sub1_1." - ".$sub1_2."</td>"; | |
2564 print TABSNP "," . $sub1_1." - ".$sub1_2."\t"; | |
2565 } | |
2566 else { | |
2567 print HTMLSNP "</td>"; | |
2568 print TABSNP "\t"; | |
2569 } | |
2570 print TABSNP $FDP2."/".$DP_P2; | |
2571 print HTMLSNP "<td>".$FDP2."/".$DP_P2; | |
2572 if (($DP_P2) != 0) { | |
2573 print HTMLSNP "<br><img src=\"".$REPimages."r1.png\" height=5 width=".sprintf("%.0f", $FDP2/$DP_P2*100).">"; | |
2574 print HTMLSNP "<img src=\"".$REPimages."r2.png\" height=5 width=".sprintf("%.0f", 100-$FDP2/$DP_P2*100).">"; | |
2575 print HTMLSNP "<br>".$sub2_1." - ".$sub2_2."</td>"; | |
2576 print TABSNP "," . $sub2_1." - ".$sub2_2."\t"; | |
2577 } | |
2578 else { | |
2579 print HTMLSNP "</td>"; | |
2580 print TABSNP "\t"; | |
2581 } | |
2582 print TABSNP "\n"; | |
2583 print HTMLSNP "</tr>\n"; | |
2584 $nbDifferent ++ ; | |
2585 $alleleCommun ++ ; | |
2586 $nbPolyploid2 ++ ; | |
2587 $taille++; | |
2588 } | |
2589 #} | |
2590 } | |
2591 | |
2592 | |
2593 #print TABSNP $s."\t".$c."\t".$alRef."\t".$code_snp."\t".$code_snp2."\t".$FDP."\t".$DP_P."\t".$FDP2."\t".$DP_P2; | |
2594 | |
2595 $ligneOK = 1 ; | |
2596 } | |
2597 | |
2598 | |
2599 if (($nbCommuns + $nbCommunHomo + $nbDifferent + $nbHomoDiff + $alleleCommun + $alleleDifferent + $alleleCommunH + $nbPolyploid1 + $nbPolyploid2) > 0 ) { | |
2600 | |
2601 if ($ligneInter == 0) { | |
2602 print HTMLCOUNT "<td class=\"ted2\" style=\"border-right:3px solid black\">".$s."</td>"; | |
2603 } | |
2604 else { | |
2605 print HTMLCOUNT "<td class=\"ted\" style=\"border-right:3px solid black\">".$s."</td>"; | |
2606 } | |
2607 print TABCOUNT $s."\t"; | |
2608 | |
2609 ####################################### | |
2610 if ($ligneInter == 0) { $ligneInter = 1 ; } | |
2611 else { $ligneInter = 0 ; } | |
2612 ####################################### | |
2613 | |
2614 # Calcul des intervalles # | |
2615 ########################## | |
2616 $taille_totale = 0 ; | |
2617 my $ref = $intervalle2{$s}; | |
2618 my %hash = %$ref; | |
2619 | |
2620 foreach my $interval(keys(%hash)){ | |
2621 my @pos = split(/-/,$interval); | |
2622 $taille_inter = $pos[1]-$pos[0]+1 ; | |
2623 $taille_totale = $taille_totale + $taille_inter; | |
2624 } | |
2625 $total1 = $case5 + $case1 + $case2 + $casePolyplother; | |
2626 $total2 = $case5 + $case3ou4 + $caseDiplother; | |
2627 | |
2628 # SYNTHESIS | |
2629 | |
2630 print HTMLCOUNT "<td>".$taille_totale."</td><td style=\"border-left:3px solid black\">".$taille. "</td></td>"; | |
2631 print HTMLCOUNT "<td style=\"border-left:3px solid black\">"; | |
2632 print HTMLCOUNT $nbCommuns."</td><td>".$nbCommunHomo."</td><td style=\"border-left:3px solid black\">".$nbDifferent."</td><td style=\"border-left:3px solid black\">"; | |
2633 print HTMLCOUNT $nbHomoDiff."</td><td>".$alleleCommun."</td><td>".$alleleDifferent."</td><td>".$alleleCommunH."</td>"; | |
2634 print HTMLCOUNT "<td style=\"border-left:3px solid black\">".$nbPolyploid1."</td><td>".$nbPolyploid2."</td>"; | |
2635 print TABCOUNT $taille_totale."\t".$taille."\t"; | |
2636 print TABCOUNT $nbCommuns."\t".$nbCommunHomo."\t".$nbDifferent."\t".$nbHomoDiff."\t".$alleleCommun."\t".$alleleDifferent."\t".$alleleCommunH."\t".$nbPolyploid1."\t".$nbPolyploid2."\t"; | |
2637 | |
2638 $nbTotGenesAna ++ ; | |
2639 | |
2640 print HTMLCOUNT "</tr>"; | |
2641 print TABCOUNT "\n"; | |
2642 | |
2643 $totalSize = $totalSize + $taille_totale ; | |
2644 $totalSNP = $totalSNP + $taille ; | |
2645 $totalNbPolyploid1 = $totalNbPolyploid1 + $nbPolyploid1 ; # SNP heterozygosity for P1 | |
2646 $totalNbPolyploid2 = $totalNbPolyploid2 + $nbPolyploid2 ; # SNP heterozygosity for P2 | |
2647 $totalNbCommuns = $totalNbCommuns + $nbCommuns ; # SNP heterozygosity [P1] = [P2] | |
2648 $totalNbCommunsHomo = $totalNbCommunsHomo + $nbCommunHomo ; # SNP homozygosity [P1] = [P2] | |
2649 $totalNbDifferent = $totalNbDifferent + $nbDifferent ; # [P1] ne [P2] | |
2650 $totalNbAlleleCommun = $totalNbAlleleCommun + $alleleCommun ; # Example : P1 = [A/G] ; P2 = [A] | |
2651 $totalAlleleDifferent = $totalAlleleDifferent + $alleleDifferent ; # Example : P1 = [A/G] ; P2 = [C] or [T] | |
2652 $totalAlleleCommunH = $totalAlleleCommunH + $alleleCommunH ; # Example : P1 = [A/G] ; P2 = [A/C] | |
2653 $totalNbHomoDiff = $totalNbHomoDiff + $nbHomoDiff ; # Example : P1 = [A/G] ; P2 = [A/C] | |
2654 } | |
2655 | |
2656 | |
2657 | |
2658 | |
2659 } | |
2660 ########## MODIF DERNIERE MINUTE ################" | |
2661 print HTMLCOUNT "<tr class=\"td3\">\n<td>"; | |
2662 | |
2663 print HTMLCOUNT $nbTotGenesAna."<td style=\"border-left:3px solid black\">"; | |
2664 print HTMLCOUNT $totalSize."</td><td style=\"border-left:3px solid black\">"; | |
2665 print HTMLCOUNT $totalSNP."</td><td style=\"border-left:3px solid black\">"; | |
2666 print HTMLCOUNT $totalNbCommuns."</td><td>"; | |
2667 print HTMLCOUNT $totalNbCommunsHomo."</td><td>"; | |
2668 print HTMLCOUNT $totalNbDifferent."</td><td style=\"border-left:3px solid black\">"; | |
2669 print HTMLCOUNT $totalNbHomoDiff."</td><td style=\"border-left:3px solid black\">"; | |
2670 print HTMLCOUNT $totalNbAlleleCommun."</td><td style=\"border:3px solid black\">"; | |
2671 print HTMLCOUNT $totalAlleleDifferent."</td><td style=\"border:3px solid black\">"; | |
2672 print HTMLCOUNT $totalAlleleCommunH."</td><td>"; | |
2673 print HTMLCOUNT $totalNbPolyploid1."</td><td>"; | |
2674 print HTMLCOUNT $totalNbPolyploid2."</td>"; | |
2675 print HTMLCOUNT "</tr>"; | |
2676 | |
2677 | |
2678 print TABCOUNT "$nbTotGenesAna\t$totalSize\t$totalSNP\t$totalNbCommuns\t$totalNbCommunsHomo\t$totalNbDifferent\t$totalNbHomoDiff\t$totalNbAlleleCommun\t$totalAlleleDifferent\t$totalAlleleCommunH\t$totalNbPolyploid1\t$totalNbPolyploid2\t"; | |
2679 print TABCOUNT "\n"; | |
2680 | |
2681 #################################################### | |
2682 print HTMLSNP "</table>\n"; | |
2683 print HTMLSNP "</html>\n"; | |
2684 close HTMLSNP ; | |
2685 | |
2686 print HTMLCOUNT "</table>\n"; | |
2687 print HTMLCOUNT "</html>\n"; | |
2688 close HTMLCOUNT ; | |
2689 | |
2690 close TABSNP; | |
2691 close TABCOUNT ; | |
2692 | |
2693 # tie @array, 'Tie::File', $SNP_count or die ; | |
2694 # $array[82] = "<table class=\"tab2\"><th class=\"th\" style=\"text-align:left;\">"; | |
2695 # $array[83] = "<br>".$nbTotGenesAna." analysed genes"; | |
2696 # $array[84] = "<br>".$nbTotGenesVal." with SNP validation"; | |
2697 # $array[85] = "<br>Analysis performed on ".$totalSize." bp"; | |
2698 # $array[86] = "<br>".$totalSNP." SNP"; | |
2699 # $array[87] = "<br><img src=\"".$REPimages."5v.png\" WIDTH=20> : ".$total5." validated SNP"; | |
2700 # $array[88] = "<br><br><img src=\"".$REPimages."1.png\" WIDTH=20> : ".$total11.""; | |
2701 # $array[89] = "<br><img src=\"".$REPimages."2.png\" WIDTH=20> : ".$total22.""; | |
2702 # $array[90] = "<br><img src=\"".$REPimages."3ou4.png\" WIDTH=20> : ".$total3ou4.""; | |
2703 # $array[91] = "<br>Other SNP types : ".$totalOther.""; | |
2704 # $array[92] = "<br>Heterozygosity for genome 1 : ".$totalGenome2.""; | |
2705 # $array[93] = "<br>SNP between parental genomes (diploids) : ".$total512.""; | |
2706 # $array[94] = "<br>SNP polyploid : ".$total534.""; | |
2707 # $array[95] = "<th class=\"th\"><img src=\"".$REPimages."arbre.png\" WIDTH=400></th></table>"; | |
2708 } | |
2709 | |
2710 $time2 = time ; | |
2711 $tmps = $time2 - $time; | |
2712 print STDOUT "\n\nTemps execution : ".$tmps."\n"; |