Exemplo n.º 1
0
 def testReadsPerTaxonomicRankEmptyInput(self):
     """
     readsPerTaxonomicRank should return an empty dictionary
     when given an empty input.
     """
     blastHits = BlastHits(None)
     result = taxonomy.readsPerTaxonomicRank({}, blastHits, "species")
     self.assertEqual({}, result)
Exemplo n.º 2
0
    def testReadsPerTaxonomicRank(self):
        """
        readsPerTaxonomicRank should print the right readNum
        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, "plotInfo": {"items": [{"readNum": 1234}]}})
        blastHits.addHit("Pink Sheep Virus", {"taxID": 2, "plotInfo": {"items": [{"readNum": 1235}]}})
        blastHits.addHit("Flying Elephant Making Virus", {"taxID": 3, "plotInfo": {"items": [{"readNum": 1236}]}})

        result = taxonomy.readsPerTaxonomicRank(taxIDLookUpDict, blastHits, "species")
        self.assertEqual({"mouse": set([1234])}, result)