diff --git a/.DS_Store b/.DS_Store index 46b5e80..a2308d9 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/VariantFormatter/formatter.py b/VariantFormatter/formatter.py index e9effac..6197b3c 100644 --- a/VariantFormatter/formatter.py +++ b/VariantFormatter/formatter.py @@ -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: diff --git a/VariantFormatter/simpleVariantFormatter.py b/VariantFormatter/simpleVariantFormatter.py index 36186c8..65185e7 100644 --- a/VariantFormatter/simpleVariantFormatter.py +++ b/VariantFormatter/simpleVariantFormatter.py @@ -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]): @@ -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 diff --git a/VariantFormatter/variantformatter.py b/VariantFormatter/variantformatter.py index 2ebc8ef..a360af0 100644 --- a/VariantFormatter/variantformatter.py +++ b/VariantFormatter/variantformatter.py @@ -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 @@ -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): @@ -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: @@ -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,