Skip to content

Commit

Permalink
fix bug when terminating strict branching with an maf threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
aryarm committed Jun 2, 2024
1 parent c3a56d7 commit 0d38703
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion happler/tree/tree_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,15 @@ def _find_split_rigid(
else:
best_allele_idx = np.searchsorted(maf_mask[allele], maf_mask[best_allele][best_res_idx])
# if the best variant was filtered out for this allele due to low MAF
if best_allele_idx >= len(results[allele].data):
# searchsorted() will return an index at the end of the array or the
# wrong index
if best_allele_idx >= len(maf_mask[allele]) or (
maf_mask[allele][best_allele_idx] != maf_mask[best_allele][best_res_idx]
):
self.log.debug(
f"Ignoring variant {best_variant.id} / allele {allele} because"
" it results in a haplotype with low MAF"
)
yield None, allele, None
continue
best_results = results[allele].data[best_allele_idx]
Expand Down

0 comments on commit 0d38703

Please sign in to comment.