Created
October 21, 2015 18:25
-
-
Save skaae/495ee88bf8581d96add8 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_list(fasta_filename): | |
'''Extract FASTA IDs from file to list''' | |
names = [] | |
# Open fasta file | |
fasta_file = open(fasta_filename) | |
# Iterate over lines | |
for line in fasta_file: | |
# Add to list if line starts with '>' | |
# Call to fasta_label_to_id to extract id from line | |
if line.startswith('>'): | |
names.append(fasta_label_to_id(line)) | |
return names |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment