Esempio n. 1
0
 def test_init(self):
     """NcbiNameLookup should map taxon ids to scientific names"""
     names = list(NcbiNameParser(good_names))  # list of objects
     sci_names = NcbiNameLookup(names)  # NcbiNameLookup object
     root = names[1]  # NcbiName object made from 2nd line of good_name_file
     bacteria = names[2]  # from 3rd line of good_name_file
     azorhizobium = names[7]
     caulinodans = names[8]
     assert sci_names[1] is root  # gets NcbiName object from the
     assert sci_names[2] is bacteria  # NcbiNameLookup object and
     assert sci_names[6] is azorhizobium  # asks if it is the original
     assert sci_names[7] is caulinodans  # NcbiName object
     self.assertEqual(sci_names[1].Name, "root")
     self.assertEqual(sci_names[2].Name, "Bacteria")
     self.assertEqual(sci_names[7].Name, "Azorhizobium caulinodans")
     self.assertEqual(sci_names[9].Name, "Buchnera aphidicola")
Esempio n. 2
0
 def setUp(self):
     """Sets up the class tests"""
     self.names = list(NcbiNameParser(good_names))
     self.nodes = list(NcbiTaxonParser(good_nodes))
     self.taxID_to_obj = NcbiTaxonLookup(self.nodes)
     self.names_to_obj = NcbiNameLookup(self.names)