Last active
August 29, 2015 14:04
-
-
Save xingpel/477550540a88388f7a84 to your computer and use it in GitHub Desktop.
Combine dictionary and fasta heading
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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