def test_parse_m9_blast(self): """Parse blast output as expected""" fna_6_hits = [M9(query='4502804.3.fna_6', subject='28_interest.fna', percent_id=100.00, aln_length=14, mismatches=0, gapopenings=0, q_start=42, q_end=55, s_start=98, s_end=111, evalue=0.006, bitscore=28.2)] fna_8_hits = [M9(query='4502804.3.fna_8', subject='20_interest_hita.fna', percent_id=100.00, aln_length=13, mismatches=0, gapopenings=0, q_start=19, q_end=31, s_start=529, s_end=541, evalue=0.059, bitscore=26.3), M9(query='4502804.3.fna_8', subject='20_interest_hitb.fna', percent_id=100.00, aln_length=13, mismatches=0, gapopenings=0, q_start=19, q_end=31, s_start=529, s_end=541, evalue=0.059, bitscore=26.3), M9(query='4502804.3.fna_8', subject='20_interest_hitc.fna', percent_id=100.00, aln_length=13, mismatches=0, gapopenings=0, q_start=19, q_end=31, s_start=529, s_end=541, evalue=0.059, bitscore=26.3)] fna_9_hits = [M9(query='4502804.3.fna_9', subject='26_interest.fna', percent_id=100.00, aln_length=14, mismatches=0, gapopenings=0, q_start=114, q_end=127, s_start=3039, s_end=3026, evalue=0.020, bitscore=28.2)] exp = [(None, [copy(self.m9_empty)]), ('4502804.3.fna_6', fna_6_hits), (None, [copy(self.m9_empty)]), ('4502804.3.fna_8', fna_8_hits), ('4502804.3.fna_9', fna_9_hits), (None, [copy(self.m9_empty)])] obs = parse_m9(self.blasttest) self.assertEqual(obs, exp)
def test_parse_m9_sortmerna(self): """Parse sortmerna output as expected""" fna_161_hits = [M9(query='QiimeExactMatch.4502806.3.fna_161', subject='NZ_CAAQ01005666|642979345', percent_id=87.8, aln_length=188, mismatches=23, gapopenings=0, q_start=3, q_end=190, s_start=360, s_end=547, evalue=1.05e-59, bitscore=234)] fna_282_hits = [M9(query='QiimeExactMatch.4502806.3.fna_282', subject='NZ_CAAX01000347|642979348', percent_id=75, aln_length=164, mismatches=41, gapopenings=0, q_start=3, q_end=166, s_start=1745, s_end=1908, evalue=1.19e-22, bitscore=111)] fna_504_hits = [M9(query='QiimeExactMatch.4502806.3.fna_504', subject='NZ_CAAX01000347|642979348', percent_id=96.4, aln_length=28, mismatches=1, gapopenings=0, q_start=170, q_end=197, s_start=2575, s_end=2602, evalue=0.00257, bitscore=47)] fna_562_hits = [M9(query='QiimeExactMatch.4502806.3.fna_562', subject='NZ_CAAQ01004522|642979345_hit_a', percent_id=91.6, aln_length=143, mismatches=12, gapopenings=0, q_start=3, q_end=145, s_start=1369, s_end=1511, evalue=2.63e-50, bitscore=203.0), M9(query='QiimeExactMatch.4502806.3.fna_562', subject='NZ_CAAQ01004522|642979345_hit_b', percent_id=91.6, aln_length=143, mismatches=12, gapopenings=0, q_start=4, q_end=145, s_start=1369, s_end=1511, evalue=2.63e-50, bitscore=203.0)] fna_828_hits = [M9(query='QiimeExactMatch.4502806.3.fna_828', subject='NZ_CAAU01001667|642979341', percent_id=76, aln_length=122, mismatches=23, gapopenings=7, q_start=10, q_end=131, s_start=88, s_end=208, evalue=1.03e-12, bitscore=78.0)] exp = [('QiimeExactMatch.4502806.3.fna_161', fna_161_hits), ('QiimeExactMatch.4502806.3.fna_282', fna_282_hits), ('QiimeExactMatch.4502806.3.fna_504', fna_504_hits), ('QiimeExactMatch.4502806.3.fna_562', fna_562_hits), ('QiimeExactMatch.4502806.3.fna_828', fna_828_hits)] obs = parse_m9(self.smrtest) self.assertEqual(obs, exp)
def test_parse_m9_bad(self): """Raise on an incomplete record""" with self.assertRaises(ValueError): parse_m9(self.smrtest_bad)