Skip to content

Commit

Permalink
fetch not-inside edge case
Browse files Browse the repository at this point in the history
chromosomes without regions to not-fetch weren't being fetched
  • Loading branch information
ACEnglish committed Feb 3, 2025
1 parent ad2af56 commit a211521
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions imgs/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions truvari/region_vcf_iter.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,17 @@ def region_filter_stream(vcf, tree, inside=True, with_region=False):
The region associated with the entry can be retuned also when using with_region.
with_region returns (entry, (chrom, Interval))
"""
chroms = sorted(tree.keys())
if not inside:
chroms = sorted(list(vcf.header.contigs))
else:
chroms = sorted(tree.keys())
ret_type = (lambda x, y, z: (x, (y, z))
) if with_region else (lambda x, y, z: x)
for chrom in chroms:
cur_tree = deque(sorted(tree[chrom]))
try:
cur_intv = cur_tree.popleft()
except IndexError:
except (IndexError, KeyError):
# region-less chromosome
if not inside:
try:
Expand Down

0 comments on commit a211521

Please sign in to comment.