skbio.alignment.TabularMSA.__eq__#

TabularMSA.__eq__(other)[source]#

Determine if this MSA is equal to another.

TabularMSA objects are equal if their sequences, index, metadata, and positional metadata are equal.

Parameters:
otherTabularMSA

MSA to test for equality against.

Returns:
bool

Indicates whether this MSA is equal to other.

Examples

>>> from skbio import DNA, RNA, TabularMSA
>>> msa = TabularMSA([DNA('ACG'), DNA('AC-')])
>>> msa == msa
True

MSAs with different sequence characters are not equal:

>>> msa == TabularMSA([DNA('ACG'), DNA('--G')])
False

MSAs with different types of sequences (different dtype) are not equal:

>>> msa == TabularMSA([RNA('ACG'), RNA('AC-')])
False

MSAs with different sequence metadata are not equal:

>>> msa == TabularMSA([DNA('ACG', metadata={'id': 'a'}), DNA('AC-')])
False

MSAs with different index labels are not equal:

>>> msa == TabularMSA([DNA('ACG'), DNA('AC-')], minter=str)
False

MSAs with different metadata are not equal:

>>> msa == TabularMSA([DNA('ACG'), DNA('AC-')],
...                   metadata={'id': 'msa-id'})
False

MSAs with different positional metadata are not equal:

>>> msa == TabularMSA([DNA('ACG'), DNA('AC-')],
...                   positional_metadata={'prob': [3, 2, 1]})
False