本文整理汇总了Python中skbio.TabularMSA.metadata方法的典型用法代码示例。如果您正苦于以下问题:Python TabularMSA.metadata方法的具体用法?Python TabularMSA.metadata怎么用?Python TabularMSA.metadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类skbio.TabularMSA
的用法示例。
在下文中一共展示了TabularMSA.metadata方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_metadata_setter
# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import metadata [as 别名]
def test_metadata_setter(self):
msa = TabularMSA([DNA('A-A'), DNA('A-G')])
self.assertFalse(msa.has_metadata())
msa.metadata = {'hello': 'world'}
self.assertTrue(msa.has_metadata())
self.assertEqual(msa.metadata, {'hello': 'world'})
msa.metadata = {}
self.assertFalse(msa.has_metadata())
示例2: test_metadata_setter_invalid_type
# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import metadata [as 别名]
def test_metadata_setter_invalid_type(self):
msa = TabularMSA([Protein('PAW')], metadata={123: 456})
for md in (None, 0, 'a', ('f', 'o', 'o'), np.array([]),
pd.DataFrame()):
with six.assertRaisesRegex(self, TypeError,
'metadata must be a dict'):
msa.metadata = md
self.assertEqual(msa.metadata, {123: 456})
示例3: test_metadata_setter_makes_shallow_copy
# 需要导入模块: from skbio import TabularMSA [as 别名]
# 或者: from skbio.TabularMSA import metadata [as 别名]
def test_metadata_setter_makes_shallow_copy(self):
msa = TabularMSA([RNA('-.-'), RNA('.-.')])
md = {'foo': 'bar', 42: []}
msa.metadata = md
self.assertEqual(msa.metadata, md)
self.assertIsNot(msa.metadata, md)
md['foo'] = 'baz'
self.assertEqual(msa.metadata, {'foo': 'bar', 42: []})
md[42].append(True)
self.assertEqual(msa.metadata, {'foo': 'bar', 42: [True]})