diff --git a/mutalyzer/grammar.py b/mutalyzer/grammar.py index 49388f75d8f4ed2de9f35076deea5559d98cfd01..f2a1b830bd24066753607abc743c3e21616fcfed 100644 --- a/mutalyzer/grammar.py +++ b/mutalyzer/grammar.py @@ -205,18 +205,26 @@ class Grammar(): Suppress(']')) ^ (RangeLoc + Suppress('[') + Number + \ Suppress(']')) ^ AbrSSR - # BNF: Ins -> RangeLoc `ins' (Nt+ | Number | RangeLoc | FarLoc) Nest? - Ins = RangeLoc + Literal('ins')('MutationType') + \ - ((NtString ^ Number)('Arg1') ^ RangeLoc ^ \ - FarLoc('OptRef')) + Optional(Nest) + # BNF: Seq -> (Nt+ | Number | RangeLoc | FarLoc) Nest? + Seq = Group(NtString('Sequence') ^ Number ^ RangeLoc('Range') ^ \ + FarLoc('OptRef') + Optional(Nest))('Seq') + + # BNF: SeqList -> Seq (`;' Seq)* + SeqList = delimitedList(Seq, delim=';')('SeqList') + + # BNF: SimpleSeqList -> (`[' SeqList `]') | Seq + SimpleSeqList = Suppress('[') + SeqList + Suppress(']') ^ Seq + + # BNF: Ins -> RangeLoc `ins' SimpleSeqList + Ins = RangeLoc + Literal('ins')('MutationType') + SimpleSeqList # BNF: Indel -> (RangeLoc | PtLoc) `del' (Nt+ | Number)? - # `ins' (Nt+ | Number | RangeLoc | FarLoc) Nest? + # `ins' SimpleSeqList # Note that the alternative PtLoc is not included in [3]. Indel = (RangeLoc ^ Group(PtLoc('PtLoc'))('StartLoc')) + Literal('del') + \ Optional(NtString ^ Number)('Arg1') + \ Literal('ins').setParseAction(replaceWith('delins'))('MutationType') + \ - ((NtString ^ Number)('Arg2') ^ RangeLoc ^ FarLoc) + Optional(Nest) + SimpleSeqList # BNF: Inv -> RangeLoc `inv' (Nt+ | Number)? Nest? Inv = RangeLoc + Literal('inv')('MutationType') + \ diff --git a/mutalyzer/mapping.py b/mutalyzer/mapping.py index ed751d0829728a814a900ea96112a56712ff5cdb..9a059a68441631c6a645d2c93201385e2ab80372 100644 --- a/mutalyzer/mapping.py +++ b/mutalyzer/mapping.py @@ -56,10 +56,27 @@ def _construct_change(var, reverse=False): arg1 = var.Arg1 arg2 = var.Arg2 + def parse_sequence(seq): + if not seq.Sequence: + raise NotImplementedError('Only explicit sequences are supported ' + 'for insertions.') + if reverse: + return reverse_complement(str(seq.Sequence)) + return seq.Sequence + if var.MutationType == 'subst': change = '%s>%s' % (arg1, arg2) - elif var.MutationType == 'delins' and arg2: - change = '%s%s' % (var.MutationType, arg2) + elif var.MutationType in ('ins', 'delins'): + if var.SeqList: + if reverse: + seqs = reversed(var.SeqList) + else: + seqs = var.SeqList + insertion = '[' + ';'.join(str(parse_sequence(seq)) + for seq in seqs) + ']' + else: + insertion = parse_sequence(var.Seq) + change = '%s%s' % (var.MutationType, insertion) else: change = '%s%s' % (var.MutationType, arg1 or arg2 or '') @@ -506,8 +523,14 @@ class Converter(object) : # Construct the variant descriptions descriptions = [] for variant, mapping in zip(variants, mappings): - f_change = _construct_change(variant) - r_change = _construct_change(variant, reverse=True) + try: + f_change = _construct_change(variant) + r_change = _construct_change(variant, reverse=True) + except NotImplementedError as e: + self.__output.addMessage(__file__, 3, 'ENOTIMPLEMENTED', + str(e)) + return None + if self.mapping.orientation == 'forward': change = f_change else : @@ -723,8 +746,13 @@ class Converter(object) : mutations = [] for variant, cmap in zip(variants, core_mapping): - f_change = _construct_change(variant) - r_change = _construct_change(variant, reverse=True) + try: + f_change = _construct_change(variant) + r_change = _construct_change(variant, reverse=True) + except NotImplementedError as e: + self.__output.addMessage(__file__, 4, + "ENOTIMPLEMENTEDERROR", str(e)) + return None startp = self.crossmap.tuple2string((cmap.startmain, cmap.startoffset)) endp = self.crossmap.tuple2string((cmap.endmain, cmap.endoffset)) diff --git a/mutalyzer/variantchecker.py b/mutalyzer/variantchecker.py index 30bbbfc226f5aa4ccb7cd4c1078c542229c45ac8..18412996209a1d388c3954b9913b758bb6fd9daf 100644 --- a/mutalyzer/variantchecker.py +++ b/mutalyzer/variantchecker.py @@ -1185,25 +1185,74 @@ def process_raw_variant(mutator, variant, record, transcript, output): if variant.MutationType == 'inv': apply_inversion(first, last, mutator, record, output) - # Insertion. - if variant.MutationType == 'ins': - # Check if the inserted sequence is not a range. - # Todo: Implement this feature. - if not argument: - output.addMessage(__file__, 4, 'ENOTIMPLEMENTED', - 'Insertion of a range is not implemented yet.') - raise _RangeInsertionError() - apply_insertion(first, last, argument, mutator, record, output) - - # DelIns. - if variant.MutationType == 'delins': - # Check if the inserted sequence is not a range. - # Todo: Implement this feature. - if not sequence: - output.addMessage(__file__, 4, 'ENOTIMPLEMENTED', - 'Insertion of a range is not implemented yet.') - raise _RangeInsertionError() - apply_delins(first, last, sequence, mutator, record, output) + # Parse a Seq object containing a Sequence or a Range into a string. + def parse_sequence(seq): + if seq.Sequence: + if transcript and transcript.CM.orientation == -1: + return Bio.Seq.reverse_complement(str(seq.Sequence)) + return seq.Sequence + + if seq.StartLoc and seq.EndLoc: + if transcript: + output.addMessage(__file__, 4, 'ENOTIMPLEMENTED', + 'The insertion of a range is only supported ' + 'with genomic positioning.') + raise _RangeInsertionError() + + try: + range_first, range_last = _genomic_to_genomic( + seq.StartLoc.PtLoc, seq.EndLoc.PtLoc) + except _UnknownPositionError: + output.addMessage(__file__, 4, 'EUNKNOWN', + 'Unknown positions (denoted by "?") are ' + 'not supported.') + raise + except _RawVariantError: + output.addMessage(__file__, 4, 'EPOSITION', + 'Could not determine range.') + raise + + if range_last < range_first: + output.addMessage(__file__, 3, 'ERANGE', + 'End position is smaller than the begin ' + 'position.') + raise _RawVariantError() + + if range_first < 1: + output.addMessage(__file__, 4, 'ERANGE', + 'Position %i is out of range.' % range_first) + raise _RawVariantError() + + if range_last > len(mutator.orig): + output.addMessage(__file__, 4, 'ERANGE', + 'Position %s is out of range.' % range_last) + raise _RawVariantError() + + return mutator.orig[range_first - 1:range_last] + + output.addMessage(__file__, 4, 'ENOTIMPLEMENTED', + 'Only the insertion of a sequence or a range is ' + 'implemented.') + raise _RawVariantError() + + if variant.MutationType in ('ins', 'delins'): + if variant.SeqList: + if transcript and transcript.CM.orientation == -1: + seqs = reversed(variant.SeqList) + else: + seqs = variant.SeqList + insertion = ''.join(str(parse_sequence(seq)) + for seq in seqs) + else: + insertion = parse_sequence(variant.Seq) + + # Insertion. + if variant.MutationType == 'ins': + apply_insertion(first, last, insertion, mutator, record, output) + + # DelIns. + if variant.MutationType == 'delins': + apply_delins(first, last, insertion, mutator, record, output) #process_raw_variant diff --git a/tests/fixtures.py b/tests/fixtures.py index e25d018dc5b5b2392cb5170bd42bcae47063b4a1..595d72a663e3ec06a6df748f3d21e6aa4a8019ee 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -245,6 +245,21 @@ def hg19_transcript_mappings(): cds=(111957632, 111965694), select_transcript=False, version=2)) + session.add(TranscriptMapping( + chromosome_11, + 'refseq', + 'NM_012459', + 'TIMM8B', + 'reverse', + 111955524, + 111957522, + [111955524, 111957364], + [111956186, 111957522], + 'ncbi', + transcript=1, + cds=(111956019, 111957492), + select_transcript=False, + version=2)) session.add(TranscriptMapping( chromosome_11, 'refseq', diff --git a/tests/test_grammar.py b/tests/test_grammar.py index f9bf9ec9c637355bfa8abcef5a73afc353b8b38f..4072549e3581db9656131d7d3ef8af2e7d6618fc 100644 --- a/tests/test_grammar.py +++ b/tests/test_grammar.py @@ -41,6 +41,34 @@ class TestGrammar(MutalyzerTest): self._parse('NM_002001.2:c.[(12del;12del)]') self._parse('NM_002001.2:c.[((12del)?;12del)?]') + def test_compound_insertion(self): + """ + Some some compound insertions. + """ + self._parse('NM_002001.2:c.15_16insA') + self._parse('NM_002001.2:c.15_16insATC') + self._parse('NM_002001.2:c.15_16ins[A]') + self._parse('NM_002001.2:c.15_16ins[ATC]') + self._parse('NM_002001.2:c.15_16ins28_39') + self._parse('NM_002001.2:c.15_16ins[28_39]') + self._parse('NM_002001.2:c.15_16ins[28_39;A]') + self._parse('NM_002001.2:c.15_16ins[28_39;ATC]') + self._parse('NM_002001.2:c.15_16ins[28_39;A;ATC]') + + def test_compound_delins(self): + """ + Some some compound deletion-insertions. + """ + self._parse('NM_002001.2:c.12_17delinsA') + self._parse('NM_002001.2:c.12_17delinsATC') + self._parse('NM_002001.2:c.12_17delins[A]') + self._parse('NM_002001.2:c.12_17delins[ATC]') + self._parse('NM_002001.2:c.12_17delins28_39') + self._parse('NM_002001.2:c.12_17delins[28_39]') + self._parse('NM_002001.2:c.12_17delins[28_39;A]') + self._parse('NM_002001.2:c.12_17delins[28_39;ATC]') + self._parse('NM_002001.2:c.12_17delins[28_39;A;ATC]') + def test_protein_variants(self): """ Some protein variants. diff --git a/tests/test_mapping.py b/tests/test_mapping.py index 4b2af7d4107dd44309012ee0f40ebbd5dcd2d8f1..3acb53cbd279f113888a2582741e8ed91736a798 100644 --- a/tests/test_mapping.py +++ b/tests/test_mapping.py @@ -301,3 +301,37 @@ class TestConverter(MutalyzerTest): genomic = converter.c2chrom('NM_017780.2(CHD8):c.109A>T') erange = self.output.getMessagesWithErrorCode('EACCNOTINDB') assert_equal(len(erange), 1) + + def test_ins_seq_chrom2c(self): + """ + Insertion of a sequence (chrom2c). + """ + converter = self._converter('hg19') + coding = converter.chrom2c('NC_000011.9:g.111957482_111957483insGAT', 'list') + assert 'NM_003002.2:c.-150_-149insGAT' in coding + assert 'NM_012459.2:c.10_11insATC' in coding + + def test_ins_seq_seq(self): + """ + Insertion of two sequences (chrom2c). + """ + converter = self._converter('hg19') + coding = converter.chrom2c('NC_000011.9:g.111957482_111957483ins[GAT;AAA]', 'list') + assert 'NM_003002.2:c.-150_-149ins[GAT;AAA]' in coding + assert 'NM_012459.2:c.10_11ins[TTT;ATC]' in coding + + def test_ins_seq_c2chrom_reverse(self): + """ + Insertion of a sequence on reverse strand (c2chrom). + """ + converter = self._converter('hg19') + genomic = converter.c2chrom('NM_012459.2:c.10_11insATC') + assert_equal(genomic, 'NC_000011.9:g.111957482_111957483insGAT') + + def test_ins_seq_seq_c2chrom_reverse(self): + """ + Insertion of two sequences on reverse strand (c2chrom). + """ + converter = self._converter('hg19') + genomic = converter.c2chrom('NM_012459.2:c.10_11ins[TTT;ATC]') + assert_equal(genomic, 'NC_000011.9:g.111957482_111957483ins[GAT;AAA]') diff --git a/tests/test_variantchecker.py b/tests/test_variantchecker.py index 7049fc3fa1a93ec03f5377021b575857a1e81e5d..4f4351585aaee48120032f63090ade94f83887e4 100644 --- a/tests/test_variantchecker.py +++ b/tests/test_variantchecker.py @@ -65,6 +65,21 @@ class TestVariantchecker(MutalyzerTest): in self.output.getOutput('protDescriptions') assert self.output.getOutput('newprotein') + @fix(cache('AL449423.14')) + def test_insertion_list_in_frame(self): + """ + Simple in-frame insertion of a list should give a simple description + on protein level. + """ + check_variant('AL449423.14(CDKN2A_v001):c.161_162ins[ATC]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'AL449423.14:g.61938_61939insGAT') + assert 'AL449423.14(CDKN2A_v001):c.161_162insATC' \ + in self.output.getOutput('descriptions') + assert 'AL449423.14(CDKN2A_i001):p.(Met54delinsIleSer)' \ + in self.output.getOutput('protDescriptions') + assert self.output.getOutput('newprotein') + @fix(cache('AL449423.14')) def test_deletion_insertion_in_frame(self): """ @@ -81,6 +96,22 @@ class TestVariantchecker(MutalyzerTest): in self.output.getOutput('protDescriptions') assert self.output.getOutput('newprotein') + @fix(cache('AL449423.14')) + def test_deletion_insertion_list_in_frame(self): + """ + Simple in-frame deletion-insertion of a list should give a simple + description on protein level. + """ + check_variant('AL449423.14(CDKN2A_v001):c.161_162delins[ATCCC]', + self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'AL449423.14:g.61938_61939delinsGGGAT') + assert 'AL449423.14(CDKN2A_v001):c.161_162delinsATCCC' \ + in self.output.getOutput('descriptions') + assert 'AL449423.14(CDKN2A_i001):p.(Met54delinsAsnPro)' \ + in self.output.getOutput('protDescriptions') + assert self.output.getOutput('newprotein') + @fix(cache('AL449423.14')) def test_deletion_insertion_in_frame_complete(self): """ @@ -97,6 +128,23 @@ class TestVariantchecker(MutalyzerTest): in self.output.getOutput('protDescriptions') assert self.output.getOutput('newprotein') + @fix(cache('AL449423.14')) + def test_deletion_insertion_list_in_frame_complete(self): + """ + Simple in-frame deletion-insertion of a list should give a simple + description on protein level, also with the optional deleted sequence + argument. + """ + check_variant('AL449423.14(CDKN2A_v001):c.161_162delTGins[ATCCC]', + self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'AL449423.14:g.61938_61939delinsGGGAT') + assert 'AL449423.14(CDKN2A_v001):c.161_162delinsATCCC' \ + in self.output.getOutput('descriptions') + assert 'AL449423.14(CDKN2A_i001):p.(Met54delinsAsnPro)' \ + in self.output.getOutput('protDescriptions') + assert self.output.getOutput('newprotein') + @fix(cache('NM_003002.2')) def test_est_warning_nm_est(self): """ @@ -496,20 +544,318 @@ class TestVariantchecker(MutalyzerTest): # prediction is done. assert self.output.getOutput('newprotein') - @fix(cache('AB026906.1')) + @fix(cache('NG_008939.1')) + def test_ins_seq(self): + """ + Insertion of a sequence. + """ + check_variant('NG_008939.1:g.5207_5208insGTCCTGTGCTCATTATCTGGC', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5208insGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_157insGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + + @fix(cache('NG_012337.1')) + def test_ins_seq_reverse(self): + """ + Insertion of a sequence on reverse strand. + """ + check_variant('NG_012337.1(TIMM8B_v001):c.12_13insGATC', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_012337.1:g.4911_4912insATCG') + assert 'NG_012337.1(TIMM8B_v001):c.12_13insGATC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) def test_ins_range(self): """ - Insertion of a range is not implemented yet. + Insertion of a range. """ - check_variant('AB026906.1:c.274_275ins262_268', self.output) + check_variant('NG_008939.1:g.5207_5208ins4300_4320', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5208insGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_157insGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + assert_equal(len(self.output.getMessagesWithErrorCode('ENOTIMPLEMENTED')), 0) + + @fix(cache('NG_008939.1')) + def test_ins_seq_list(self): + """ + Insertion of a sequence as a list. + """ + check_variant('NG_008939.1:g.5207_5208ins[GTCCTGTGCTCATTATCTGGC]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5208insGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_157insGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_012337.1')) + def test_ins_seq_list_reverse(self): + """ + Insertion of a sequence as a list on reverse strand. + """ + check_variant('NG_012337.1(TIMM8B_v001):c.12_13ins[GATC]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_012337.1:g.4911_4912insATCG') + assert 'NG_012337.1(TIMM8B_v001):c.12_13insGATC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_ins_range_list(self): + """ + Insertion of a range as a list. + """ + check_variant('NG_008939.1:g.5207_5208ins[4300_4320]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5208insGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_157insGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + assert_equal(len(self.output.getMessagesWithErrorCode('ENOTIMPLEMENTED')), 0) + + @fix(cache('NG_008939.1')) + def test_ins_seq_seq(self): + """ + Insertion of two sequences. + """ + check_variant('NG_008939.1:g.5207_5208ins[GTCCTGTGCTC;ATTATCTGGC]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5208insGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_157insGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_012337.1')) + def test_ins_seq_seq_reverse(self): + """ + Insertion of two sequences on reverse strand. + """ + check_variant('NG_012337.1(TIMM8B_v001):c.12_13ins[TTT;GATC]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_012337.1:g.4911_4912insATCAAAG') + assert 'NG_012337.1(TIMM8B_v001):c.12_13insTTTGATC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_ins_range_range(self): + """ + Insertion of two ranges. + """ + check_variant('NG_008939.1:g.5207_5208ins[4300_4309;4310_4320]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5208insGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_157insGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + assert_equal(len(self.output.getMessagesWithErrorCode('ENOTIMPLEMENTED')), 0) + + @fix(cache('NG_008939.1')) + def test_ins_seq_range(self): + """ + Insertion of a sequence and a range. + """ + check_variant('NG_008939.1:g.5207_5208ins[GTCCTGTGCT;4310_4320]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5208insGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_157insGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_ins_range_seq(self): + """ + Insertion of a range and a sequence. + """ + check_variant('NG_008939.1:g.5207_5208ins[4300_4309;CATTATCTGGC]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5208insGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_157insGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_ins_seq_coding(self): + """ + Insertion of a sequence (coding). + """ + check_variant('NG_008939.1(PCCB_v001):c.156_157insGTCCTGTGCTCATTATCTGGC', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5208insGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_157insGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_ins_seq_list_coding(self): + """ + Insertion of a sequence as a list (coding). + """ + check_variant('NG_008939.1(PCCB_v001):c.156_157ins[GTCCTGTGCTCATTATCTGGC]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5208insGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_157insGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_ins_seq_seq_coding(self): + """ + Insertion of two sequences (coding). + """ + check_variant('NG_008939.1(PCCB_v001):c.156_157ins[GTCCTGTGCTC;ATTATCTGGC]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5208insGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_157insGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_ins_range_coding(self): + """ + Insertion of a range (coding). + """ + check_variant('NG_008939.1(PCCB_v001):c.156_157ins180_188', self.output) assert_equal(len(self.output.getMessagesWithErrorCode('ENOTIMPLEMENTED')), 1) - @fix(cache('AB026906.1')) + @fix(cache('NG_008939.1')) + def test_ins_range_list_coding(self): + """ + Insertion of a range as a list (coding). + """ + check_variant('NG_008939.1(PCCB_v001):c.156_157ins[180_188]', self.output) + assert_equal(len(self.output.getMessagesWithErrorCode('ENOTIMPLEMENTED')), 1) + + @fix(cache('NG_008939.1')) + def test_delins_seq(self): + """ + Insertion-deletion of a sequence. + """ + check_variant('NG_008939.1:g.5207_5212delinsGTCCTGTGCTCATTATCTGGC', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5212delinsGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_161delinsGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) def test_delins_range(self): """ - Deletion/insertion of a range is not implemented yet. + Insertion-deletion of a range. + """ + check_variant('NG_008939.1:g.5207_5212delins4300_4320', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5212delinsGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_161delinsGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + assert_equal(len(self.output.getMessagesWithErrorCode('ENOTIMPLEMENTED')), 0) + + @fix(cache('NG_008939.1')) + def test_delins_seq_list(self): + """ + Insertion-deletion of a sequence as a list. + """ + check_variant('NG_008939.1:g.5207_5212delins[GTCCTGTGCTCATTATCTGGC]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5212delinsGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_161delinsGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_delins_range_list(self): + """ + Insertion-deletion of a range as a list. + """ + check_variant('NG_008939.1:g.5207_5212delins[4300_4320]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5212delinsGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_161delinsGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + assert_equal(len(self.output.getMessagesWithErrorCode('ENOTIMPLEMENTED')), 0) + + @fix(cache('NG_008939.1')) + def test_delins_seq_seq(self): + """ + Insertion-deletion of two sequences. + """ + check_variant('NG_008939.1:g.5207_5212delins[GTCCTGTGCT;CATTATCTGGC]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5212delinsGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_161delinsGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_delins_range_range(self): + """ + Insertion-deletion of two ranges. + """ + check_variant('NG_008939.1:g.5207_5212delins[4300_4309;4310_4320]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5212delinsGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_161delinsGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + assert_equal(len(self.output.getMessagesWithErrorCode('ENOTIMPLEMENTED')), 0) + + @fix(cache('NG_008939.1')) + def test_delins_seq_range(self): + """ + Insertion-deletion of a sequence and a range. + """ + check_variant('NG_008939.1:g.5207_5212delins[GTCCTGTGCT;4310_4320]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5212delinsGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_161delinsGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_delins_range_seq(self): + """ + Insertion-deletion of a range and a sequence. + """ + check_variant('NG_008939.1:g.5207_5212delins[4300_4309;CATTATCTGGC]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5212delinsGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_161delinsGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_delins_seq_coding(self): + """ + Insertion-deletion of a sequence (coding). + """ + check_variant('NG_008939.1(PCCB_v001):c.156_161delinsGTCCTGTGCTCATTATCTGGC', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5212delinsGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_161delinsGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_delins_seq_list_coding(self): + """ + Insertion-deletion of a sequence as a list (coding). + """ + check_variant('NG_008939.1(PCCB_v001):c.156_161delins[GTCCTGTGCTCATTATCTGGC]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5212delinsGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_161delinsGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_delins_seq_seq_coding(self): + """ + Insertion-deletion of two sequences (coding). + """ + check_variant('NG_008939.1(PCCB_v001):c.156_161delins[GTCCTGTGCT;CATTATCTGGC]', self.output) + assert_equal(self.output.getIndexedOutput('genomicDescription', 0), + 'NG_008939.1:g.5207_5212delinsGTCCTGTGCTCATTATCTGGC') + assert 'NG_008939.1(PCCB_v001):c.156_161delinsGTCCTGTGCTCATTATCTGGC' \ + in self.output.getOutput('descriptions') + + @fix(cache('NG_008939.1')) + def test_delins_range_coding(self): + """ + Insertion-deletion of a range (coding). + """ + check_variant('NG_008939.1(PCCB_v001):c.156_161delins180_188', self.output) + assert_equal(len(self.output.getMessagesWithErrorCode('ENOTIMPLEMENTED')), 1) + + @fix(cache('NG_008939.1')) + def test_delins_range_list_coding(self): + """ + Insertion-deletion of a range as a list (coding). """ - check_variant('AB026906.1:c.274delins262_268', self.output) + check_variant('NG_008939.1(PCCB_v001):c.156_161delins[180_188]', self.output) assert_equal(len(self.output.getMessagesWithErrorCode('ENOTIMPLEMENTED')), 1) def test_no_reference(self):