skbio.alignment.TabularMSA.from_dict#
- classmethod TabularMSA.from_dict(dictionary)[source]#
Create a
TabularMSAfrom adict.- Parameters:
- dictionarydict
Dictionary mapping keys to
GrammaredSequencesequence objects. TheTabularMSAobject will have its index labels set to the keys in the dictionary.
- Returns:
- TabularMSA
TabularMSAobject constructed from the keys and sequences in dictionary.
Notes
The order of sequences and index labels in the resulting
TabularMSAobject is arbitrary. UseTabularMSA.sortto 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