diff --git a/mutalyzer/variantchecker.py b/mutalyzer/variantchecker.py index 0268b5d0f3343fd1ff9cf2885a8925b57abfd657..4068cba0424ad8aa16e241d76a88c941d72e71dc 100644 --- a/mutalyzer/variantchecker.py +++ b/mutalyzer/variantchecker.py @@ -36,6 +36,7 @@ class _NotDNAError(_RawVariantError): pass class _PositionsNotConsecutiveError(_RawVariantError): pass class _LengthMismatchError(_RawVariantError): pass class _ReferenceMismatchError(_RawVariantError): pass +class _RangeInsertionError(_RawVariantError): pass class _OffsetSignError(_RawVariantError): def __init__(self, main, offset, acceptor): self.main = main @@ -136,9 +137,9 @@ def _check_argument(argument, reference, first, last, output): @raise _LengthMismatchError: The argument is a length, but it does not match the given range length. - @raise NotDNAError: The argument should be DNA, but it is not. - @raise ReferenceMismatchError: The argument is DNA, but it does not - match the given reference. + @raise _NotDNAError: The argument should be DNA, but it is not. + @raise _ReferenceMismatchError: The argument is DNA, but it does not + match the given reference. """ if not argument: # The argument is optional, if it is not present, it is correct. @@ -1047,6 +1048,14 @@ def process_raw_variant(mutator, variant, record, transcript, output): if variant.MutationType in ['del', 'dup', 'subst', 'delins']: _check_argument(argument, mutator.orig, first, last, output) + # Check if the inserted sequence is not a range. + # Todo: Implement this feature. + if variant.MutationType in ['ins', 'delins']: + if not argument: + output.addMessage(__file__, 4, 'ENOTIMPLEMENTED', + 'Insertion of a range is not implemented yet.') + raise _RangeInsertionError() + # Substitution. if variant.MutationType == 'subst': apply_substitution(first, argument, sequence, mutator, record, output) diff --git a/tests/test_variantchecker.py b/tests/test_variantchecker.py index 1fba607f8811afb84ce1bb2b663a3b1fc7071f76..be4c39bf5e585aa445850091e5f7e2cd5ba84dba 100644 --- a/tests/test_variantchecker.py +++ b/tests/test_variantchecker.py @@ -337,3 +337,17 @@ class TestVariantchecker(): # Todo: For now, the following is how to check if protein # prediction is done. assert self.output.getOutput('newprotein') + + def test_ins_range(self): + """ + Insertion of a range is not implemented yet. + """ + check_variant('AB026906.1:c.274_275ins262_268', self.config, self.output) + assert_equal(len(self.output.getMessagesWithErrorCode('ENOTIMPLEMENTED')), 1) + + def test_delins_range(self): + """ + Deletion/insertion of a range is not implemented yet. + """ + check_variant('AB026906.1:c.274delins262_268', self.config, self.output) + assert_equal(len(self.output.getMessagesWithErrorCode('ENOTIMPLEMENTED')), 1)