Returns new Alignment that is a subset of the current Alignment
Parameters: | seqs_to_keep : list, optional
positions_to_keep : list, optional
invert_seqs_to_keep : bool, optional
invert_positions_to_keep : bool, optional
|
---|---|
Returns: | Alignment
|
Examples
>>> from skbio.alignment import Alignment
>>> from skbio.sequence import DNA
>>> seqs = [DNA("A-CCGGG", id="s1"),
... DNA("ATCC--G", id="s2"),
... DNA("ATCCGGA", id="s3")]
>>> a1 = Alignment(seqs)
>>> a1
<Alignment: n=3; mean +/- std length=7.00 +/- 0.00>
>>> a1.subalignment(seqs_to_keep=["s1", "s2"])
<Alignment: n=2; mean +/- std length=7.00 +/- 0.00>
>>> a1.subalignment(seqs_to_keep=["s1", "s2"],
... invert_seqs_to_keep=True)
<Alignment: n=1; mean +/- std length=7.00 +/- 0.00>
>>> a1.subalignment(positions_to_keep=[0, 2, 3, 5])
<Alignment: n=3; mean +/- std length=4.00 +/- 0.00>
>>> a1.subalignment(positions_to_keep=[0, 2, 3, 5],
... invert_positions_to_keep=True)
<Alignment: n=3; mean +/- std length=3.00 +/- 0.00>
>>> a1.subalignment(seqs_to_keep=["s1", "s2"],
... positions_to_keep=[0, 2, 3, 5])
<Alignment: n=2; mean +/- std length=4.00 +/- 0.00>