File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -451,15 +451,17 @@ def compute_mean_std_bigwig(bigwig):
451451 ns = []; means = []; stds = []
452452 for chrom , length in chroms .items ():
453453 # iterate all intervals to get the covered length
454- length = sum ([i [1 ]- i [0 ] for i in bw .intervals (chrom )])
455- ns .append (length )
456- means .append (bw .stats (chrom , type = "mean" , exact = True ))
457- try :
458- stds .append (bw .stats (chrom , type = "std" , exact = True ))
459- except RuntimeError :
460- logger .error (chrom )
461- logger .error (length )
462- raise Exception
454+ intervals = bw .intervals (chrom )
455+ if intervals is not None :
456+ length = sum ([i [1 ]- i [0 ] for i in intervals ])
457+ ns .append (length )
458+ means .append (bw .stats (chrom , type = "mean" , exact = True ))
459+ try :
460+ stds .append (bw .stats (chrom , type = "std" , exact = True ))
461+ except RuntimeError :
462+ logger .error (chrom )
463+ logger .error (length )
464+ raise Exception
463465
464466 # compute overall metrics
465467 std_all = 0
You can’t perform that action at this time.
0 commit comments