TabularMSA.
extend
(sequences, minter=None, index=None, reset_index=False)[source]¶Extend this MSA with sequences without recomputing alignment.
State: Experimental as of 0.4.1.
Parameters: |
|
---|---|
Raises: |
|
See also
Notes
The MSA is not automatically re-aligned when appending sequences. Therefore, this operation is not necessarily meaningful on its own.
Examples
Create an MSA with a single sequence labeled 'seq1'
:
>>> from skbio import DNA, TabularMSA
>>> msa = TabularMSA([DNA('ACGT')], index=['seq1'])
>>> msa
TabularMSA[DNA]
---------------------
Stats:
sequence count: 1
position count: 4
---------------------
ACGT
>>> msa.index
Index(['seq1'], dtype='object')
Extend the MSA with sequences, providing their index labels via index:
>>> msa.extend([DNA('AG-T'), DNA('-G-T')], index=['seq2', 'seq3'])
>>> msa
TabularMSA[DNA]
---------------------
Stats:
sequence count: 3
position count: 4
---------------------
ACGT
AG-T
-G-T
>>> msa.index
Index(['seq1', 'seq2', 'seq3'], dtype='object')
Extend with more sequences, this time resetting the MSA’s index labels to the default with reset_index. Note that since the MSA’s index is reset, we do not need to provide index labels for the new sequences via index or minter:
>>> msa.extend([DNA('ACGA'), DNA('AC-T'), DNA('----')],
... reset_index=True)
>>> msa
TabularMSA[DNA]
---------------------
Stats:
sequence count: 6
position count: 4
---------------------
ACGT
AG-T
...
AC-T
----
>>> msa.index
RangeIndex(start=0, stop=6, step=1)