Skip to content

Commit ca71adb

Browse files
Dom LaetschDom Laetsch
authored andcommitted
...
1 parent 9776b2d commit ca71adb

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

lib/BtCore.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def getPlotData(self, rank, min_length, hide_nohits, taxrule, c_index, catcolour
145145
data_dict = {}
146146
read_cov_dict = {}
147147
max_cov = 0.0
148-
148+
print self.covLibs
149149
cov_lib_dict = self.covLibs
150150
#print cov_lib_dict
151151
cov_lib_names_l = self.covLibs.keys() # does not include cov_sum
@@ -203,8 +203,10 @@ def getPlotData(self, rank, min_length, hide_nohits, taxrule, c_index, catcolour
203203
cov_sum = 0.0
204204
reads_mapped_sum = 0
205205
for cov_lib in sorted(cov_lib_names_l):
206-
cov = float(blob['covs'][cov_lib])
207-
cov = cov if cov > 0.02 else 0.02
206+
cov = float(blob['covs'][cov_lib])
207+
if cov < 0.02:
208+
cov = 0.02
209+
#cov = cov if cov > 0.02 else 0.02
208210
# increase max_cov
209211
if cov > max_cov:
210212
max_cov = cov
@@ -221,13 +223,13 @@ def getPlotData(self, rank, min_length, hide_nohits, taxrule, c_index, catcolour
221223
reads_mapped_sum += reads_mapped
222224

223225
if len(cov_lib_names_l) > 1:
224-
cov_sum = cov_sum if cov_sum > 0.02 else 0.02
226+
if cov_sum < 0.02 :
227+
cov_sum = 0.02
225228
data_dict[group]['covs']['sum'].append(cov_sum)
226-
if cov > max_cov:
227-
max_cov = cov
229+
if cov_sum > max_cov:
230+
max_cov = cov_sum
228231
if (reads_mapped_sum):
229232
data_dict[group]['reads_mapped']['sum'] += reads_mapped_sum
230-
231233
#if len(cov_lib_names_l) > 1:
232234
# for cov_lib, data in self.covLibs.items():
233235
# cov_libs_reads_total['cov_sum'] = cov_libs_reads_total.get('cov_sum', 0) + data['reads_total']
@@ -312,6 +314,9 @@ def parseCovs(self, covLibObjs):
312314
else:
313315
pass
314316
covLib.mean_cov = covLib.cov_sum/self.seqs
317+
if covLib.cov_sum == 0.0:
318+
print BtLog.error['26'] % (covLib.f)
319+
print covLib.cov_sum
315320
self.covLibs[covLib.name] = covLib
316321

317322

@@ -377,7 +382,7 @@ def __init__(self, name, fmt, f):
377382
self.name = name
378383
self.fmt = fmt
379384
self.f = abspath(f) if (f) else ''
380-
self.cov_sum = 0
385+
self.cov_sum = 0.0
381386
self.reads_total = 0
382387
self.reads_mapped = 0
383388
self.mean_cov = 0.0

lib/BtLog.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def progress(iteration, steps, max_value):
5656
'22' : '[ERROR:22]\t: Tax file %s seems to have no taxids.',
5757
'23' : '[ERROR:23]\t: Catcolour file %s does not seem to have the right format.',
5858
'24' : '[ERROR:24]\t: Catcolour file incompatible with c-index colouring.',
59-
'25' : '[ERROR:25]\t: Cov file %s does not seem to have the right format.'
59+
'25' : '[ERROR:25]\t: Cov file %s does not seem to have the right format.',
60+
'26' : '[ERROR:26]\t: The cumulative coverage of %s is 0.0. Please check you mapping/coverage file.'
6061
}
6162

6263
warn_d = {

lib/BtPlot.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ def plotReadCov(self, refcov_dict):
531531
plt.close()
532532

533533
def plotBlobs(self, cov_lib, info_flag):
534+
534535
rect_scatter, rect_histx, rect_histy, rect_legend = set_canvas()
535536
# Setting up plots and axes
536537
plt.figure(1, figsize=(35,35), dpi=400)
@@ -587,12 +588,6 @@ def plotBlobs(self, cov_lib, info_flag):
587588
if group == "no-hit":
588589
alpha = 0.5
589590
weights_array = group_length_array/1000
590-
print group
591-
print group_gc_array
592-
print group_cov_array
593-
print weights_array
594-
print top_bins
595-
print right_bins
596591
# generate label for legend
597592
fmt_seqs = "{:,}".format(group_number_of_seqs)
598593
fmt_span = "{:,}".format(group_span_in_mb)

0 commit comments

Comments
 (0)