skbio.alignment.TabularMSA.to_dict#

TabularMSA.to_dict()[source]#

Create a dict from this TabularMSA.

Returns:
dict

Dictionary constructed from the index labels and sequences in this TabularMSA.

Raises:
ValueError

If index labels are not unique.

See also

from_dict
index
reassign_index

Examples

>>> from skbio import DNA, TabularMSA
>>> seqs = [DNA('ACGT'), DNA('A--T')]
>>> msa = TabularMSA(seqs, index=['a', 'b'])
>>> dictionary = msa.to_dict()
>>> dictionary == {'a': DNA('ACGT'), 'b': DNA('A--T')}
True