Beispiel #1
0
 def test_subst_ranks(self):
     testfile_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "testfiles")
     tax_fname = os.path.join(testfile_dir, "test.tax")
     tax = Taxonomy("", tax_fname)
     old_ranks = tax.get_seq_ranks("WgeSangu")
     self.assertEqual(old_ranks[-2], 'Sneathia')
     syn_map = {'Sneathia' : 'Sebaldella'}
     tax.subst_synonyms(syn_map)
     new_ranks = tax.get_seq_ranks("WgeSangu")
     self.assertEqual(old_ranks[-2], 'Sebaldella')
Beispiel #2
0
 def test_normalize_rank_names(self):
     tax = Taxonomy(tax_map=self.taxonomy.seq_ranks_map)
     ranks = tax.get_seq_ranks("UpbRectu")
     self.assertEqual(ranks[0], "[Bacteria]")
     self.assertEqual(ranks[1], "'Firmicutes'")
     self.assertEqual(ranks[2], "Clostridia(1)")
     corr_ranks = tax.normalize_rank_names()
     self.assertEqual(len(corr_ranks), 3)
     ranks = tax.get_seq_ranks("UpbRectu")
     self.assertEqual(ranks[0], "_Bacteria_")
     self.assertEqual(ranks[1], "_Firmicutes_")
     self.assertEqual(ranks[2], "Clostridia_1_")
Beispiel #3
0
 def test_normalize_rank_names(self):
     tax = Taxonomy(tax_map=self.taxonomy.seq_ranks_map)
     ranks = tax.get_seq_ranks("UpbRectu")
     self.assertEqual(ranks[0], "[Bacteria]")
     self.assertEqual(ranks[1], "'Firmicutes'")
     self.assertEqual(ranks[2], "Clostridia(1)")
     corr_ranks = tax.normalize_rank_names()
     self.assertEqual(len(corr_ranks), 3)
     ranks = tax.get_seq_ranks("UpbRectu")
     self.assertEqual(ranks[0], "_Bacteria_")
     self.assertEqual(ranks[1], "_Firmicutes_")
     self.assertEqual(ranks[2], "Clostridia_1_")