Пример #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 )
Пример #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)
Пример #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 )
Пример #4
0
 def test_getOverlap_zeroOverlap(self):
     '''Two repertoires with zero overlap should return zero overlap'''
     samseqs1 = self.samseqs
     
     #create another repertoire with totally different length
     seqs2 = tcrRepSim.getUniqSeqRep(10, self.aaUsage[11], self.codonUsage)
     tcrRepSim.getRep( seqs2, 50, None )
     samseqs2 = tcrRepSim.sampling( seqs2, 20 )
     reads1, reads2, clones1, clones2, stats1, stats2 = tcrRepSim.getOverlap(samseqs1, samseqs2, [0, 0.01, 10, 20, 100])
     for i in xrange(5):
         self.assertTrue( stats1["oclones"][i] == 0 )
         self.assertTrue( stats2["oclones"][i] == 0 )
         self.assertTrue( stats1["oreads"][i] == 0 )
         self.assertTrue( stats2["oreads"][i] == 0 )