def __taxonomy(self, img, genomeIds, outputTaxonomy): metadata = img.genomeMetadata() fout = open(outputTaxonomy, "w") for genomeId in genomeIds: fout.write("IMG_" + genomeId + "\t") taxonomy = appendTaxonomyRanks(metadata[genomeId]["taxonomy"]) taxonomy = [x.replace("unclassified", "") for x in taxonomy] fout.write("; ".join(taxonomy) + "\n") fout.close()
def __taxonomy(self, img, genomeIds, outputTaxonomy): metadata = img.genomeMetadata() fout = open(outputTaxonomy, 'w') for genomeId in genomeIds: fout.write('IMG_' + genomeId + '\t') taxonomy = appendTaxonomyRanks(metadata[genomeId]['taxonomy']) taxonomy = [x.replace('unclassified', '') for x in taxonomy] fout.write('; '.join(taxonomy) + '\n') fout.close()
def testAppendTaxonomyRanks(self): """Verify computation of base count on mixed-case sequence.""" r = appendTaxonomyRanks(['k', 'p', 'c'], ranks=3) self.assertEqual(r, ['k__k', 'p__p', 'c__c'])