def matched_variants() -> List[Tuple[Variant, Dict[str, str]]]: return [ # snp ( Variant("22", 29083907, 29083907, "G", "A", id="VCV000422506.2"), { "symbol": "CHEK2", "hgvs_c": "NM_007194.4:c.1610C>T" }, ), # deletion ( Variant("22", 50967717, 50967719, "AGG", "A", id="VCV000223079.1"), { "symbol": "TYMP", "hgvs_c": "NM_001953.4:c.263_264del" }, ), # indel ( Variant("22", 51065766, 51065767, "GA", "AG", id="VCV000003062.1"), { "symbol": "ARSA", "hgvs_c": "NM_001085428.2:c.34_35delTCinsCT" }, ), ]
def test_variant_is_deletion( snp: Variant, insertion: Variant, deletion: Variant, sv: Variant ): assert not snp.is_deletion() assert not insertion.is_deletion() assert deletion.is_deletion() assert not sv.is_deletion()
def test_warn_ref_mismatch(clinvar_tabix, caplog): # wrong ref should still match the clinvar but with a warning cols = clinvar_tabix.header[0][len("#"):].split("\t") v_wrong_ref = Variant("22", 29083907, 29083907, "C", "A") record = CharGer._match_clinvar_one_variant(v_wrong_ref, clinvar_tabix, cols) assert record is not None assert ("got a clinvar match but their reference alleles are different" in caplog.text)
def not_found_variants() -> List[Variant]: return [ Variant("22", 29083907, 29083907, "G", "T"), Variant("22", 50967718, 50967719, "GG", "G"), Variant("22", 51065766, 51065767, "GA", "C"), ]
def grch38_vep95_annotated_variants_info_fixed(test_root: Path) -> List[Variant]: return list( Variant.read_and_parse_vcf( test_root.joinpath("examples/grch38_vep95_50_variants.info_fixed.vcf.gz") ) )
def grch37_vep85_annotated_variants(test_root: Path): return list( Variant.read_and_parse_vcf( test_root / "examples" / "grch37_vep85_5_variants.vcf" ) )
def sv() -> Variant: return Variant("1", 2827693, 2827701, "CCCCTCGCA", "C", info={"SVTYPE": "DEL"})
def deletion() -> Variant: return Variant("1", 42, 44, "ATA", "A")
def insertion() -> Variant: return Variant("1", 42, 42, "A", "ATAT")
def snp() -> Variant: return Variant("1", 42, 42, "A", "G")
def test_read_vcf_detect_vep_version( test_root: Path, caplog, vcf_pth: Path, vep_ver: int ): reader = Variant.read_and_parse_vcf(test_root.joinpath(vcf_pth)) next(reader) assert f"VEP version {vep_ver}" in caplog.text
def charger_result(test_root: Path): variant = next( Variant.read_and_parse_vcf(test_root / "examples" / "grch37_vep85_5_variants.vcf")) return CharGerResult(variant)