Exemplo n.º 1
0
 def test_get_name_type(self):
     """should return the (latin|common) name given a latin, common or ensembl
     db prefix names"""
     self.assertEqual(Species.get_species_name("human"), "H**o sapiens")
     self.assertEqual(Species.get_species_name("homo_sapiens"),
                      "H**o sapiens")
     self.assertEqual(Species.get_common_name("Mus musculus"), "Mouse")
     self.assertEqual(Species.get_common_name("mus_musculus"), "Mouse")
Exemplo n.º 2
0
 def test_amend_existing(self):
     """should correctly amend an existing species"""
     species_name = "Ochotona princeps"
     common_name1 = "american pika"
     common_name2 = "pika"
     ensembl_pref = "ochotona_princeps"
     Species.amend_species(species_name, common_name1)
     self.assertEqual(Species.get_common_name(species_name), common_name1)
     Species.amend_species(species_name, common_name2)
     self.assertEqual(Species.get_species_name(common_name2), species_name)
     self.assertEqual(Species.get_species_name(ensembl_pref), species_name)
     self.assertEqual(Species.get_common_name(species_name), common_name2)
     self.assertEqual(Species.get_common_name(ensembl_pref), common_name2)
     self.assertEqual(Species.get_ensembl_db_prefix(species_name), ensembl_pref)
     self.assertEqual(Species.get_ensembl_db_prefix(common_name2), ensembl_pref)
Exemplo n.º 3
0
 def test_add_new_species(self):
     """should correctly add a new species/common combination and infer the
     correct ensembl prefix"""
     species_name, common_name = "Otolemur garnettii", "Bushbaby"
     Species.amend_species(species_name, common_name)
     self.assertEqual(Species.get_species_name(species_name), species_name)
     self.assertEqual(Species.get_species_name("Bushbaby"), species_name)
     self.assertEqual(Species.get_species_name(common_name), species_name)
     self.assertEqual(Species.get_common_name(species_name), common_name)
     self.assertEqual(Species.get_common_name("Bushbaby"), common_name)
     self.assertEqual(Species.get_ensembl_db_prefix("Bushbaby"),
                      "otolemur_garnettii")
     self.assertEqual(Species.get_ensembl_db_prefix(species_name),
                      "otolemur_garnettii")
     self.assertEqual(Species.get_ensembl_db_prefix(common_name),
                      "otolemur_garnettii")
Exemplo n.º 4
0
 def test_synonyms_work(self):
     """species with synonyms should allow correct lookups"""
     self.assertEqual(Species.get_species_name("Canis lupus familiaris"),
                      "Canis familiaris")
     self.assertEqual(Species.get_common_name("Canis lupus familiaris"),
                      "Dog")
     self.assertEqual(
         Species.get_ensembl_db_prefix("Canis lupus familiaris"),
         "canis_familiaris")
     self.assertEqual(Species.get_compara_name("Canis lupus familiaris"),
                      "Dog")