Skip to content

Commit

Permalink
Final changes to VF that deal with issue openvar/variantValidator#360
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Causey-Freeman committed Apr 27, 2022
1 parent 0083bf7 commit 1ab6c10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions VariantFormatter/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def vcf2hgvs_genomic(pseudo_vcf, genome_build, vfo):
pos = vcf_list[1]
ref = vcf_list[2]
alt = vcf_list[3]

# assemble the HGVS genomic description
ac = chr_dict.to_accession(chrom, genome_build)
if ac is None:
Expand Down
11 changes: 9 additions & 2 deletions VariantFormatter/variantformatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(self, p_vcf, g_hgvs, un_norm_hgvs, hgvs_ref_bases, gen_error, genom

# Warn incorrect m. accession for hg19
try:
if ("NC_012920.1" in str(g_hgvs) or "NC_001807.4" in gen_error) and "hg19" in genome_build:
if ("NC_012920.1" in str(g_hgvs)) and "hg19" in genome_build:
gen_error = "NC_012920.1 is not associated with genome build hg19, instead use genome build GRCh37"
except TypeError:
pass
Expand Down Expand Up @@ -189,8 +189,13 @@ def __init__(self, variant_description, genome_build, vfo, transcript_model=None
# Continuation - No exception
try:
vcf_dictionary = formatter.hgvs_genomic2vcf(hgvs_genomic, self.genome_build, self.vfo)
vcf_list = [vcf_dictionary['grc_chr'], vcf_dictionary['pos'], vcf_dictionary['ref'],
if vcf_dictionary['grc_chr'] == "NC_001807.4" and genome_build == "hg19":
chr_num = vcf_dictionary['ucsc_chr']
else:
chr_num = vcf_dictionary['grc_chr']
vcf_list = [chr_num, vcf_dictionary['pos'], vcf_dictionary['ref'],
vcf_dictionary['alt']]

p_vcf = ':'.join(vcf_list)
except Exception as e:
if "Variant span is outside sequence bounds" in str(e):
Expand All @@ -206,6 +211,7 @@ def __init__(self, variant_description, genome_build, vfo, transcript_model=None
self.genomic_descriptions = gds
self.warning_level = 'genomic_variant_warning'
return

try:
genomic_level = formatter.vcf2hgvs_genomic(p_vcf, self.genome_build, self.vfo)
except Exception as e:
Expand Down Expand Up @@ -434,6 +440,7 @@ def __init__(self, variant_description, genome_build, vfo, transcript_model=None
elif self.genomic_descriptions.selected_build == 'hg38' or self.genomic_descriptions.selected_build \
== 'GRCh38':
build_to = 'GRCh37'

current_lift = lo.liftover(self.genomic_descriptions.g_hgvs,
self.genomic_descriptions.selected_build,
build_to,
Expand Down

0 comments on commit 1ab6c10

Please sign in to comment.