Beispiel #1
0
 def test_parse_fastq_no_newlines(self):
     parsed_record = self.parser.parse_fastq(
         "@SRR959238.1 HWI-ST897:104:C015GACXX:6:1101:1337:2122/1",
         "AATTGAGTCG", "+", "===+=AA=AD")
     self.assertEqual(
         parsed_record,
         ParsedFastqRecord(
             "AATTGAGTCG",
             np.array([28, 28, 28, 10, 28, 32, 32, 28, 32, 35])))
Beispiel #2
0
 def test_parse_fastq_newlines(self):
     # TODO: do we want to do validations on the FastQ?
     parsed_record = self.parser.parse_fastq(
         "@SRR959238.1 HWI-ST897:104:C015GACXX:6:1101:1337:2122/1\n",
         "AATTGAGTCG\n", "+\n", "===+=AA=AD\n")
     self.assertEqual(
         parsed_record,
         ParsedFastqRecord(
             "AATTGAGTCG",
             np.array([28, 28, 28, 10, 28, 32, 32, 28, 32, 35])))
Beispiel #3
0
 def test_reverse_sequence_palindrome(self):
     sequence = ParsedFastqRecord("ATGCAT", [10, 11, 12, 13, 14, 15])
     reverse_sequence = self.reverser.reverse_sequence(sequence)
     expected_reverse_sequence = ParsedFastqRecord("ATGCAT",
                                                   [15, 14, 13, 12, 11, 10])
     self.assertEqual(reverse_sequence, expected_reverse_sequence)
Beispiel #4
0
 def test_reverse_sequence_empty(self):
     sequence = ParsedFastqRecord("", [])
     reverse_sequence = self.reverser.reverse_sequence(sequence)
     expected_reverse_sequence = ParsedFastqRecord("", [])
     self.assertEqual(reverse_sequence, expected_reverse_sequence)
Beispiel #5
0
 def parse_fastq(self, id, sequence, optional_id, quality_string):
     filtered_sequence = super()._strip_terminal_newline(sequence)
     filtered_quality = super()._strip_terminal_newline(quality_string)
     phred_quality = self.base_quality_convert.convert_quality_to_phred(
         filtered_quality)
     return ParsedFastqRecord(filtered_sequence, phred_quality)
Beispiel #6
0
 def reverse_sequence(self, parsed_fastq):
     reverse_complement = self.reverse_complement(parsed_fastq.sequence)
     reverse_quality = parsed_fastq.phred_quality[::-1]
     return ParsedFastqRecord(reverse_complement, reverse_quality)