Ejemplo n.º 1
0
    def test_end(self):
        xlink_pos = 1
        report_by = 'end'
        by_bc = {
            'AAAAA': [
                # (middle_pos, end_pos, read_len, num_mapped, cigar, second_start)
                (1, 10, 10, 1, 0),
                (1, 10, 10, 1, 0),
                (1, 80, 80, 8, 0),
            ],
            'CCCCC': [
                (1, 10, 10, 1, 0),
                (15, 20, 10, 10, 0),
            ],
        }

        # Multimax = 1
        result1 = xlsites._collapse(xlink_pos, by_bc, report_by, multimax=1)
        expected1 = {10: (2.0, 3)}
        self.assertEqual(result1, expected1)

        # Multimax = 10
        result2 = xlsites._collapse(xlink_pos, by_bc, report_by, multimax=10)
        expected2 = {10: (0.7, 3), 80: (0.1, 1), 20: (0.05, 1)}
        self.assertEqual(result2, expected2)
Ejemplo n.º 2
0
    def test_middle(self):
        xlink_pos = 1
        report_by = 'middle'
        by_bc = {
            'AAAAA': [
                # (middle_pos, end_pos, read_len, num_mapped, cigar, second_start)
                (5, 10, 10, 1, 0),
                (5, 10, 10, 1, 0),
                (40, 80, 80, 8, 0)
            ],
            'CCCCC': [(5, 10, 10, 1, 0), (25, 30, 10, 10, 0)]
        }

        # Multimax = 1
        result1 = xlsites._collapse(xlink_pos, by_bc, report_by, multimax=1)
        expected1 = {5: (2.0, 3)}
        self.assertEqual(result1, expected1)

        # Multimax = 10
        result2 = xlsites._collapse(xlink_pos, by_bc, report_by, multimax=10)
        expected2 = {5: (0.7, 3), 40: (0.1, 1), 25: (0.05, 1)}
        self.assertEqual(result2, expected2)
Ejemplo n.º 3
0
 def test_start_2(self):
     """
     Two barcodes, multimax case.
     """
     by_bc = {
         'AAAAA': [
             # (middle_pos, end_pos, read_len, num_mapped, cigar, second_start)
             (5, 10, 10, 1, 0),
             (5, 10, 10, 1, 0),
             (15, 30, 20, 2, 0),
         ],
         'CCCCC': [
             (5, 10, 10, 1, 0),
             (5, 10, 10, 100, 0),  # Excluded becouse of multimax
         ],
     }
     result1 = xlsites._collapse(1, by_bc, 'start', multimax=10)
     expected1 = {1: (1.75, 4)}
     self.assertEqual(result1, expected1)
Ejemplo n.º 4
0
 def test_start_1(self):
     """
     Two barcodes, one with two second_start groups.
     No multimax situation yet.
     """
     by_bc = {
         'AAAAA': [
             # (middle_pos, end_pos, read_len, num_mapped, cigar, second_start)
             (5, 10, 10, 1, 0),
             (5, 10, 10, 1, 0),
             (5, 30, 20, 1, 20),
         ],
         'CCCCC': [
             (5, 10, 10, 1, 0),
             (5, 10, 10, 1, 0),
         ],
     }
     result1 = xlsites._collapse(1, by_bc, 'start', multimax=1)
     expected1 = {1: (3.0, 5)}
     self.assertEqual(result1, expected1)