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 )
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 )