Example #1
0
    def test_positive_three_path_merged_exon(self):
        '''
            []-----[]---->[*********]
            []---->[]--->[]
            []-----[======]------>[]
        '''
        self.ex7 = Exon('chrX', 1000, 4000, 'ex1.1', '+')
        self.exonsDB[str(self.ex7)] = self.ex7
        self.ex8 = Exon('chrX', 2000, 5000, 'ex1.1', '+')
        self.exonsDB[str(self.ex8)] = self.ex8

        path1 = ['start', str(self.ex4), str(self.ex1),
                    str(self.ex2), 'end']
        path2 = ['start', str(self.ex4), str(self.ex1),
                    str(self.ex8), 'end']
        path3 = ['start', str(self.ex4), str(self.ex7),
                    str(self.ex3), 'end']

        self.transcripts = [path1, path2, path3]

        self.graph.add_path(path1)
        self.graph.add_path(path2)
        self.graph.add_path(path3)

        paths = list(find_ALE(self.graph, self.exonsDB, self.transcripts))

        self.assertEqual(len(paths[0]), 2)
        self.assertItemsEqual(get_num_exons(paths), [2, 2])
Example #2
0
    def test_positive_one_path_one_exon(self):
        '''
            []-------->[]
        '''
        self.graph.add_path(['start', str(self.ex1),
                                    str(self.ex2), 'end'])
        self.transcripts = [[str(self.ex1), str(self.ex2)]]
        paths = list(find_ALE(self.graph, self.exonsDB, self.transcripts))

        self.assertEqual(len(paths[0]), 0)
Example #3
0
    def test_negative_one_path_one_exon(self):
        '''
            []<------[]
        '''
        path = ['end', str(self.ex1), str(self.ex2), 'start']
        path.reverse()
        self.graph.add_path(path)
        self.transcripts = [path]
        paths = list(find_ALE(self.graph, self.exonsDB, self.transcripts))

        self.assertEqual(len(paths[0]), 0)
Example #4
0
    def test_positive_two_path_one_exon(self):
        '''
            []---------->[*]
            []------>[]
        '''

        path1 = ['start', str(self.ex1), str(self.ex2), 'end']
        path2 = ['start', str(self.ex1), str(self.ex5), 'end']
        self.graph.add_path(path1)
        self.graph.add_path(path2)
        self.transcripts = [path1, path2]
        paths = list(find_ALE(self.graph, self.exonsDB, self.transcripts))

        self.assertEqual(len(paths[0]), 2)
        self.assertItemsEqual(get_num_exons(paths), [2, 2])
Example #5
0
    def test_positive_no_ALE_with_AFE(self):
        '''
            []--------->[]--------->[]
              []------->[]--------->[]
        '''

        path1 = ['start', str(self.ex1), str(self.ex2),
                   str(self.ex3), 'end']
        path2 = ['start', str(self.ex4), str(self.ex2),
                   str(self.ex3), 'end']

        self.graph.add_path(path1)
        self.graph.add_path(path2)
        self.transcripts = [path1, path2]
        paths = list(find_ALE(self.graph, self.exonsDB, self.transcripts))

        self.assertEqual(len(paths[0]), 0)
Example #6
0
    def test_negative_two_path_one_exon(self):
        '''
            []<-----------[]
                [*]<------[]
        '''
        path1 = ['end', str(self.ex1), str(self.ex2), 'start']
        path2 = ['end', str(self.ex4), str(self.ex2), 'start']

        path1.reverse()
        path2.reverse()

        self.graph.add_path(path1)
        self.graph.add_path(path2)
        self.transcripts = [path1, path2]
        paths = list(find_ALE(self.graph, self.exonsDB, self.transcripts))

        self.assertEqual(len(paths[0]), 2)
        self.assertItemsEqual(get_num_exons(paths), [2, 2])
Example #7
0
    def test_positive_two_path_two_exon(self):
        '''
            []-------->[]------->[]
            []-------->[]----->[*]---->[*]
        '''
        self.ex6 = Exon('chrX', 7000, 8000, 'ex1.1', '+')
        self.exonsDB[str(self.ex6)] = self.ex6
        path1 = ['start', str(self.ex4),
                    str(self.ex1), str(self.ex2), 'end']
        path2 = ['start', str(self.ex4), str(self.ex1),
                    str(self.ex5), str(self.ex6), 'end']
        self.graph.add_path(path1)
        self.graph.add_path(path2)
        self.transcripts = [path1, path2]

        paths = list(find_ALE(self.graph, self.exonsDB, self.transcripts))

        self.assertEqual(len(paths[0]), 2)
        self.assertItemsEqual(get_num_exons(paths), [2, 3])
Example #8
0
    def test_negative_no_ALE_with_AFE(self):
        '''
            []<------[]<-----[]<-------[]
            []<------[]<--[*]
        '''

        path1 = (['end', str(self.ex4), str(self.ex1),
                    str(self.ex2), str(self.ex3), 'start'])
        path2 = (['end', str(self.ex4),
                    str(self.ex1), str(self.ex5), 'start'])

        path1.reverse()
        path2.reverse()

        self.graph.add_path(path1)
        self.graph.add_path(path2)
        self.transcripts = [path1, path2]
        paths = list(find_ALE(self.graph, self.exonsDB, self.transcripts))

        self.assertEqual(len(paths[0]), 0)
Example #9
0
    def test_negative_single_ALE_with_AFE(self):
        '''
               []<-------[]<-------[]
                  [*]<---[]<----------[]
        '''

        self.ex6 = Exon('chrX', 7000, 8000, 'ex1.1', '+')
        self.exonsDB[str(self.ex6)] = self.ex6

        path1 = (['end', str(self.ex4), str(self.ex2),
                    str(self.ex3), 'start'])
        path2 = (['end', str(self.ex1),
                    str(self.ex2), str(self.ex6), 'start'])

        path1.reverse()
        path2.reverse()

        self.graph.add_path(path1)
        self.graph.add_path(path2)
        self.transcripts = [path1, path2]
        paths = list(find_ALE(self.graph, self.exonsDB, self.transcripts))

        self.assertEqual(len(paths[0]), 2)
        self.assertItemsEqual(get_num_exons(paths), [2, 2])