本文整理匯總了Python中qiime.sdk.Artifact.extract方法的典型用法代碼示例。如果您正苦於以下問題:Python Artifact.extract方法的具體用法?Python Artifact.extract怎麽用?Python Artifact.extract使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qiime.sdk.Artifact
的用法示例。
在下文中一共展示了Artifact.extract方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_extract
# 需要導入模塊: from qiime.sdk import Artifact [as 別名]
# 或者: from qiime.sdk.Artifact import extract [as 別名]
def test_extract(self):
fp = os.path.join(self.test_dir.name, 'artifact.qza')
artifact = Artifact._from_view([-1, 42, 0, 43], FourInts,
self.provenance)
artifact.save(fp)
output_dir = os.path.join(self.test_dir.name, 'artifact-extract-test')
result_dir = Artifact.extract(fp, output_dir=output_dir)
self.assertEqual(result_dir, output_dir)
contents = [
'artifact/VERSION',
'artifact/metadata.yaml',
'artifact/README.md',
'artifact/data/file1.txt',
'artifact/data/file2.txt',
'artifact/data/nested/file3.txt',
'artifact/data/nested/file4.txt']
for fp in contents:
expected_fp = os.path.join(output_dir, fp)
self.assertTrue(os.path.exists(expected_fp),
'File %s was not extracted.' % fp)
示例2: test_extract
# 需要導入模塊: from qiime.sdk import Artifact [as 別名]
# 或者: from qiime.sdk.Artifact import extract [as 別名]
def test_extract(self):
fp = os.path.join(self.test_dir.name, 'artifact.qza')
artifact = Artifact.import_data(FourInts, [-1, 42, 0, 43])
artifact.save(fp)
root_dir = str(artifact.uuid)
output_dir = os.path.join(self.test_dir.name, 'artifact-extract-test')
result_dir = Artifact.extract(fp, output_dir=output_dir)
self.assertEqual(result_dir, os.path.join(output_dir, root_dir))
expected = {
'VERSION',
'metadata.yaml',
'data/file1.txt',
'data/file2.txt',
'data/nested/file3.txt',
'data/nested/file4.txt',
'provenance/metadata.yaml',
'provenance/VERSION',
'provenance/action/action.yaml'
}
self.assertExtractedArchiveMembers(output_dir, root_dir, expected)