TabularMSA.
append
(sequence, minter=None, index=None, reset_index=False)[source]¶Append a sequence to the MSA without recomputing alignment.
State: Experimental as of 0.4.1.
Parameters: | sequence : GrammaredSequence
minter : callable or metadata key, optional
index : object, optional
reset_index : bool, optional
|
---|---|
Raises: | ValueError
TypeError
TypeError
ValueError
|
See also
Notes
The MSA is not automatically re-aligned when a sequence is appended. 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')
Append a new sequence to the MSA, providing its index label via index:
>>> msa.append(DNA('AG-T'), index='seq2')
>>> msa
TabularMSA[DNA]
---------------------
Stats:
sequence count: 2
position count: 4
---------------------
ACGT
AG-T
>>> msa.index
Index(['seq1', 'seq2'], dtype='object')
Append another sequence, 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 an index label for the new sequence via index or minter:
>>> msa.append(DNA('ACGA'), reset_index=True)
>>> msa
TabularMSA[DNA]
---------------------
Stats:
sequence count: 3
position count: 4
---------------------
ACGT
AG-T
ACGA
>>> msa.index
RangeIndex(start=0, stop=3, step=1)