def test_summarize_taxonomic_agreement_multiple_otus(self): """Test writing out the taxonomic agreement for multiple OTUs.""" exp = [ 'A\t2\t\'1\',\'2\'\t100.00%\t100.00%\t50.00%\tA\tB\tC,D\n', 'B\t1\t\'3\'\t100.00%\t100.00%\t100.00%\tA\tZ\tT\n' ] obs = summarize_taxonomic_agreement(self.otu_map2, self.tax_map1, 3) self.assertEqual(obs, exp)
def test_summarize_taxonomic_agreement_standard(self): """Test writing out the taxonomic agreement for seqs in OTUs.""" exp = [ 'A\t3\t\'1\',\'2\',\'3\'\t100.00%\t66.67%\t33.33%\tA\tB,Z\t' 'C,D,T\n' ] obs = summarize_taxonomic_agreement(self.otu_map1, self.tax_map1, 3) self.assertEqual(obs, exp)
def main(): option_parser, opts, args = parse_command_line_parameters(**script_info) results = summarize_taxonomic_agreement( open(opts.otu_map_fp, 'U').readlines(), open(opts.input_taxonomy_map, 'U').readlines()) out_f = open(opts.output_fp, 'w') out_f.write('OTU_ID\tSize\tSeq_IDs\tDomain\tKingdom\tPhylum\tClass\t' 'Order\tFamily\tGenus\tSpecies\tDomain\tKingdom\tPhylum\t' 'Class\tOrder\tFamily\tGenus\tSpecies\n') for line in results: out_f.write(line) out_f.close()
def test_summarize_taxonomic_agreement_multiple_otus(self): """Test writing out the taxonomic agreement for multiple OTUs.""" exp = ['A\t2\t\'1\',\'2\'\t100.00%\t100.00%\t50.00%\tA\tB\tC,D\n', 'B\t1\t\'3\'\t100.00%\t100.00%\t100.00%\tA\tZ\tT\n'] obs = summarize_taxonomic_agreement(self.otu_map2, self.tax_map1, 3) self.assertEqual(obs, exp)
def test_summarize_taxonomic_agreement_standard(self): """Test writing out the taxonomic agreement for seqs in OTUs.""" exp = ['A\t3\t\'1\',\'2\',\'3\'\t100.00%\t66.67%\t33.33%\tA\tB,Z\t' 'C,D,T\n'] obs = summarize_taxonomic_agreement(self.otu_map1, self.tax_map1, 3) self.assertEqual(obs, exp)