def test_F_fastq_compiled_correct_record_number(self, m_parse_args): m_parse_args.return_value = self.default_args sequence_split.main() for filename, expected_num_records in self.yield_files_and_lengths( 'fastq'): result_records = list(SeqIO.parse(filename, 'fastq')) self.assertEquals(expected_num_records, len(result_records))
def test_F_fastq_to_fasta_some_lines_exist(self, m_parse_args): m_parse_args.return_value = Namespace(seqfile='tests/F.fastq', delimiter=':', file_type='fastq', outdir=self.outdir, out_format='fasta', colnum=1) sequence_split.main() expected_lines = [">M02261:C1:000000000-A648D:1:1101:17702:1010 1:N:0:84", "NCTTGGCGTAAAGGCAGTGATTGCCGAGAGCTTTGAGCGAATACATCGTTCAAATTTAGTTGGTATGGGTATTTTACCGCTAACTTTNACCGGNNNNAATNCAAGATTAGATTTAAAGTTAGACGGTTCGGAAACTATTGATATTATAGGCTTAAGTGAACAAATAAAGCCTTATAATCCTGTTAAATGCATGATAA", ">M02261:C1:000000000-A648D:1:1101:15313:1016 1:N:0:84"," NAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAANAGAAGNNAANAGAAGAGAAGAGAAGAGAGAAGAGGAGAGACA"] expected = ''.join(expected_lines).replace(' ', '') self.assertTrue(expected in open(os.path.join(self.outdir, 'C1.fasta')).read().replace('\n', '').replace(' ', ''))
def test_F_fastq_to_fasta_files_exist(self, m_parse_args): m_parse_args.return_value = Namespace(seqfile='tests/F.fastq', delimiter=':', file_type='fastq', outdir=self.outdir, out_format='fasta', colnum=1) sequence_split.main() for filename, _ in self.yield_files_and_lengths('fasta'): self.assertTrue(os.path.isfile(filename))
def test_F_fastq_to_fasta_num_records(self, m_parse_args): m_parse_args.return_value = Namespace(seqfile='tests/F.fastq', delimiter=':', file_type='fastq', outdir=self.outdir, out_format='fasta', colnum=1) sequence_split.main() for filename, num_records in self.yield_files_and_lengths('fasta'): result_records = list(SeqIO.parse(filename, 'fasta')) self.assertEquals(num_records, len(result_records))
def test_F_fastq_to_fasta_some_lines_exist(self, m_parse_args): m_parse_args.return_value = Namespace(seqfile='tests/F.fastq', delimiter=':', file_type='fastq', outdir=self.outdir, out_format='fasta', colnum=1) sequence_split.main() expected_lines = [ ">M02261:C1:000000000-A648D:1:1101:17702:1010 1:N:0:84", "NCTTGGCGTAAAGGCAGTGATTGCCGAGAGCTTTGAGCGAATACATCGTTCAAATTTAGTTGGTATGGGTATTTTACCGCTAACTTTNACCGGNNNNAATNCAAGATTAGATTTAAAGTTAGACGGTTCGGAAACTATTGATATTATAGGCTTAAGTGAACAAATAAAGCCTTATAATCCTGTTAAATGCATGATAA", ">M02261:C1:000000000-A648D:1:1101:15313:1016 1:N:0:84", " NAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAAGAGAANAGAAGNNAANAGAAGAGAAGAGAAGAGAGAAGAGGAGAGACA" ] expected = ''.join(expected_lines).replace(' ', '') self.assertTrue(expected in open(os.path.join(self.outdir, 'C1.fasta')) .read().replace('\n', '').replace(' ', ''))
def test_F_fastq_compiled_correct_record_number(self, m_parse_args): m_parse_args.return_value = self.default_args sequence_split.main() for filename, expected_num_records in self.yield_files_and_lengths('fastq'): result_records = list(SeqIO.parse(filename, 'fastq')) self.assertEquals(expected_num_records, len(result_records) )
def test_F_fastq_compiled_files_exist(self, m_parse_args): m_parse_args.return_value = self.default_args sequence_split.main() for filename, _ in self.yield_files_and_lengths('fastq'): self.assertTrue(os.path.isfile(filename))