diff --git a/gumpy/variantfile.py b/gumpy/variantfile.py index 2ed74c0..e66c5fd 100644 --- a/gumpy/variantfile.py +++ b/gumpy/variantfile.py @@ -1,6 +1,7 @@ """ Classes used to parse and store VCF data """ + import copy import pathlib import warnings @@ -81,9 +82,7 @@ def __init__(self, record: pysam.libcbcf.VariantRecord, sample: str | int): self.is_filter_pass = False else: self.filter = str(record.filter.items()[0][0]) - self.is_filter_pass = ( - True if record.filter.items()[0][0] == "PASS" else False - ) + self.is_filter_pass = True if record.filter.items()[0][0] == "PASS" else False # Get the info field self.info = {} @@ -378,9 +377,7 @@ def _find_minor_populations(self): simple_calls.append((idx, pos, t, bases)) seen = [] - allelic_depth_tag = ( - "COV" if "COV" in self.format_fields_metadata.keys() else "AD" - ) + allelic_depth_tag = "COV" if "COV" in self.format_fields_metadata.keys() else "AD" for idx, type_ in self.calls.keys(): # Check if we've delt with this vcf already @@ -523,7 +520,9 @@ def __find_calls(self): variant_type = "ref" if index in record_positions: - raise ValueError("Multiple calls at position " + str(index) + " in VCF file") + raise ValueError( + "Multiple calls at position " + str(index) + " in VCF file" + ) record_positions.add(index) # if the REF, ALT pair are the same length, check if we can decompose @@ -801,9 +800,7 @@ def __get_variants(self): alts.append(alt) variants.append(variant) for key in self.calls[(index, type_)]["original_vcf_row"]: - metadata[key].append( - self.calls[(index, type_)]["original_vcf_row"][key] - ) + metadata[key].append(self.calls[(index, type_)]["original_vcf_row"][key]) # Remove ref calls as required for key in to_drop: