get_sequence
#
- biotite.sequence.io.fasta.get_sequence(fasta_file, header=None, seq_type=None)[source]#
Get a sequence from a
FastaFile
instance.The type of sequence is guessed from the sequence string: First, a conversion into a
NucleotideSequence
and second a conversion into aProteinSequence
is tried.- Parameters:
- fasta_fileFastaFile
The
FastaFile
to be accessed.- headerstr, optional
The header to get the sequence from. By default, the first sequence of the file is returned.
- seq_typeClass, optional
The
Sequence
subclass contained in the file. If not set, biotite will attempt to automatically detect whether a nucleotide or protein sequence is present.
- Returns:
- sequenceNucleotideSequence or ProteinSequence
The requested sequence in the FastaFile.
NucleotideSequence
if the sequence string fits the corresponding alphabet,ProteinSequence
otherwise.
- Raises:
- ValueError
If the sequence data can be neither converted into a
NucleotideSequence
nor aProteinSequence
.