Skip to content
Snippets Groups Projects
Commit a8955c54 authored by Michael Sandholzer's avatar Michael Sandholzer
Browse files

new file: read_sequencer_package/read_in_FASTA.py

parent 425a8d43
No related branches found
No related tags found
1 merge request!4Function to read in FASTA files and returns a dictionary new file: read_sequencer_package/read_in_FASTA.py
This commit is part of merge request !4. Comments created here will be created in the context of that merge request.
'''
This function reads in FASTA files
argument is file_path
it returns a dictionary with the sequences
'''
import sys
def read_in_fasta(file_path):
sequences = {}
f = open(file_path)
for line in f:
if line[0] == '>':
defline = line.srtip()
defline = defline.replace('>', '')
else:
if defline not in sequences:
sequences[defline] = ''
sequences[defline] += line.strip()
return sequences
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment