Last active
December 16, 2015 01:53
-
-
Save mdshw5/fcf00f56feb4802b53bc to your computer and use it in GitHub Desktop.
biostars 169723
This file contains hidden or 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
from pyfaidx import Fasta | |
file_1 = {} | |
with open('file1.txt', 'r') as ids: | |
for line in ids: | |
key, value = line.strip().split('\t') | |
file_1[key] = value | |
file_2 = Fasta('file2.fa', key_function=lambda key: file_1[key]) | |
with open('file3.fa', 'w') as renamed: | |
for entry in file_2: | |
print(entry.name, file=renamed) | |
for line in entry: | |
print(line, file=renamed) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment