Example #1
0
    def test_make_otu_map_no_taxonomy(self):
        """make_otu_map should work without supplied taxonomy"""
        otu_to_seqid ={ '0':['ABC_0','DEF_1'],
                        '1':['ABC_1'],
                        'x':['GHI_2', 'GHI_3','GHI_77'],
                        'z':['DEF_3','XYZ_1']
                        }
        obs = make_otu_map(otu_to_seqid)
        exp = """#Full OTU Counts
#OTU ID\tABC\tDEF\tGHI\tXYZ
0\t1\t1\t0\t0
1\t1\t0\t0\t0
x\t0\t0\t3\t0
z\t0\t1\t0\t1"""
        self.assertEqual(obs, exp)
Example #2
0
    def test_make_otu_map_taxonomy(self):
        """make_otu_map should work with supplied taxonomy"""
        otu_to_seqid ={ '0':['ABC_0','DEF_1'],
                        '1':['ABC_1'],
                        'x':['GHI_2', 'GHI_3','GHI_77'],
                        'z':['DEF_3','XYZ_1']
                        }
        taxonomy = {'0':'Bacteria;Firmicutes', 'x':'Bacteria;Bacteroidetes'}
        obs = make_otu_map(otu_to_seqid, taxonomy)
        exp = """#Full OTU Counts
#OTU ID\tABC\tDEF\tGHI\tXYZ\tConsensus Lineage
0\t1\t1\t0\t0\tBacteria;Firmicutes
1\t1\t0\t0\t0\tNone
x\t0\t0\t3\t0\tBacteria;Bacteroidetes
z\t0\t1\t0\t1\tNone"""
        self.assertEqual(obs, exp)
Example #3
0
    def test_make_otu_map_no_taxonomy(self):
        """make_otu_map should work without supplied taxonomy"""
        otu_to_seqid = {
            '0': ['ABC_0', 'DEF_1'],
            '1': ['ABC_1'],
            'x': ['GHI_2', 'GHI_3', 'GHI_77'],
            'z': ['DEF_3', 'XYZ_1']
        }
        obs = make_otu_map(otu_to_seqid)
        exp = """#Full OTU Counts
#OTU ID\tABC\tDEF\tGHI\tXYZ
0\t1\t1\t0\t0
1\t1\t0\t0\t0
x\t0\t0\t3\t0
z\t0\t1\t0\t1"""
        self.assertEqual(obs, exp)
Example #4
0
    def test_make_otu_map_taxonomy(self):
        """make_otu_map should work with supplied taxonomy"""
        otu_to_seqid = {
            '0': ['ABC_0', 'DEF_1'],
            '1': ['ABC_1'],
            'x': ['GHI_2', 'GHI_3', 'GHI_77'],
            'z': ['DEF_3', 'XYZ_1']
        }
        taxonomy = {'0': 'Bacteria;Firmicutes', 'x': 'Bacteria;Bacteroidetes'}
        obs = make_otu_map(otu_to_seqid, taxonomy)
        exp = """#Full OTU Counts
#OTU ID\tABC\tDEF\tGHI\tXYZ\tConsensus Lineage
0\t1\t1\t0\t0\tBacteria;Firmicutes
1\t1\t0\t0\t0\tNone
x\t0\t0\t3\t0\tBacteria;Bacteroidetes
z\t0\t1\t0\t1\tNone"""
        self.assertEqual(obs, exp)