skbio.alignment.Alignment.__getitem__

Alignment.__getitem__(index)[source]

The indexing operator.

Parameters:

index : int, str

The position or sequence id of the skbio.sequence.BiologicalSequence to return from the SequenceCollection.

Returns:

skbio.sequence.BiologicalSequence

The skbio.sequence.BiologicalSequence at the specified index in the SequenceCollection.

Examples

>>> from skbio.alignment import SequenceCollection
>>> from skbio.sequence import DNA
>>> sequences = [DNA('ACCGT', id="seq1"),
...              DNA('AACCGGT', id="seq2")]
>>> s1 = SequenceCollection(sequences)
>>> s1[0]
<DNASequence: ACCGT (length: 5)>
>>> s1["seq1"]
<DNASequence: ACCGT (length: 5)>