Skip to content

Commit

Permalink
Merge pull request #32 from openvar/develop_2_0
Browse files Browse the repository at this point in the history
Develop 2 0
  • Loading branch information
Peter J. Freeman authored May 12, 2022
2 parents 1baf789 + 3796474 commit 5973c52
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 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
10 changes: 4 additions & 6 deletions VariantFormatter/simpleVariantFormatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ def format(batch_input, genome_build, transcript_model=None, specify_transcripts
vcf_list = pseudo_vcf.split('-')
delimiter = '-'
if len(vcf_list) != 4:
formatted_variants[variant]['errors'].append(
'%s is an unsupported format: For assistance, submit variant description to '
'https://rest.variantvalidator.org') % pseudo_vcf
error = '%s is an unsupported format: For assistance, submit variant description to https://rest.variantvalidator.org' % str(pseudo_vcf)
formatted_variants[variant]['errors'].append(error)
formatted_variants[variant]['flag'] = 'submission_warning'
continue
if ',' in str(vcf_list[-1]):
Expand All @@ -71,9 +70,8 @@ def format(batch_input, genome_build, transcript_model=None, specify_transcripts
try:
format_these.append(variant)
except Exception:
formatted_variants[variant]['errors'].append(
'%s is an unsupported format: For assistance, submit variant description to '
'https://rest.variantvalidator.org') % variant
error = '%s is an unsupported format: For assistance, submit variant description to https://rest.variantvalidator.org' % variant
formatted_variants[variant]['errors'].append(error)
formatted_variants[variant]['flag'] = 'submission_warning'
continue

Expand Down
13 changes: 11 additions & 2 deletions VariantFormatter/variantformatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ 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"
elif ("NC_001807.4" in str(g_hgvs)) and "GRCh37" in genome_build:
gen_error = "NC_001807.4 is not associated with genome build GRCh37, instead use genome build hg19"
except TypeError:
pass

Expand Down Expand Up @@ -189,8 +191,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 +213,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 +442,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 5973c52

Please sign in to comment.