Skip to content

Commit

Permalink
Fix computation of minimum node in scoring loop (hyattpd/Prodigal#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed Jan 23, 2024
1 parent d8f900e commit b52c506
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pyrodigal/lib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1359,12 +1359,14 @@ cdef class ConnectionScorer:
# Set up distance constraints for making connections,
# but make exceptions for giant ORFS.
min = 0 if i < dprog.MAX_NODE_DIST else i - dprog.MAX_NODE_DIST
if nodes.nodes[i].strand == -1 and nodes.nodes[i].type != node_type.STOP and nodes.nodes[min].ndx >= nodes.nodes[i].stop_val:
if nodes.nodes[i].ndx != nodes.nodes[i].stop_val:
min = 0
elif nodes.nodes[i].strand == 1 and nodes.nodes[i].type == node_type.STOP and nodes.nodes[min].ndx >= nodes.nodes[i].stop_val:
if nodes.nodes[i].ndx != nodes.nodes[i].stop_val:
min = 0
if nodes.nodes[i].strand == -1 and nodes.nodes[i].type != node_type.STOP and nodes.nodes[min].ndx > nodes.nodes[i].stop_val:
# Extend minimum until node `min` is before the STOP codon of start node `i`
while min > 0 and nodes.nodes[min].ndx != nodes.nodes[i].stop_val:
min -= 1
elif nodes.nodes[i].strand == 1 and nodes.nodes[i].type == node_type.STOP and nodes.nodes[min].ndx > nodes.nodes[i].stop_val:
# Extend minimum until node `min` is before the START codon of stop node `i`
while min > 0 and nodes.nodes[min].ndx != nodes.nodes[i].stop_val:
min -= 1
min = 0 if min < dprog.MAX_NODE_DIST else min - dprog.MAX_NODE_DIST
# Check which nodes can be skipped
self._compute_skippable(min, i)
Expand Down

0 comments on commit b52c506

Please sign in to comment.