Skip to content

Instantly share code, notes, and snippets.

@xingpel
Last active August 29, 2015 14:04
Show Gist options
  • Save xingpel/477550540a88388f7a84 to your computer and use it in GitHub Desktop.
Save xingpel/477550540a88388f7a84 to your computer and use it in GitHub Desktop.
Combine dictionary and fasta heading
data_file = open("sampleData.txt")
result_file = open ("result.txt","w")
for line in data_file:
if "abc" in line:
key=line.split(' ')[0]
key=key.split('>')[1]
for line2 in open("dictionary.txt"):
if key in line2:
result_file.write(">"+line2)
else:
print line.strip('\n')
result_file.write(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment