@@ -52,10 +52,10 @@ def parseRefCov(refcov_f):
52
52
with open (refcov_f ) as fh :
53
53
for l in fh :
54
54
try :
55
- cov_lib , reads_mapped_ref , reads_unmapped_ref = l .split ("," )
55
+ cov_lib , reads_total_ref , reads_mapped_ref = l .split ("," )
56
56
refcov_dict [cov_lib ] = {
57
- 'reads_mapped ' : int (reads_mapped_ref ),
58
- 'reads_unmapped ' : int (reads_unmapped_ref )
57
+ 'reads_total ' : int (reads_total_ref ),
58
+ 'reads_mapped ' : int (reads_mapped_ref )
59
59
}
60
60
except :
61
61
BtLog .error ('21' )
@@ -203,9 +203,9 @@ def write_stats(self):
203
203
with open (out_f , 'w' ) as fh :
204
204
for cov_lib in sorted (self .cov_libs ):
205
205
fh .write ("# %s - %s\n " % (self .out_f , cov_lib ))
206
- fh .write ("{:<10}\t {:>10}{:>10}\t {:>10}\t {:<10}{:<10}\t {:<10}\t {:<5}\t {:<5}\t {:<10}\t {:<10}\t {:<10}\t {:<10}\n " .format ('Group' , 'colour' , 'count' , 'visible (%)' , 'span' , 'visible(%)' , 'n50' , 'GC' , 'GC (std)' , 'cov_mean' , 'cov_std' , 'read map' , 'read map (%)' ))
206
+ fh .write ("{:<10}\t {:>10}{:>10}\t {:>10}\t {:<10}\t {:<10}\t {:<10}\t {:<5}\t {:<5}\t {:<10}\t {:<10}\t {:<10}\t {:<10}\n " .format ('Group' , 'colour' , 'count' , 'visible (%)' , 'span' , 'visible(%)' , 'n50' , 'GC' , 'GC (std)' , 'cov_mean' , 'cov_std' , 'read map' , 'read map (%)' ))
207
207
for stat in stats :
208
- fh .write ("{:<10}\t {:>10}{:>10}\t {:>10}\t {:<10}{:<10}\t {:<10}\t {:<5}\t {:<5}\t {:<10}\t {:<10}\t {:<10}\t {:<10}\n " .format (\
208
+ fh .write ("{:<10}\t {:>10}{:>10}\t {:>10}\t {:<10}\t {:<10}\t {:<10}\t {:<5}\t {:<5}\t {:<10}\t {:<10}\t {:<10}\t {:<10}\n " .format (\
209
209
stat ['name' ], stat ['colour' ], stat ['count_total' ], stat ['count_visible_perc' ], stat ['span_total' ], \
210
210
stat ['span_visible_perc' ], stat ['n50' ], stat ['gc_mean' ], stat ['gc_std' ], stat ['cov_mean' ][cov_lib ], \
211
211
stat ['cov_std' ][cov_lib ], stat ['reads_mapped' ][cov_lib ], stat ['reads_mapped_perc' ][cov_lib ]))
@@ -302,7 +302,7 @@ def relabel_and_colour(self, colour_f, user_labels):
302
302
def plotReadCov (self , refcov_dict ):
303
303
mat .rcParams .update ({'font.size' : 14 })
304
304
plot_data = {}
305
-
305
+
306
306
main_columns = 2
307
307
if (refcov_dict ):
308
308
main_columns += 2
@@ -316,9 +316,9 @@ def plotReadCov(self, refcov_dict):
316
316
reads_total = self .cov_libs_total_reads_dict [cov_lib ]
317
317
reads_unmapped = reads_total - self .stats ['all' ]['reads_mapped' ][cov_lib ]
318
318
if cov_lib in refcov_dict :
319
- reads_mapped_ref = refcov_dict [cov_lib ]['reads_mapped ' ]
320
- reads_unmapped_ref = refcov_dict [cov_lib ]['reads_unmapped ' ]
321
- reads_total_ref = reads_mapped_ref + reads_unmapped_ref
319
+ reads_total_ref = refcov_dict [cov_lib ]['reads_total ' ]
320
+ reads_mapped_ref = refcov_dict [cov_lib ]['reads_mapped ' ]
321
+ reads_unmapped_ref = reads_total_ref - reads_mapped_ref
322
322
main_plot .labels .append ('Unmapped (ref)' )
323
323
main_plot .values .append (reads_unmapped_ref / reads_total_ref )
324
324
main_plot .colours .append (DGREY )
0 commit comments