get_sequence#
- biotite.sequence.io.fasta.get_sequence(fasta_file, header=None, seq_type=None)[source]#
Get a sequence from a
FastaFileinstance.The type of sequence is guessed from the sequence string: First, a conversion into a
NucleotideSequenceand second a conversion into aProteinSequenceis tried.- Parameters:
- fasta_fileFastaFile
The
FastaFileto be accessed.- headerstr, optional
The header to get the sequence from. By default, the first sequence of the file is returned.
- seq_typetype[Sequence], optional
The
Sequencesubclass contained in the file. If not set, the type is automatically inferred asProteinSequenceorNucleotideSequence. For large sequence data it is recommended to set this parameter.
- Returns:
- sequenceNucleotideSequence or ProteinSequence
The requested sequence in the FastaFile.
NucleotideSequenceif the sequence string fits the corresponding alphabet,ProteinSequenceotherwise.
- Raises:
- ValueError
If the sequence data can be neither converted into a
NucleotideSequencenor aProteinSequence.