@@ -33,24 +33,18 @@ def get_menu(config, ns):
3333 menu .append ('<h1>Alignment QC:</h1>' )
3434 if enabled .has_key ("picard" ):
3535 menu .append ('<h2><a #highlight="" href="./picard.html">- Picard</a></h2>' )
36- if enabled .has_key ("picard_IS" ):
37- menu .append ('<h2><a #highlight="" href="./picard-is.html">- Picard Insert Size</a></h2>' )
3836 if enabled .has_key ("star" ):
3937 menu .append ('<h2><a #highlight="" href="./star.html">- STAR</a></h2>' )
40- if enabled .has_key ("kallisto" ):
41- menu .append ('<h2><a #highlight="" href="./kallisto.html">- KALLISTO</a></h2>' )
4238 if enabled .has_key ("htseq-gene" ):
4339 menu .append ('<h2><a #highlight="" href="./htseq-gene.html">- HTseq-Gene</a></h2>' )
4440 if enabled .has_key ("htseq-exon" ):
4541 menu .append ('<h2><a #highlight="" href="./htseq-exon.html">- HTseq-Exon</a></h2>' )
4642 if ns > 1 :
47- if enabled .has_key ("star" ) or enabled .has_key ("htseq-gene" ) or enabled .has_key ("htseq-exon" ) or enabled . has_key ( "kallisto" ) :
43+ if enabled .has_key ("star" ) or enabled .has_key ("htseq-gene" ) or enabled .has_key ("htseq-exon" ):
4844 menu .append ('<h1>Count statistics:</h1>' )
4945 menu .append ('<h2><a #highlight="" href="./downloads.html">- DOWNLOADS</a></h2>' )
5046 if enabled .has_key ("star" ):
5147 menu .append ('<h2><a #highlight="" href="./star2.html">- STAR</a></h2>' )
52- if enabled .has_key ("kallisto" ):
53- menu .append ('<h2><a #highlight="" href="./kallisto2.html">- KALLISTO</a></h2>' )
5448 if enabled .has_key ("htseq-gene" ):
5549 menu .append ('<h2><a href="./htseq-gene2.html">- HTseq-Gene</a></h2>' )
5650 if enabled .has_key ("htseq-exon" ):
@@ -68,8 +62,8 @@ def get_menu(config, ns):
6862 return menu
6963
7064def print_samples (path ,config ):
71- analysis = ['trimgalore' , 'fastqc' , 'kallisto' , 'star' , 'star-fusion' , 'picard' , "htseq-gene" , "htseq-exon" , "picard_IS" , " varscan" , 'gatk' ]
72- sta = {"trimgalore" :"TrimGalore" , "fastqc" :"FastQC" ,"star" :"STAR" ,"star-fusion" :"STAR-Fusion" ,"picard" :"PicardQC" ,"kallisto" :"Kallisto" ,"htseq-gene" :"HTseq-gene" ,"htseq-exon" :"HTseq-exon" , "picard_IS" : "Picard-InsertSize" , " varscan" :"VARSCAN" , "gatk" :"GATK" }
65+ analysis = ['trimgalore' , 'fastqc' , 'kallisto' , 'star' , 'star-fusion' , 'picard' , "htseq-gene" , "htseq-exon" , "varscan" , 'gatk' ]
66+ sta = {"trimgalore" :"TrimGalore" , "fastqc" :"FastQC" ,"star" :"STAR" ,"star-fusion" :"STAR-Fusion" ,"picard" :"PicardQC" ,"kallisto" :"Kallisto" ,"htseq-gene" :"HTseq-gene" ,"htseq-exon" :"HTseq-exon" , "varscan" :"VARSCAN" , "gatk" :"GATK" }
7367 # SAMPLES LIST
7468 samples = dict ()
7569 f = open (path + "/samples.list" ,'r' )
@@ -154,16 +148,6 @@ def print_samples(path,config):
154148 else :
155149 res .append ("FAIL" )
156150 results ["star-fusion" ][x ] = " / " .join (res )
157- elif i == "picard_IS" :
158- for x , y in sorted (samples .iteritems ()):
159- res = []
160- if sok .has_key (x ):
161- link = "../results_picard_IS/" + x + ".txt"
162- link = '<a href="LINK" target="_blank">OK</a>' .replace ("LINK" , link )
163- res .append (link )
164- else :
165- res .append ("FAIL" )
166- results ["picard_IS" ][x ] = " / " .join (res )
167151 elif i == "picard" :
168152 for x , y in sorted (samples .iteritems ()):
169153 res = []
@@ -346,7 +330,6 @@ def stats_picard(path,samples,config):
346330 if i + n [k ] in files :
347331 f = open (path + "/results_picard" + "/" + i + n [k ],'r' )
348332 nx = 0
349- kdiff0 = 0
350333 for ii in f :
351334 if ii .startswith ("PF_BASES" ):
352335 head = ii .rstrip ().split ("\t " )
@@ -358,26 +341,17 @@ def stats_picard(path,samples,config):
358341 vals = ii .strip ("\n " ).split ("\t " )
359342 for kk in range (len (head )):
360343 stats [k ][head [kk ]] = vals [kk ]
361- if vals [kk ] != "" :
362- if float (vals [kk ]) > 0 :
363- kdiff0 += 1
364344 nx = 0
365- if kdiff0 == 0 :
366- ex = 1
367- break
368345 f .close ()
369346 else :
370347 ex = 1
371- break
372348 if ex == 1 :
373349 tr = "<td bgcolor='#CC3300'>" + i + "</td>"
374350 o = i
375351 for ii in range (18 ):
376352 tr += "<td bgcolor='#CC3300'>NA</td>"
377353 o += "\t NA"
378354 tr = "<tr>" + tr + "</tr>"
379- table .append (tr )
380- s = ["NA" for ii in range (10 )]
381355 else :
382356 align = int (stats [0 ]["PF_ALIGNED_BASES" ])
383357 cod = int (stats [0 ]["CODING_BASES" ])
@@ -415,56 +389,27 @@ def stats_picard(path,samples,config):
415389 tr += "<td bgcolor='#99CC66'>0</td>"
416390 o += "\t 0"
417391 tr = "<tr>" + tr + "</tr>"
418- table .append (tr )
419- o = o .split ("\t " )
420- st = 0
421- s = []
422- for ind in [10 , 11 , 12 , 5 , 7 , 3 ]:
423- s .append (str (round (float (o [ind ]) * float (o [2 ])/ float (o [1 ]),3 )))
424- if ind != 3 :
425- st += float (o [ind ]) * float (o [2 ])/ float (o [1 ])
426- for ind in [15 ,16 ,17 ,18 ]:
427- if o [ind ] != "0" :
428- s .append (str (round (float (o [ind ]) * 100 ,3 )))
429- else :
430- s .append ("0" )
431- s [5 ] = str (round (100 - st ,3 ))
392+ table .append (tr )
393+ o = o .split ("\t " )
394+ st = 0
395+ s = []
396+ for ind in [10 , 11 , 12 , 5 , 7 , 3 ]:
397+ s .append (str (round (float (o [ind ]) * float (o [2 ])/ float (o [1 ]),3 )))
398+ if ind != 3 :
399+ st += float (o [ind ]) * float (o [2 ])/ float (o [1 ])
400+ for ind in [15 ,16 ,17 ,18 ]:
401+ if o [ind ] != "0" :
402+ s .append (str (round (float (o [ind ]) * 100 ,3 )))
403+ else :
404+ s .append ("0" )
405+ s [5 ] = str (round (100 - st ,3 ))
432406 print >> out , i + "\t " + "\t " .join (s )
433407 out .close ()
434408 return "<table>" + "\n " .join (table )+ "</table>"
435409 else :
436410 return ""
437411
438412
439- def stats_picard_2 (path ,samples ,config ):
440- n = os .listdir (path )
441- hh = "\t " .join (['sample_id' ,'MEDIAN_INSERT_SIZE' ,'MEDIAN_ABSOLUTE_DEVIATION' ,'MIN_INSERT_SIZE' ,
442- 'MAX_INSERT_SIZE' ,'MEAN_INSERT_SIZE' ,'STANDARD_DEVIATION' ,'READ_PAIRS' , 'LINK_TXT' , 'LINK_PDF' ])
443- if config .has_key ("picard_IS" ) and ("results_picard_IS" in n ):
444- files = os .listdir (path + "/results_picard_IS" )
445- out = open (path + "/outputs/stats_picard2.txt" ,'w' )
446- print >> out , hh
447- data = list ()
448- for i in sorted (samples .keys ()):
449- if i + ".txt" in files :
450- f = open (path + "/results_picard_IS" + "/" + i + ".txt" ,'r' )
451- k = 0
452- while (1 ):
453- j = f .readline ()
454- if j .startswith ("MEDIAN_INSERT_SIZE" ):
455- j = f .readline ().strip ("\n " ).split ("\t " )
456- break
457- k += 1
458- if k > 10 or len (j ) == 0 :
459- j = ['NA' for i in range (7 )]
460- break
461- print >> out , "\t " .join ([i ] + j + ['<a href="../results_picard_IS/' + i + '.txt" target="_blank">+</a>' , '<a href="../results_picard_IS/' + i + '.pdf" target="_blank">+</a>' ])
462- f .close ()
463- else :
464- print >> out , "\t " .join ([i ] + ['NA' for i in range (9 )])
465- out .close ()
466- return 1
467-
468413def skeleton (path , path2html ):
469414 print "> Building HTML and OUTPUT folders skeletons..."
470415 print " - Path: " + path
@@ -562,7 +507,7 @@ def check_config(path):
562507 # Parses the configuration file
563508 print "> Parsing configuration file..."
564509 try :
565- z = ["trimgalore" , "fastqc" , "star" , "star-fusion" , "picard" , "htseq-gene" , "htseq-exon" , "kallisto" , "picard_IS" , " varscan" , "gatk" ]
510+ z = ["trimgalore" , "fastqc" , "star" , "star-fusion" , "picard" , "htseq-gene" , "htseq-exon" , "kallisto" , "varscan" , "gatk" ]
566511 f = open (path + "/config.txt" , 'r' )
567512 analysis = dict ()
568513 analysis ["cluster" ] = dict ()
0 commit comments