Пример #1
0
	def test_run(self):
		"""secondOrFirstField"""
		x = 'FIRST SECOND'
		self.assertTrue(biofile.firstField(x)=='FIRST')
		self.assertTrue(biofile.secondField(x)=='SECOND')
		y = 'FIRST'
		self.assertTrue(biofile.secondOrFirstField(y)=='FIRST')
Пример #2
0
	def secondField(h):
		f = None
		try:
			f = biofile.secondField(h)
		except:
			f = biofile.firstField(h)
		return f
Пример #3
0
	def secondField(h):
		f = None
		try:
			f = biofile.secondField(h)
		except:
			f = biofile.firstField(h)
		return f
Пример #4
0
	info_outs = util.OutStreams(sys.stdout)
	outs = util.OutStreams()
	params_outs = util.OutStreams([outs])
	if not options.out_fname is None:
		outf = open(os.path.expanduser(options.out_fname),'w')
		outs.addStream(outf)
	else:
		outs.addStream(sys.stdout)

	orf_dict = None
	gene_orf_map = None
	if not options.fasta_fname is None:
		fname = os.path.expanduser(options.fasta_fname)
		(headers, sequences) = biofile.readFASTA(fname)
		orf_dict = dict(zip([biofile.firstField(h) for h in headers], sequences))
		gene_orf_map = dict([(biofile.secondField(h), biofile.firstField(h)) for h in headers])

	
	# Set the weight matrix
	try:
		matrix = motif.weight_matrices[options.pssm_name]
	except KeyError as ke:
		outs.write("# Unable to find weight matrix {}; try one of {}\n".format(options.pssm_name, ','.join(motif.weight_matrices.keys())))
	window_size = len(matrix['A']) #len(matrix.values()[0])
	# for associating windows with residues, center them
	mid_window = int(math.floor(window_size/2.0))
	
	# Write out parameters
	params_outs.write("# Run started {}\n".format(util.timestamp()))
	params_outs.write("# Command: {}\n".format(' '.join(sys.argv)))
	params_outs.write("# Parameters:\n")