From 624d72abca45f31a8391eede5b02acefc8282ed2 Mon Sep 17 00:00:00 2001 From: Adam English Date: Fri, 10 Jan 2025 19:25:01 -0500 Subject: [PATCH] entry.within edge case Variants on chromosomes not in a tree return false --- truvari/variant_record.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/truvari/variant_record.py b/truvari/variant_record.py index 60f717a5..db9a2ba2 100644 --- a/truvari/variant_record.py +++ b/truvari/variant_record.py @@ -960,6 +960,8 @@ def within_tree(self, tree): Extract entry and tree boundaries to call `truvari.coords_within` """ qstart, qend = self.boundaries() + if self.chrom not in tree: + return False m_ovl = tree[self.chrom].overlap(qstart, qend) if len(m_ovl) != 1: return False