From 41d5ed48f5121954794583fb9007d531a2bc488b Mon Sep 17 00:00:00 2001 From: Phlya Date: Fri, 17 Jul 2020 16:16:19 +0100 Subject: [PATCH] Fix empty selection --- coolpuppy/__main__.py | 2 +- coolpuppy/coolpup.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/coolpuppy/__main__.py b/coolpuppy/__main__.py index 33ea605..99f54f4 100644 --- a/coolpuppy/__main__.py +++ b/coolpuppy/__main__.py @@ -52,7 +52,7 @@ def parse_args_coolpuppy(): """, required=False, ) - parser.set_defaults(bed_ordered=True) + # parser.set_defaults(bed2_ordered=True) parser.add_argument( "--pad", default=100, diff --git a/coolpuppy/coolpup.py b/coolpuppy/coolpup.py index 47498af..657396d 100644 --- a/coolpuppy/coolpup.py +++ b/coolpuppy/coolpup.py @@ -1117,8 +1117,9 @@ def pileup_chrom( mids = self.CC.control_regions(filter_func) else: mids = self.CC.pos_stream(filter_func) - mids_row1 = mids.__next__() - if mids_row1[0] is None: # Checking if empty selection + try: + mids_row1 = mids.__next__() + except StopIteration: logging.info(f"Nothing to sum up in chromosome {chrom}") return mymap, mymap, cov_start, cov_end, 0 else: