From e55c857793a9d340e200a5ff3cd6dbf878f3488f Mon Sep 17 00:00:00 2001 From: Matthew Colpus Date: Fri, 15 Mar 2024 12:35:39 +0000 Subject: [PATCH] fix: only clash for different vcf rows --- gumpy/variantfile.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gumpy/variantfile.py b/gumpy/variantfile.py index 21f76b3..d1ec4f0 100644 --- a/gumpy/variantfile.py +++ b/gumpy/variantfile.py @@ -567,14 +567,15 @@ def __find_calls(self): calls.append((index + p, variant_type, metadata)) # Convert calls to dict, checking for clashes - positions = set() + positions = {} self.calls = {} for pos, type_, metadata in calls: if pos in positions: - raise ValueError( - "Multiple calls at position " + str(pos) + " in VCF file" - ) - positions.add(pos) + if positions[pos] != metadata["original_vcf_row"]: + raise ValueError( + "Multiple calls at position " + str(pos) + " in VCF file" + ) + positions[pos] = metadata["original_vcf_row"] self.calls[(pos, type_)] = metadata def _simplify_call(self, ref: str, alt: str) -> List[Tuple[int, str, str]]: