Skip to content

Commit

Permalink
corrected chance of malformed first/last exon from picking wrong repr…
Browse files Browse the repository at this point in the history
…esentative cluster
  • Loading branch information
maschon0 committed Sep 8, 2021
1 parent 17877f9 commit c076ec8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bookend/core/cython_utils/_assembly_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,13 @@ cdef class Locus:
if LR.peak > RR.peak: # out-of-order peaks
left_positions = Counter({k:v for k,v in LR.positions.items() if k < RR.peak})
if len(left_positions) > 0:
splitRangeLeft = EndRange(min(left_positions), max(left_positions), left_positions.most_common(1)[0][0], sum(left_positions.values()), ltype)
splitRangeLeft = EndRange(min(left_positions), max(left_positions)+1, left_positions.most_common(1)[0][0], sum(left_positions.values()), ltype)
splitRangeLeft.positions = left_positions
newlefts += [splitRangeLeft]

right_positions = Counter({k:v for k,v in LR.positions.items() if k > RR.peak})
if len(right_positions) > 0:
splitRangeRight = EndRange(min(right_positions), max(right_positions), right_positions.most_common(1)[0][0], sum(right_positions.values()), ltype)
splitRangeRight = EndRange(min(right_positions), max(right_positions)+1, right_positions.most_common(1)[0][0], sum(right_positions.values()), ltype)
splitRangeRight.positions = right_positions
newlefts += [splitRangeRight]
if RR.right > splitRangeRight.peak: # Also split RR
Expand All @@ -401,12 +401,12 @@ cdef class Locus:
left_counts = sum(left_positions.values())
right_counts = sum(right_positions.values())
if len(left_positions) > 0:
splitRangeLeft = EndRange(min(left_positions), max(left_positions), left_positions.most_common(1)[0][0], left_counts/(left_counts+right_counts), rtype)
splitRangeLeft = EndRange(min(left_positions), max(left_positions)+1, left_positions.most_common(1)[0][0], left_counts/(left_counts+right_counts), rtype)
splitRangeLeft.positions = left_positions
newrights += [splitRangeLeft]

if len(right_positions) > 0:
splitRangeRight = EndRange(min(right_positions), max(right_positions), right_positions.most_common(1)[0][0], right_counts/(left_counts+right_counts), rtype)
splitRangeRight = EndRange(min(right_positions), max(right_positions)+1, right_positions.most_common(1)[0][0], right_counts/(left_counts+right_counts), rtype)
splitRangeRight.positions = right_positions
newrights += [splitRangeRight]

Expand Down

0 comments on commit c076ec8

Please sign in to comment.