Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion VariantValidator/modules/format_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ def vcf2hgvs_stage1(variant, batch_list):
if vcf_data[3] == '.':
vcf_data[3] = ''

if re.search(r'[^CGAT]', vcf_data[2]) or re.search(r'[^CGAT,]', vcf_data[3]):
if (
not set(vcf_data[2]) <= {"A", "C", "G", "T"}
or not set(vcf_data[3]) <= {"A", "C", "G", "T", ","}
):
logger.debug("Completed VCF-HVGS step 1 for %s", variant.quibble)
return False

Expand Down
10 changes: 4 additions & 6 deletions VariantValidator/modules/hgvs_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,12 +625,10 @@ def pvcf_to_hgvs(query, selected_assembly, normalization_direction, reverse_norm
try:
input_list = query.split(':')
position_and_edit = input_list[1]
if not re.match(r'N[CGWT]_', query) and not re.match(r'LRG_\d+$', query):
chr_num = str(input_list[0])
chr_num = chr_num.upper()
chr_num = chr_num.strip()
if re.match(r'CHR', chr_num):
chr_num = chr_num.replace('CHR', '')
if not query.startswith(("NC_", "NG_", "NW_", "NT_")) and not re.fullmatch(r"LRG_\d+", query):
chr_num = input_list[0].strip().upper()
if chr_num.startswith("CHR"):
chr_num = chr_num[3:]
# Use selected assembly
accession = seq_data.get_accession(chr_num, selected_assembly)
if accession is None:
Expand Down
10 changes: 5 additions & 5 deletions VariantValidator/modules/use_checking.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ def pre_parsing_global_common_mistakes(my_variant):
logger.info(error)
return True


elif (
(
re.search(r'\(ENST\d+\.\d+\):', quibble)
or re.search(r'\(N[MRCG]_\d+\.\d+\):', quibble)
or re.search(r'\(LRG_\d+t\d+\):', quibble)
re.search(
r"\((?:ENST\d+\.\d+|N[MRCG]_\d+\.\d+|LRG_\d+t\d+)\):",
quibble,
)
and not quibble.startswith('NC_')
and not quibble.startswith("NC_")
):
reference_region, variation = quibble.split(':', 1)
reference = reference_region.split('(', 1)[1].replace(')', '')
Expand Down
26 changes: 14 additions & 12 deletions VariantValidator/modules/vvMixinCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,10 @@ def validate(self,
elif selected_assembly == 'hg38':
primary_assembly = 'GRCh38'
# Ensure genome build is correctly formatted
elif re.search('GRC', selected_assembly, re.IGNORECASE):
selected_assembly = selected_assembly.replace('g', 'G')
selected_assembly = selected_assembly.replace('r', 'R')
selected_assembly = selected_assembly.replace('c', 'C')
selected_assembly = selected_assembly.replace('H', 'h')
elif selected_assembly.upper().startswith("GRC"):
selected_assembly = (
selected_assembly[:3].upper() + selected_assembly[3:].lower()
)
primary_assembly = selected_assembly
# Catch invalid genome build
if primary_assembly in self.genome_builds or primary_assembly == 'hg38':
Expand Down Expand Up @@ -415,16 +414,19 @@ def validate(self,
if match:
result = match.group()

# Check if Ens submitted as RefSeq set and vice versa
if "ENST" in result and transcript_set == "refseq":
# Check if Ensembl transcript submitted as RefSeq set and vice versa
if result.startswith("ENST") and transcript_set == "refseq":
my_variant.warnings.append(
"InvalidFieldError: The transcript " + result + " is not in the RefSeq "
"data set. Please select Ensembl")
f"InvalidFieldError: The transcript {result} is not in the RefSeq "
"data set. Please select Ensembl"
)
continue
elif ("NM_" in result or "NR_" in result) and transcript_set == "ensembl":

elif result.startswith(("NM_", "NR_")) and transcript_set == "ensembl":
my_variant.warnings.append(
"InvalidFieldError: The transcript " + result + " is not in the Ensembl "
"data set. Please select RefSeq")
f"InvalidFieldError: The transcript {result} is not in the Ensembl "
"data set. Please select RefSeq"
)
continue
try:
to_code_or_not_to_code = self.hdp.get_tx_identity_info(result)
Expand Down
14 changes: 5 additions & 9 deletions VariantValidator/modules/vvMixinInit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import logging
import os
import re
from configparser import ConfigParser

import vvhgvs
Expand Down Expand Up @@ -606,14 +605,11 @@ def _remake_unc(
hgvs_protein.posedit.edit.alt
)

if re.search(r"\*[A-Z]+", protein_alt):
protein_alt = (
protein_alt.split("*")[0] + "*"
)

hgvs_protein.posedit.edit.alt = (
protein_alt
)
if "*" in protein_alt:
head, _, tail = protein_alt.partition("*")
if tail[:1].isupper():
protein_alt = head + "*"
hgvs_protein.posedit.edit.alt = protein_alt

except Exception:
pass
Expand Down
Loading