Exemple #1
0
def align_reads(fastq1, fastq2):
    v3loop_ref = extract_v3loop_ref()
    reader = FastqReader(fastq1, fastq2)
    merged_reads = merge_reads(reader)
    score_counts = Counter()
    for _ in trim_reads(merged_reads, v3loop_ref, score_counts):
        pass
    return score_counts
Exemple #2
0
def align_reads(fastq1, fastq2):
    v3loop_ref = extract_v3loop_ref()
    reader = FastqReader(fastq1, fastq2)
    merged_reads = merge_reads(reader)
    score_counts = Counter()
    for _ in trim_reads(merged_reads, v3loop_ref, score_counts):
        pass
    return score_counts
Exemple #3
0
    def test_no_overlap(self):
        reads = [("A:B:C", ("X:Y", "AAACCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
                  ("Q:R", "ACACACACACAC", "BBBBBBBBBBBB"))]
        expected_merged_reads = [
            ("A:B:C", ("X:Y", "AAACCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
             ("Q:R", "ACACACACACAC", "BBBBBBBBBBBB"), None)
        ]

        merged_reads = list(merge_reads(reads))

        self.assertEqual(expected_merged_reads, merged_reads)
Exemple #4
0
    def test_low_quality(self):
        reads = [("A:B:C", ("X:Y", "AAACCCTTTGGGAAA", "B!BBBBBBBBBBBBB"),
                  ("Q:R", "GGGTTTCCCAAA", "BBBBBBBBBBBB"))]
        expected_merged_reads = [
            ("A:B:C", ("X:Y", "AAACCCTTTGGGAAA", "B!BBBBBBBBBBBBB"),
             ("Q:R", "GGGTTTCCCAAA", "BBBBBBBBBBBB"), "ANACCCTTTGGGAAACCC")
        ]

        merged_reads = list(merge_reads(reads))

        self.assertEqual(expected_merged_reads, merged_reads)
Exemple #5
0
    def test_disagreement(self):
        reads = [("A:B:C", ("X:Y", "AAACCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
                  ("Q:R", "GGGTTTCACAAA", "@@@@@@@Y@@@@"))]
        expected_merged_reads = [
            ("A:B:C", ("X:Y", "AAACCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
             ("Q:R", "GGGTTTCACAAA", "@@@@@@@Y@@@@"), "AAACCCTTTGTGAAACCC")
        ]

        merged_reads = list(merge_reads(reads))

        self.assertEqual(expected_merged_reads, merged_reads)
Exemple #6
0
    def test_reverse_overlap(self):
        """ The start of read 1 aligns with the end of read 2. Reject! """
        reads = [("A:B:C", ("Q:R", "TTTGGGAAACCC", "BBBBBBBBBBBB"),
                  ("X:Y", "TTTCCCAAAGGGTTT", "BBBBBBBBBBBBBBB"))]
        expected_merged_reads = [
            ("A:B:C", ("Q:R", "TTTGGGAAACCC", "BBBBBBBBBBBB"),
             ("X:Y", "TTTCCCAAAGGGTTT", "BBBBBBBBBBBBBBB"), None)
        ]

        merged_reads = list(merge_reads(reads))

        self.assertEqual(expected_merged_reads, merged_reads)
Exemple #7
0
    def test_no_overlap(self):
        reads = [("A:B:C",
                  ("X:Y", "AAACCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
                  ("Q:R", "ACACACACACAC", "BBBBBBBBBBBB"))]
        expected_merged_reads = [("A:B:C",
                                  ("X:Y", "AAACCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
                                  ("Q:R", "ACACACACACAC", "BBBBBBBBBBBB"),
                                  None)]

        merged_reads = list(merge_reads(reads))

        self.assertEqual(expected_merged_reads, merged_reads)
Exemple #8
0
    def test_low_quality(self):
        reads = [("A:B:C",
                  ("X:Y", "AAACCCTTTGGGAAA", "B!BBBBBBBBBBBBB"),
                  ("Q:R", "GGGTTTCCCAAA", "BBBBBBBBBBBB"))]
        expected_merged_reads = [("A:B:C",
                                  ("X:Y", "AAACCCTTTGGGAAA", "B!BBBBBBBBBBBBB"),
                                  ("Q:R", "GGGTTTCCCAAA", "BBBBBBBBBBBB"),
                                  "ANACCCTTTGGGAAACCC")]

        merged_reads = list(merge_reads(reads))

        self.assertEqual(expected_merged_reads, merged_reads)
Exemple #9
0
    def test_disagreement(self):
        reads = [("A:B:C",
                  ("X:Y", "AAACCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
                  ("Q:R", "GGGTTTCACAAA", "@@@@@@@Y@@@@"))]
        expected_merged_reads = [("A:B:C",
                                  ("X:Y", "AAACCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
                                  ("Q:R", "GGGTTTCACAAA", "@@@@@@@Y@@@@"),
                                  "AAACCCTTTGTGAAACCC")]

        merged_reads = list(merge_reads(reads))

        self.assertEqual(expected_merged_reads, merged_reads)
Exemple #10
0
    def test_reverse_overlap(self):
        """ The start of read 1 aligns with the end of read 2. Reject! """
        reads = [("A:B:C",
                  ("Q:R", "TTTGGGAAACCC", "BBBBBBBBBBBB"),
                  ("X:Y", "TTTCCCAAAGGGTTT", "BBBBBBBBBBBBBBB"))]
        expected_merged_reads = [("A:B:C",
                                  ("Q:R", "TTTGGGAAACCC", "BBBBBBBBBBBB"),
                                  ("X:Y", "TTTCCCAAAGGGTTT", "BBBBBBBBBBBBBBB"),
                                  None)]

        merged_reads = list(merge_reads(reads))

        self.assertEqual(expected_merged_reads, merged_reads)
Exemple #11
0
    def test_multiple_reads(self):
        reads = [("A:B:C", ("X:Y", "AAACCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
                  ("Q:R", "GGGTTTCCCAAA", "BBBBBBBBBBBB")),
                 ("A:B:E", ("X:Y", "TTTCCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
                  ("Q:R", "GGGTTTCCCAAA", "BBBBBBBBBBBB"))]
        expected_merged_reads = [
            ("A:B:C", ("X:Y", "AAACCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
             ("Q:R", "GGGTTTCCCAAA", "BBBBBBBBBBBB"), "AAACCCTTTGGGAAACCC"),
            ("A:B:E", ("X:Y", "TTTCCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
             ("Q:R", "GGGTTTCCCAAA", "BBBBBBBBBBBB"), "TTTCCCTTTGGGAAACCC")
        ]

        merged_reads = list(merge_reads(reads))

        self.assertEqual(expected_merged_reads, merged_reads)
Exemple #12
0
    def test_multiple_reads(self):
        reads = [("A:B:C",
                  ("X:Y", "AAACCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
                  ("Q:R", "GGGTTTCCCAAA", "BBBBBBBBBBBB")),
                 ("A:B:E",
                  ("X:Y", "TTTCCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
                  ("Q:R", "GGGTTTCCCAAA", "BBBBBBBBBBBB"))]
        expected_merged_reads = [("A:B:C",
                                  ("X:Y", "AAACCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
                                  ("Q:R", "GGGTTTCCCAAA", "BBBBBBBBBBBB"),
                                  "AAACCCTTTGGGAAACCC"),
                                 ("A:B:E",
                                  ("X:Y", "TTTCCCTTTGGGAAA", "BBBBBBBBBBBBBBB"),
                                  ("Q:R", "GGGTTTCCCAAA", "BBBBBBBBBBBB"),
                                  "TTTCCCTTTGGGAAACCC")]

        merged_reads = list(merge_reads(reads))

        self.assertEqual(expected_merged_reads, merged_reads)