skbio.alignment.TabularMSA.from_dict

classmethod TabularMSA.from_dict(dictionary)[source]

Create a TabularMSA from a dict.

State: Experimental as of 0.4.1.

Parameters:dictionary (dict) – Dictionary mapping keys to GrammaredSequence sequence objects. The TabularMSA object will have its index labels set to the keys in the dictionary.
Returns:TabularMSA object constructed from the keys and sequences in dictionary.
Return type:TabularMSA

See also

to_dict(), sort()

Notes

The order of sequences and index labels in the resulting TabularMSA object is arbitrary. Use TabularMSA.sort to set a different order.

Examples

>>> from skbio import DNA, TabularMSA
>>> seqs = {'a': DNA('ACGT'), 'b': DNA('A--T')}
>>> msa = TabularMSA.from_dict(seqs)
>>> msa.shape
Shape(sequence=2, position=4)
>>> 'a' in msa
True
>>> 'b' in msa
True