def mothur_from_file(file): app = Mothur(InputHandler='_input_as_lines') result = app(file) # Force evaluation, so we can safely clean up files otus = list(parse_otu_list(result['otu list'])) result.cleanUp() return otus
def test_parse_otu_list(self): observed = list(parse_otu_list(StringIO(mothur_output))) expected = [ (0.0, [['cccccc'], ['bbbbbb'], ['aaaaaa']]), (0.62, [['bbbbbb', 'cccccc'], ['aaaaaa']]), (0.67000000000000004, [['aaaaaa', 'bbbbbb', 'cccccc']]) ] self.assertEqual(observed, expected)