biocantor.io.fasta.fasta
Functions for handling FASTA files. Builds BioCantor sequence objects from various types of FASTA files.
Module Contents
Functions
|
Parser that converts a FASTA to a dictionary of Parents, with sequence symbols as keys. |
|
Take an instantiated |
- biocantor.io.fasta.fasta.fasta_to_parents(fasta_handle: TextIO, alphabet: Optional[inscripta.biocantor.sequence.Alphabet] = Alphabet.NT_EXTENDED_GAPPED) Dict[str, inscripta.biocantor.parent.Parent]
Parser that converts a FASTA to a dictionary of Parents, with sequence symbols as keys.
- Parameters
fasta_handle – Open file handle in text mode.
alphabet – Alphabet this file is in.
- Returns
Dictionary mapping the symbol of the sequence to a
Parent
object.
- biocantor.io.fasta.fasta.collection_to_fasta(collections: Iterable[inscripta.biocantor.gene.AnnotationCollection], fasta_file_handle: TextIO)
Take an instantiated
AnnotationCollection
and produce a FASTA file.- Parameters
collections – Iterable of instantiated
AnnotationCollection
with attached sequence information.fasta_file_handle – Open file handle to write the FASTA to.
- Raises
FastaExportError if there is no sequence attached to any of the collections. –