skbio.alignment.Alignment.get_seq

Alignment.get_seq(id)[source]

Return a sequence from the SequenceCollection by its id.

Parameters:

id, str

The id of the sequence to return.

Returns:

skbio.sequence.BiologicalSequence

The skbio.sequence.BiologicalSequence with id.

Raises:

KeyError

If id is not in the SequenceCollection object.

Examples

>>> from skbio.alignment import SequenceCollection
>>> from skbio.sequence import DNA
>>> sequences = [DNA('A--CCGT.', id="seq1"),
...              DNA('.AACCG-GT.', id="seq2")]
>>> s1 = SequenceCollection(sequences)
>>> print(s1['seq1'])
A--CCGT.