Skip to content

Commit

Permalink
Fixes #602: Fixed bug in transcript bounds check that caused n. varia…
Browse files Browse the repository at this point in the history
…nts outside bounds to be deemed valid
  • Loading branch information
reece committed Jun 23, 2020
1 parent 376f8ac commit c05c85f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hgvs/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def validate(self, var, strict=None):
var_n = var
elif var.type == "c":
var_n = self.vm.c_to_n(var)

if var_n is not None:
res, msg = self._n_within_transcript_bounds(var_n)
if res != ValidationLevel.VALID:
Expand Down Expand Up @@ -166,9 +167,9 @@ def _n_within_transcript_bounds(self, var):
if tx_info is None:
return (ValidationLevel.WARNING,
"No transcript data for accession: {ac}".format(ac=var.ac))
if var.posedit.pos.start.datum == Datum.SEQ_START and var.posedit.pos.end.base <= 0:
if var.posedit.pos.start.datum == Datum.SEQ_START and var.posedit.pos.start.base <= 0:
return (ValidationLevel.ERROR, TX_BOUND_ERROR_MSG.format())
if var.posedit.pos.end.datum == Datum.SEQ_START and var.posedit.pos.start.base > tx_len:
if var.posedit.pos.end.datum == Datum.SEQ_START and var.posedit.pos.end.base > tx_len:
return (ValidationLevel.ERROR, TX_BOUND_ERROR_MSG.format())
return (ValidationLevel.VALID, None)

Expand Down

0 comments on commit c05c85f

Please sign in to comment.