fasta_parser(filename,
template=None,
greedy=None,
dogaps=False)
| source code
|
Given a filename, returns an iterator that will iterate over
the fasta file. It will yield dictionaries keyed according
to the fields in template . These dictionaries
will all also include a sequence keyed by "sequence". Yielding
dictionaries allows for flexibility in the types of fasta files
parsed.
File format testing is not done, so make sure its a fasta file.
- Parameters:
filename (str) - name of the fasta file
template (FastaTemplate) - instance of FastaTemplate class--choose from
TEMPLATES or define your own.
greedy (bool) - a bool specifying whether to read the whole fasta
file in at once. Set to True for many smaller files
or to False for a few or one REALLY big ones.
dogaps - a bool specifying whether to keep "-" in
the sequence after parsing the file
-
if
False , then gaps are ignored
-
handy if processing an alignment
|