Beispiel #1
0
	def testOverlap(self):
		t0 = classes.trfHit(['seq1','12','224','55','2.1','55','91','0','300','33','19','15','30','1.93','CTCTAAAAACCTTGATTCATTGTTTAACGAGCTTGACACAAGACAAGGAACTATG','CTCTAAAAACCTTGATTCATTGTTTAACGAGCTTGACACAAGACAAGGAACTATGCTCTAAAATCCTTGATTCATTTTTTAATGAGCTTGACACAAGGTAAGGAACTATGCTC'])
		t1 = classes.trfHit(['seq1','225','337','55','2.1','55','91','0','181','33','19','15','30','1.93','CTCTAAAAACCTTGATTCATTGTTTAACGAGCTTGACACAAGACAAGGAACTATG','CTCTAAAAACCTTGATTCATTGTTTAACGAGCTTGACACAAGACAAGGAACTATGCTCTAAAATCCTTGATTCATTTTTTAATGAGCTTGACACAAGGTAAGGAACTATGCTC'])
		t2 = classes.trfHit(['seq1','230','330','55','2.1','55','91','0','180','33','19','15','30','1.93','CTCTAAAAACCTTGATTCATTGTTTAACGAGCTTGACACAAGACAAGGAACTATG','CTCTAAAAACCTTGATTCATTGTTTAACGAGCTTGACACAAGACAAGGAACTATGCTCTAAAATCCTTGATTCATTTTTTAATGAGCTTGACACAAGGTAAGGAACTATGCTC'])
		t3 = classes.trfHit(['seq2','225','337','55','2.1','55','91','0','181','33','19','15','30','1.93','CTCTAAAAACCTTGATTCATTGTTTAACGAGCTTGACACAAGACAAGGAACTATG','CTCTAAAAACCTTGATTCATTGTTTAACGAGCTTGACACAAGACAAGGAACTATGCTCTAAAATCCTTGATTCATTTTTTAATGAGCTTGACACAAGGTAAGGAACTATGCTC'])

		self.assertFalse(trfStats.overlap(t0,t1))
		self.assertTrue(trfStats.overlap(t1,t2))
		self.assertFalse(trfStats.overlap(t0,t3))
Beispiel #2
0
def parseDat(args):
	trfDict = defaultdict(list)
	seq_name = ''
	for line in open(args.trf_output).read().split('\n'):	
		if line.startswith('Seq'):
			seq_name = line[len('Sequence: '):]
		if line != '' and line.split()[0].isdigit():
			fields = line.split()
			fields.insert(0,seq_name)
			newTandem = trfHit(fields)
			if args.filter_monomers:
				filterTRFDict(newTandem,trfDict,"monomers")
			elif args.filter_multimers:
				filterTRFDict(newTandem,trfDict,"multimers")
			else:
				trfDict[seq_name].append(newTandem)
	return trfDict
Beispiel #3
0
def parseNGS(args):
	trfDict = defaultdict(list)
	seq_name = ''
	count = 0
	for line in open(args.trf_output).read().split('\n'):	
		if line.startswith('@'):
			seq_name = line[1:]
		elif line != '':
			fields = line.split()
			fields.insert(0,seq_name)
			newTandem = trfHit(fields)
			if args.filter_monomers:
				filterTRFDict(newTandem,trfDict,"monomers")
			elif args.filter_multimers:
				filterTRFDict(newTandem,trfDict,"multimers")
			else:
				trfDict[seq_name].append(newTandem)
	return trfDict