Beispiel #1
0
def run_sp_acc_update(inf,outf,updateaccs_f):
	
	updateaccs_f.seek(0)
	update_dict = my_gb.make_update_dict(updateaccs_f)
	
	line = inf.readline()
	while line:
		tmp = string.split(line)
		key = tmp[len(tmp)-1]
		
		if update_dict.has_key(key):
			value = update_dict[key]
			line = tmp[0] + '\t' + tmp[1] + '\t' + value + '\n'
		else:
			sys.stderr.write("%s: no update_acc found\n" % key)
			
		outf.write(line)

		line = inf.readline()
Beispiel #2
0
def run_embl_pr2est(inf,outf,embl_pr2est_f):
	
	embl_pr2est_f.seek(0)
	embl_pr2est_dict = my_gb.make_update_dict(embl_pr2est_f)
	
	line = inf.readline()
	while line:
		tmp = string.split(line)
		key = tmp[len(tmp)-1]
		
		if embl_pr2est_dict.has_key(key):
			value = embl_pr2est_dict[key]
			line = line[0:len(line)-1] + '\t' + value + '\n'
		else:
			sys.stderr.write("%s: EST not found\n" % key)
			
		outf.write(line)

		line = inf.readline()
Beispiel #3
0
def run_fasta_title_update(inf,outf,sdgnames_f):
	
	from Bio import Fasta
	parser = Fasta.RecordParser()
	fasta_iterator = Fasta.Iterator(inf,parser)

	
	sdgnames_f.seek(0)
	sdgnames_dict = my_gb.make_update_dict(sdgnames_f)
	
	while 1:
		record = fasta_iterator.next()

		if record is None:
			break
		
		if sdgnames_dict.has_key(record.title):
		
			value = sdgnames_dict[record.title]
		else:
			value = record.title

		outf.write('>%s\n%s\n' % (value,record.sequence))