get_sequences#

biotite.sequence.io.fasta.get_sequences(fasta_file, seq_type=None)[source]#

Get dictionary from a FastaFile instance, where headers are keys and sequences are values.

The type of sequence is guessed from the sequence string: First, a conversion into a NucleotideSequence and second a conversion into a ProteinSequence is tried.

Parameters:
fasta_fileFastaFile

The FastaFile to be accessed.

seq_typetype[Sequence], optional

The Sequence subclass contained in the file. If not set, the type is automatically inferred as ProteinSequence or NucleotideSequence. For large sequence data it is recommended to set this parameter.

Returns:
seq_dictdict

A dictionary that maps headers to NucleotideSequence and/or ProteinSequence instances as values.

Raises:
ValueError

If at least on of the sequence strings can be neither converted into a NucleotideSequence nor a ProteinSequence.