Esempio n. 1
0
 def testSubjectsPerTaxonomicRankEmptyInput(self):
     """
     subjectsPerTaxonomicRank should return an empty dictionary
     when given an empty input.
     """
     blastHits = BlastHits(None)
     result = taxonomy.subjectsPerTaxonomicRank({}, blastHits, "species")
     self.assertEqual({}, result)
Esempio n. 2
0
 def testSubjectsPerTaxonomicRank(self):
     """
     subjectsPerTaxonomicRank should print the right subject
     for the given taxonomic rank.
     """
     taxIDLookUpDict = {
         1: [
             {"taxID": 1, "parentTaxID": 4, "rank": "species", "scientificName": "mouse"},
             {"taxID": 4, "parentTaxID": 7, "rank": "genus", "scientificName": "mouseian"},
         ],
         2: [{"taxID": 2, "parentTaxID": 5, "rank": "genus", "scientificName": "dog"}],
         3: [{"taxID": 3, "parentTaxID": 6, "rank": "family", "scientificName": "cat"}],
     }
     blastHits = BlastHits(None)
     blastHits.addHit("Smiley Cell Polyomavirus", {"taxID": 1})
     blastHits.addHit("Pink Sheep Virus", {"taxID": 2})
     blastHits.addHit("Flying Elephant Making Virus", {"taxID": 3})
     result = taxonomy.subjectsPerTaxonomicRank(taxIDLookUpDict, blastHits, "species")
     self.assertEqual({"mouse": set(["Smiley Cell Polyomavirus"])}, result)