Skip to content

Commit

Permalink
raise ValueError for same ref/alt
Browse files Browse the repository at this point in the history
  • Loading branch information
newgene committed Apr 22, 2021
1 parent 6067b31 commit 96b1b25
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/utils/hgvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ def _normalized_vcf(chr, pos, ref, alt):
# _ref/_alt cannot be both None, if so,
# ref and alt are exactly the same,
# something is wrong with this VCF record
assert not (_ref is None and _alt is None)
# assert not (_ref is None and _alt is None)
if (_ref is None and _alt is None):
raise ValueError('"ref" and "alt" cannot be the same: {}'.format(
(chr, pos, ref, alt)
))

_pos = int(pos)
if _ref is None or _alt is None:
Expand Down Expand Up @@ -151,7 +155,7 @@ def get_pos_start_end(chr, pos, ref, alt):
start = pos + 1
end = pos + len(ref) - 1
if start == end:
end += 1 # end is start+1 for single nt deletion
end += 1 # end is start+1 for single nt deletion
# TODO: double-check this is the right convention
elif len(ref) == 1 and len(alt) > 1:
# this is a insertion
Expand Down

0 comments on commit 96b1b25

Please sign in to comment.