Esempio n. 1
0
 def test_getRep(self): 
     '''getRep should return the desired number of sequences '''
     aaUsage = tcrRepSim.readAaUsage(self.aaUsageFile)
     codonUsage = tcrRepSim.readCodonUsage(self.codonUsageFile)
     seqs = tcrRepSim.getUniqSeqRep(10, aaUsage[9], codonUsage)
     tcrRepSim.getRep( seqs, 50, None )
     total = sum([s.count for s in seqs])
     self.assertTrue( total == 50 )
Esempio n. 2
0
 def test_getUniqSeqRep(self): 
     '''getUniqSeqRep should return the desired number of uniq sequences '''
     aaUsage = tcrRepSim.readAaUsage(self.aaUsageFile)
     codonUsage = tcrRepSim.readCodonUsage(self.codonUsageFile)
     seqs = tcrRepSim.getUniqSeqRep(100, aaUsage[9], codonUsage)
     self.assertTrue( len(seqs) == 100)
     visited = []
     for s in seqs:
         self.assertTrue( s.nuc not in visited )
         visited .append(s.nuc)
Esempio n. 3
0
    def test_sampling(self): 
        '''sampling should return the desired number of sequences '''
        aaUsage = tcrRepSim.readAaUsage(self.aaUsageFile)
        codonUsage = tcrRepSim.readCodonUsage(self.codonUsageFile)
        seqs = tcrRepSim.getUniqSeqRep(10, aaUsage[9], codonUsage)
        tcrRepSim.getRep( seqs, 50, None )

        samseqs = tcrRepSim.sampling( seqs, 20 )
        total = sum([s.count for s in samseqs])

        self.assertTrue( len(samseqs) <= 10 )
        self.assertTrue( total == 20 )
Esempio n. 4
0
 def test_readCodonUsage_goodInput(self):
     '''readCodonUsage: usage of codon should add up to 1 for each a.a'''
     aa2codons = tcrRepSim.readCodonUsage(self.goodEx)
     self.assertTrue( len( aa2codons.keys() ) == 21 )
     for aa, codons in aa2codons.iteritems():
         self.assertTrue( abs(len(codons) - 100) <= 1 )
         for c in codons:
             for letter in c:
                 self.assertTrue( letter in "ACTG" )
     codonsF = aa2codons['F']
     c2c = {}
     for c in codonsF:
         if c in c2c:
             c2c[c] += 1
         else:
             c2c[c] = 1
     self.assertTrue( c2c['TTT'] == 45 )
     self.assertTrue( c2c['TTC'] == 55 )