Example #1
0
    def test_check_consistency_fail1(self):
        """
        No transcript interval.
        """
        intervals = [create_interval_from_list(['1', '.', 'UTR5', '1', '9', '.', '+', '.', '.'])]

        message = "No transcript interval in list of intervals."
        with self.assertRaisesRegex(ValueError, message):
            segment._check_consistency(intervals)
Example #2
0
    def test_check_consistency_fail3(self):
        """
        Unallowed order of types.
        """
        intervals = list_to_intervals([
            ['1', '.', 'transcript', '1', '100', '.', '+', '.', '.'],
            ['1', '.', 'UTR3', '1', '49', '.', '+', '.', '.'],
            ['1', '.', 'CDS', '50', '100', '.', '+', '.', '.'],
        ])

        with self.assertRaises(AssertionError):
            segment._check_consistency(intervals)
Example #3
0
    def test_check_consistency_fail2(self):
        """
        Overlaping intervals.
        """
        intervals = list_to_intervals([
            ['1', '.', 'transcript', '1', '100', '.', '+', '.', '.'],
            ['1', '.', 'UTR5', '1', '50', '.', '+', '.', '.'],
            ['1', '.', 'CDS', '50', '100', '.', '+', '.', '.'],
        ])

        with self.assertRaises(AssertionError):
            segment._check_consistency(intervals)
Example #4
0
    def test_check_consistency_pass(self):  # pylint: disable=no-self-use
        intervals = list_to_intervals([
            ['1', '.', 'transcript', '1', '100', '.', '+', '.', '.'],
            ['1', '.', 'UTR5', '1', '9', '.', '+', '.', '.'],
            ['1', '.', 'CDS', '10', '49', '.', '+', '.', '.'],
            ['1', '.', 'intron', '50', '59', '.', '+', '.', '.'],
            ['1', '.', 'CDS', '60', '89', '.', '+', '.', '.'],
            ['1', '.', 'UTR3', '90', '100', '.', '+', '.', '.'],
        ])

        # If no AssertionError is raised, this is succes:
        segment._check_consistency(intervals)