Skip to content

Commit 77648ce

Browse files
committed
gene_caller: End gene region when encountering high intergenic signal
1 parent 7af9490 commit 77648ce

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

src/geneml/gene_caller.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
MODEL_CDS_START,
1010
MODEL_EXON_END,
1111
MODEL_EXON_START,
12+
MODEL_INTERGENIC,
1213
MODEL_IS_EXON,
1314
MODEL_IS_INTRON,
1415
)
@@ -127,7 +128,16 @@ def get_end_idx(start_idx: int, events: list[GeneEvent], preds: np.ndarray) -> i
127128
pos = start_pos
128129
num_good_bases = 0
129130
last_good_base = None
131+
consecutive_intergenic = 0
130132
while pos < len(preds[0]):
133+
# Check for strong intergenic signal
134+
if preds[MODEL_INTERGENIC, pos] > 0.8:
135+
consecutive_intergenic += 1
136+
if consecutive_intergenic >= 20:
137+
break
138+
else:
139+
consecutive_intergenic = 0
140+
131141
if preds[MODEL_IS_EXON, pos] > 0.2 or preds[MODEL_IS_INTRON, pos] > 0.2:
132142
num_good_bases += 1
133143
last_good_base = pos

src/geneml/model_loader.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import numpy as np
55
from keras.src.saving import load_model
66

7+
MODEL_INTERGENIC = 0
78
MODEL_EXON_START = 1
89
MODEL_EXON_END = 2
910
MODEL_CDS_START = 3

0 commit comments

Comments
 (0)