Skip to content

Commit a4f1ee6

Browse files
Merge pull request #675 from openvar/develop
Develop
2 parents 06fc570 + fd64084 commit a4f1ee6

File tree

4 files changed

+41
-6
lines changed

4 files changed

+41
-6
lines changed

VariantValidator/modules/complex_descriptions.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,15 @@ def uncertain_positions(my_variant, validator):
281281
if not re.search("[gcnr].\(", my_variant.quibble):
282282
return
283283

284+
# Check for LRGs
285+
hgvs_accession, variation = my_variant.quibble.split(":")
286+
if "LRG" in hgvs_accession:
287+
if "t" in hgvs_accession:
288+
hgvs_accession = validator.db.get_refseq_transcript_id_from_lrg_transcript_id(hgvs_accession)
289+
else:
290+
hgvs_accession = validator.db.get_refseq_id_from_lrg_id(hgvs_accession)
291+
my_variant.quibble = f"{hgvs_accession}:{variation}"
292+
284293
# Formats like NC_000005.9:g.(90136803_90144453)_(90159675_90261231)dup
285294
if ")_(" in my_variant.quibble and "?" not in my_variant.quibble:
286295
accession, _sep, var_type_and_posedit = my_variant.quibble.partition(':')
@@ -311,6 +320,7 @@ def uncertain_positions(my_variant, validator):
311320
end=end)
312321
except vvhgvs.exceptions.HGVSError as e:
313322
raise HgvsParseError(str(e))
323+
314324
try:
315325
validator.vr.validate(parsed_v1)
316326
except vvhgvs.exceptions.HGVSError as e:

VariantValidator/modules/format_converters.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,13 @@ def intronic_converter(variant, validator, skip_check=False, uncertain=False):
812812
pass
813813
elif "does not agree with reference sequence" in str(e):
814814
previous_exception = e
815+
try:
816+
check_g = validator.vm.t_to_g(hgvs_transy, hgvs_genomic.ac,
817+
alt_aln_method=validator.alt_aln_method)
818+
validator.vm.g_to_t(check_g, hgvs_transy.ac, alt_aln_method=validator.alt_aln_method)
819+
except vvhgvs.exceptions.HGVSError as e:
820+
if "start or end or both are beyond the bounds of transcript record" in str(e):
821+
raise
815822
try:
816823
variant.hn.normalize(hgvs_transy)
817824
except vvhgvs.exceptions.HGVSUnsupportedOperationError as e:
@@ -834,8 +841,8 @@ def intronic_converter(variant, validator, skip_check=False, uncertain=False):
834841
else:
835842
variant.warnings.append(f'ExonBoundaryError: {hgvs_transy.posedit.pos} does not match the exon '
836843
f'boundaries for the alignment of {hgvs_transy.ac} to {hgvs_genomic.ac}')
837-
except vvhgvs.exceptions.HGVSError:
838-
pass
844+
except vvhgvs.exceptions.HGVSError as e:
845+
pass
839846

840847
logger.debug("HVGS typesetting complete")
841848

VariantValidator/modules/vvMixinCore.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,8 @@ def validate(self,
341341
select_transcripts_dict_plus_version)
342342

343343
except vvhgvs.exceptions.HGVSError as e:
344-
import traceback
345-
traceback.print_exc()
344+
# import traceback
345+
# traceback.print_exc()
346346
checkref = str(e)
347347
try:
348348
# Test intronic variants for incorrect boundaries (see issue #169)
@@ -1081,8 +1081,12 @@ def validate(self,
10811081
variant.gene_symbol = self.db.get_gene_symbol_from_transcript_id(
10821082
variant.hgvs_transcript_variant.ac)
10831083
elif variant.hgvs_refseqgene_variant and variant.gene_symbol == '':
1084-
variant.gene_symbol = self.db.get_gene_symbol_from_refseq_id(
1085-
variant.hgvs_refseqgene_variant.ac)
1084+
try:
1085+
variant.gene_symbol = self.db.get_gene_symbol_from_refseq_id(
1086+
variant.hgvs_refseqgene_variant.ac)
1087+
except AttributeError:
1088+
variant.gene_symbol = self.db.get_gene_symbol_from_refseq_id(
1089+
variant.hgvs_refseqgene_variant.split(":")[0])
10861090

10871091
# Add stable gene_ids
10881092
stable_gene_ids = {}

tests/test_warnings.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,13 @@ def test_issue_338h(self):
166166
assert 'because no reference sequence ID has been provided' in \
167167
results['NM_000088.3:c.589G>T']['validation_warnings'][0]
168168

169+
def test_issue_673a(self):
170+
variant = 'NC_000001.10(NM_001128425.1):c.35+11000000C>T'
171+
results = self.vv.validate(variant, 'GRCh38', 'all', liftover_level='primary').format_as_dict(test=True)
172+
print(results)
173+
assert 'start or end or both are beyond the bounds of transcript record' in \
174+
results['validation_warning_1']['validation_warnings']
175+
169176
def test_issue_359(self):
170177
variant = 'NM_001371623.1:c.483ins'
171178
results = self.vv.validate(variant, 'GRCh37', 'all', liftover_level='primary').format_as_dict(test=True)
@@ -535,6 +542,13 @@ def test_uncertain_5(self):
535542
assert "Position 90159675_90261231 is > or overlaps 90136803_90144453" in results[
536543
'validation_warning_1']["validation_warnings"]
537544

545+
def test_uncertain_6(self):
546+
variant = 'LRG_199t1:c.(6278_6293-1)_(7542+49_757000005)dup'
547+
results = self.vv.validate(variant, 'GRCh38', 'all').format_as_dict(test=True)
548+
print(results)
549+
assert "Variant coordinate is out of the bound of CDS region (CDS length : 11058)" in results[
550+
'validation_warning_1']["validation_warnings"]
551+
538552
def test_uncertain_fuzzy_1(self):
539553
variant = 'NC_000002.12:g.(?_187315204)_(192885646_?)del'
540554
results = self.vv.validate(variant, 'GRCh38', 'all').format_as_dict(test=True)

0 commit comments

Comments
 (0)