Created
October 21, 2015 18:28
-
-
Save skaae/a2a8e85581982d55c288 to your computer and use it in GitHub Desktop.
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
def fasta_names_to_dict(fasta_filename): | |
handin6.py | |
"""Extract FASTA IDs from file to dictionary""" | |
names_dict = {} | |
fasta_file = open(fasta_filename) | |
for line in fasta_file: | |
# Add to dictionary if line starts with '>' | |
# Call to fasta_label_to_id to extract id from line | |
if line.startswith('>'): | |
# We don't need the values in the dictionary - just using "" | |
names_dict[fasta_label_to_id(line)] = "" | |
return names_dict |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment