Skip to content

Commit

Permalink
fix behaviour after full overlap detection
Browse files Browse the repository at this point in the history
  • Loading branch information
lrauschning committed Aug 29, 2024
1 parent ded6760 commit a5759c7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions msyd/pyxfiles/intersection.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ cdef int MIN_SYN_THRESH = 30
logger = util.CustomFormatter.getlogger(__name__)


cpdef int get_min_syn_thresh():
return MIN_SYN_THRESH

def filter_multisyn(multisyn, drop_small=True, drop_private=True):
"""
Tests if a multisyn should be added to the output by checking degree and length.
Expand Down Expand Up @@ -260,9 +263,9 @@ cdef remove_overlap(syn):
# will not catch overlap between non-adjacent regions!
#assert(set(cur.ranges_dict) == set(prev.ranges_dict))
for org in cur.ranges_dict: # should be on the same chr
if org not in prev.ranges_dict or cur.ranges_dict[org] is None:
if org not in prev.ranges_dict or cur.ranges_dict[org] is None or prev.ranges_dict[org] is None:
continue
assert(cur.ranges_dict[org].chr == prev.ranges_dict[org].chr)
assert(cur.ranges_dict[org].chr == prev.ranges_dict[org].chr) # prev.ranges_dict[org] is None sometimes?? O.o

ov = prev.ranges_dict[org].end - cur.ranges_dict[org].start + 1 # indices are inclusive
if ov > 0:
Expand All @@ -275,6 +278,10 @@ cdef remove_overlap(syn):
cur.ranges_dict[org] = None # set to None instead
if cur.cigars_dict:
del cur.cigars_dict[org]
# technically, on `org` the following syns should now be compared
# however that would require storing the last region for every org separately
# for a case that shouldn't ever occur
# => just delete it and skip comparisons
continue

# there is overlap on org
Expand Down

0 comments on commit a5759c7

Please sign in to comment.