Skip to content

Commit 2f959ae

Browse files
committed
small bug fix
1 parent f9909f5 commit 2f959ae

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

seqchromloader/utils.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)