Esempio n. 1
0
 def test_get_genes(self):
     stat1 = geneusage.sample_geneusage_stat(self.s1)
     stat2 = geneusage.sample_geneusage_stat(self.s2)
     vs = geneusage.get_genes([stat1, stat2], 'v')
     self.assertEqual(sorted(vs), ['v1', 'v2', 'v3', 'v5'])
     js = geneusage.get_genes([stat1, stat2], 'j')
     self.assertEqual(sorted(js), ['j1', 'j3', 'j5'])
     ds = geneusage.get_genes([stat1, stat2], 'd')
     self.assertEqual(sorted(ds), ['d1'])
     vjs = geneusage.get_genes([stat1, stat2], 'vj')
     self.assertEqual(sorted(vjs), ['v1|j1', 'v2|j1', 'v3|j3', 'v5|j5'])
     djs = geneusage.get_genes([stat1, stat2], 'dj')
     self.assertEqual(sorted(djs), ['d1|j1'])
Esempio n. 2
0
    def test_get_geneusage(self):
        stat1 = geneusage.sample_geneusage_stat(self.s1)
        v = geneusage.get_geneusage(stat1, ('clones', 'v', 'v1'))
        self.assertEqual(v, 0.5)

        j = geneusage.get_geneusage(stat1, ('reads', 'vj', 'v2|j9'))
        self.assertEqual(j, 0.0)
Esempio n. 3
0
 def test_sample_geneusage_stat(self):
     stat = geneusage.sample_geneusage_stat(self.s1)
     t2g2c = {'v': {'v1': 1.5/3, 'v2': 0.5/3, 'v3': 1.0/3},
              'd': {},
              'j': {'j1': 2.0/3, 'j3': 1.0/3},
              'vj': {'v1|j1': 1.5/3, 'v2|j1': 0.5/3, 'v3|j3': 1.0/3},
              'dj': {}}
     self.assertEqual(t2g2c, stat.type2gene2clones)
     
     t2g2r = {'v': {'v1': 0.35, 'v2': 0.25, 'v3': 0.4},
              'd': {},
              'j': {'j1': 0.6, 'j3': 0.4},
              'vj': {'v1|j1': 0.35, 'v2|j1': 0.25, 'v3|j3': 0.4},
              'dj': {}}
     self.assertEqual(t2g2r, stat.type2gene2reads)
     
     # s2 with d info
     stat2 = geneusage.sample_geneusage_stat(self.s2)
     t2g2c = {'v': {'v1': 1.0/2, 'v5': 1.0/2},
              'd': {'d1': 1.0/2},
              'j': {'j1': 1.0/2, 'j5': 1.0/2},
              'vj': {'v1|j1': 1.0/2, 'v5|j5': 1.0/2},
              'dj': {'d1|j1': 1.0/2}}
     self.assertEqual(t2g2c, stat2.type2gene2clones)