Пример #1
0
 def test_no_reference_obj(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLQWERTYUIOP'),
                            name=None,
                            reference_object='thing')
     mut_translation = Mock(get_aa_seq=MockFunction('ASDFGHJIIIQWERTYUIOP'))
     with self.assertRaises(AttributeError):
         call_protein_indel(ref_translation, mut_translation)
Пример #2
0
    def test_fs(self):
        ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKL'), name='ref')
        mut_translation = Mock(get_aa_seq=MockFunction('ASDFGHJMMM'))
        notation = call_protein_indel(ref_translation, mut_translation)
        assert notation == 'ref:p.K8Mfs'

        ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKL'), name='ref')
        mut_translation = Mock(get_aa_seq=MockFunction('ASDFGHJCMMEF'))
        notation = call_protein_indel(ref_translation, mut_translation)
        assert notation == 'ref:p.K8Cfs'
Пример #3
0
 def test_fs_with_stops(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLT*'),
                            name='ref')
     mut_translation = Mock(
         get_aa_seq=MockFunction('ASDFGHJMMMHGFTTSBF*TUHG*'))
     notation = call_protein_indel(ref_translation, mut_translation)
     self.assertEqual('ref:p.K8Mfs*12', notation)
Пример #4
0
 def test_ins_end(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLQWERTYUIOP'),
                            name='ref')
     mut_translation = Mock(
         get_aa_seq=MockFunction('ASDFGHJKLQWERTYUIOPII'))
     notation = call_protein_indel(ref_translation, mut_translation)
     self.assertEqual('ref:p.P19ext2', notation)
Пример #5
0
 def test_large_start_deletion(self):
     ref_translation = Mock(
         get_aa_seq=MockFunction(
             'MGLKAAQKTLFPLRSIDDVVRLFAAELGREEPDLVLLSLVLGFVEHFLAVNRVIPTNVPE'
             'LTFQPSPAPDPPGGLTYFPVADLSIIAALYARFTAQIRGAVDLSLYPREGGVSSRELVKK'
             'VSDVIWNSLSRSYFKDRAHIQSLFSFITGTKLDSSGVAFAVVGACQALGLRDVHLALSED'
             'HAWVVFGPNGEQTAEVTWHGKGNEDRRGQTVNAGVAERSWLYLKGSYMRCDRKMEVAFMV'
             'CAINPSIDLHTDSLELLQLQQKLLWLLYDLGHLERYPMALGNLADLEELEPTPGRPDPLT'
             'LYHKGIASAKTYYRDEHIYPYMYLAGYHCRNRNVREALQAWADTATVIQDYNYCREDEEI'
             'YKEFFEVANDVIPNLLKEAASLLEAGEERPGEQSQGTQSQGSALQDPECFAHLLRFYDGI'
             'CKWEEGSPTPVLHVGWATFLVQSLGRFEGQVRQKVRIVSREAEAAEAEEPWGEEAREGRR'
             'RGPRRESKPEEPPPPKKPALDKGLGTGQGAVSGPPRKPPGTVAGTARGPEGGSTAQVPAP'
             'TASPPPEGPVLTFQSEKMKGMKELLVATKINSSAIKLQLTAQSQVQMKKQKVSTPSDYTL'
             'SFLKRQRKGL*'),
         name='ref',
     )
     mut_translation = Mock(get_aa_seq=MockFunction(
         'MRCDRKMEVAFMV'
         'CAINPSIDLHTDSLELLQLQQKLLWLLYDLGHLERYPMALGNLADLEELEPTPGRPDPLT'
         'LYHKGIASAKTYYRDEHIYPYMYLAGYHCRNRNVREALQAWADTATVIQDYNYCREDEEI'
         'YKEFFEVANDVIPNLLKEAASLLEAGEERPGEQSQGTQSQGSALQDPECFAHLLRFYDGI'
         'CKWEEGSPTPVLHVGWATFLVQSLGRFEGQVRQKVRIVSREAEAAEAEEPWGEEAREGRR'
         'RGPRRESKPEEPPPPKKPALDKGLGTGQGAVSGPPRKPPGTVAGTARGPEGGSTAQVPAP'
         'TASPPPEGPVLTFQSEKMKGMKELLVATKINSSAIKLQLTAQSQVQMKKQKVSTPSDYTL'
         'SFLKRQRKGL*'))
     notation = call_protein_indel(ref_translation, mut_translation)
     self.assertEqual(
         'ref:p.M1_Y227del'
         'MGLKAAQKTLFPLRSIDDVVRLFAAELGREEPDLVLLSLVLGFVEHFLAVNRVIPTNVPE'
         'LTFQPSPAPDPPGGLTYFPVADLSIIAALYARFTAQIRGAVDLSLYPREGGVSSRELVKK'
         'VSDVIWNSLSRSYFKDRAHIQSLFSFITGTKLDSSGVAFAVVGACQALGLRDVHLALSED'
         'HAWVVFGPNGEQTAEVTWHGKGNEDRRGQTVNAGVAERSWLYLKGSY',
         notation,
     )
Пример #6
0
 def test_ins_start(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLQWERTYUIOP'),
                            name='ref')
     mut_translation = Mock(
         get_aa_seq=MockFunction('IIASDFGHJKLQWERTYUIOP'))
     notation = call_protein_indel(ref_translation, mut_translation)
     self.assertEqual(None, notation)
Пример #7
0
 def test_transcript_name(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLQWERTYUIOP'),
                            name=None,
                            reference_object=Mock(name='reft'))
     mut_translation = Mock(get_aa_seq=MockFunction('ASDFGHJIIIQWERTYUIOP'))
     notation = call_protein_indel(ref_translation, mut_translation)
     self.assertEqual('reft:p.K8_L9delKLinsIII', notation)
Пример #8
0
    def test_small_duplication(self):
        bpp = BreakpointPair(
            Breakpoint('6', 157100005, strand='+', orient='R'),
            Breakpoint('6', 157100007, strand='+', orient='L'),
            event_type=SVTYPE.DUP,
            untemplated_seq='',
            protocol=PROTOCOL.GENOME,
        )
        # annotate the breakpoint with the gene
        annotations = annotate_events([bpp],
                                      reference_genome=self.reference_genome,
                                      annotations=self.reference_annotations)
        self.assertEqual(1, len(annotations))

        ann = Annotation(bpp, transcript1=self.best, transcript2=self.best)
        ft = FusionTranscript.build(
            ann,
            self.reference_genome,
            min_orf_size=300,
            max_orf_cap=10,
            min_domain_mapping_match=0.9,
        )
        ref_tx = self.best.translations[0]
        fusion_tx = ft.translations[0]

        # compare the fusion translation to the refernece translation to create the protein notation
        ref_aa_seq = ref_tx.get_aa_seq(self.reference_genome)
        call = IndelCall(ref_aa_seq, fusion_tx.get_aa_seq())
        self.assertTrue(call.is_dup)

        notation = call_protein_indel(ref_tx, fusion_tx, self.reference_genome)
        print(notation)
        self.assertEqual('ENST00000346085:p.G319dupG', notation)
Пример #9
0
    def test_small_duplication(self):
        gene = get_example_genes()['ARID1B']
        reference_annotations = {gene.chr: [gene]}
        reference_genome = {
            gene.chr:
            MockObject(seq=MockLongString(gene.seq, offset=gene.start - 1))
        }
        best = get_best(gene)

        bpp = BreakpointPair(
            Breakpoint('6', 157100005, strand='+', orient='R'),
            Breakpoint('6', 157100007, strand='+', orient='L'),
            event_type=SVTYPE.DUP,
            untemplated_seq='',
            protocol=PROTOCOL.GENOME,
        )
        # annotate the breakpoint with the gene
        annotations = annotate_events([bpp],
                                      reference_genome=reference_genome,
                                      annotations=reference_annotations)
        assert len(annotations) == 1

        ann = Annotation(bpp, transcript1=best, transcript2=best)
        ft = FusionTranscript.build(
            ann,
            reference_genome,
            min_orf_size=300,
            max_orf_cap=10,
            min_domain_mapping_match=0.9,
        )
        ref_tx = best.translations[0]
        fusion_tx = ft.translations[0]

        # compare the fusion translation to the refernece translation to create the protein notation
        ref_aa_seq = ref_tx.get_aa_seq(reference_genome)
        call = IndelCall(ref_aa_seq, fusion_tx.get_aa_seq())
        assert call.is_dup

        notation = call_protein_indel(ref_tx, fusion_tx, reference_genome)
        print(notation)
        assert notation == 'ENST00000346085:p.G319dupG'
Пример #10
0
 def test_delete_start_with_rep(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ASDAFGHJKL'),
                            name='ref')
     mut_translation = Mock(get_aa_seq=MockFunction('AFGHJKL'))
     notation = call_protein_indel(ref_translation, mut_translation)
     self.assertEqual('ref:p.A1_D3delASD', notation)
Пример #11
0
 def test_delete_single_aa_start(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLQWERTYUIOP'),
                            name='ref')
     mut_translation = Mock(get_aa_seq=MockFunction('SDFGHJKLQWERTYUIOP'))
     notation = call_protein_indel(ref_translation, mut_translation)
     self.assertEqual('ref:p.A1delA', notation)
Пример #12
0
 def test_delins(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLQWERTYUIOP'),
                            name='ref')
     mut_translation = Mock(get_aa_seq=MockFunction('ASDFGHJIIIQWERTYUIOP'))
     notation = call_protein_indel(ref_translation, mut_translation)
     self.assertEqual('ref:p.K8_L9delKLinsIII', notation)
Пример #13
0
 def test_synonymous(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLQWERTYUIOP'), name='ref')
     mut_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLQWERTYUIOP'))
     notation = call_protein_indel(ref_translation, mut_translation)
     assert notation is None
Пример #14
0
 def test_fs_immeadiate_stop(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLT*'), name='ref')
     mut_translation = Mock(get_aa_seq=MockFunction('ASDFGHJMMMHGFTTSBF*'))
     notation = call_protein_indel(ref_translation, mut_translation)
     assert notation == 'ref:p.K8Mfs*12'
Пример #15
0
 def test_ins_start(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLQWERTYUIOP'), name='ref')
     mut_translation = Mock(get_aa_seq=MockFunction('IIASDFGHJKLQWERTYUIOP'))
     notation = call_protein_indel(ref_translation, mut_translation)
     assert notation == 'ref:p.A1ext-2'
Пример #16
0
 def test_delete_single_aa_end(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLQWERTYUIOP'), name='ref')
     mut_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLQWERTYUIO'))
     notation = call_protein_indel(ref_translation, mut_translation)
     assert notation == 'ref:p.P19delP'
Пример #17
0
 def test_deletion_rep_at_breaks(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ABCDEFKJFEDAGFLKJ'),
                            name='ref')
     mut_translation = Mock(get_aa_seq=MockFunction('ABCDE' 'AGFLKJ'))
     notation = call_protein_indel(ref_translation, mut_translation)
     self.assertEqual('ref:p.F6_D11delFKJFED', notation)
Пример #18
0
 def test_deletion(self):
     ref_translation = Mock(get_aa_seq=MockFunction('ASDFGHJKLQWERTYUIOP'), name='ref')
     mut_translation = Mock(get_aa_seq=MockFunction('ASDFGHJQWERTYUIOP'))
     notation = call_protein_indel(ref_translation, mut_translation)
     assert notation == 'ref:p.K8_L9delKL'