comparison SNiPloid.pl @ 0:e94de0ea3351 draft default tip

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