當前位置: 首頁>>代碼示例>>Python>>正文


Python sdk.Visualization類代碼示例

本文整理匯總了Python中qiime.sdk.Visualization的典型用法代碼示例。如果您正苦於以下問題:Python Visualization類的具體用法?Python Visualization怎麽用?Python Visualization使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Visualization類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_ne_same_data_different_uuid

    def test_ne_same_data_different_uuid(self):
        visualization1 = Visualization._from_data_dir(
            self.data_dir, self.make_provenance_capture())
        visualization2 = Visualization._from_data_dir(
            self.data_dir, self.make_provenance_capture())

        self.assertNotEqual(visualization1, visualization2)
開發者ID:qiime2,項目名稱:qiime2,代碼行數:7,代碼來源:test_visualization.py

示例2: test_load_and_save

    def test_load_and_save(self):
        fp1 = os.path.join(self.test_dir.name, 'visualization1.qzv')
        fp2 = os.path.join(self.test_dir.name, 'visualization2.qzv')
        visualization = Visualization._from_data_dir(self.data_dir,
                                                     self.provenance)
        visualization.save(fp1)

        visualization = Visualization.load(fp1)
        # Overwriting its source file works.
        visualization.save(fp1)
        # Saving to a new file works.
        visualization.save(fp2)

        with zipfile.ZipFile(fp1, mode='r') as zf:
            fps = set(zf.namelist())
            expected = {
                'visualization1/VERSION',
                'visualization1/metadata.yaml',
                'visualization1/README.md',
                'visualization1/data/index.html',
                'visualization1/data/css/style.css'
            }
            self.assertEqual(fps, expected)

        with zipfile.ZipFile(fp2, mode='r') as zf:
            fps = set(zf.namelist())
            expected = {
                'visualization2/VERSION',
                'visualization2/metadata.yaml',
                'visualization2/README.md',
                'visualization2/data/index.html',
                'visualization2/data/css/style.css'
            }
            self.assertEqual(fps, expected)
開發者ID:Kleptobismol,項目名稱:qiime2,代碼行數:34,代碼來源:test_visualization.py

示例3: test_eq_same_uuid

    def test_eq_same_uuid(self):
        fp = os.path.join(self.test_dir.name, 'visualization.qzv')
        visualization1 = Visualization._from_data_dir(
            self.data_dir, self.make_provenance_capture())
        visualization1.save(fp)

        visualization2 = Visualization.load(fp)

        self.assertEqual(visualization1, visualization2)
開發者ID:qiime2,項目名稱:qiime2,代碼行數:9,代碼來源:test_visualization.py

示例4: test_load

    def test_load(self):
        saved_visualization = Visualization._from_data_dir(self.data_dir, None)
        fp = os.path.join(self.test_dir.name, 'visualization.qzv')
        saved_visualization.save(fp)

        visualization = Visualization.load(fp)

        self.assertEqual(visualization.type, qiime.core.type.Visualization)
        self.assertIsNone(visualization.provenance)
        self.assertEqual(visualization.uuid, saved_visualization.uuid)
開發者ID:Kleptobismol,項目名稱:qiime2,代碼行數:10,代碼來源:test_visualization.py

示例5: test_get_index_paths_single_load

    def test_get_index_paths_single_load(self):
        fp = os.path.join(self.test_dir.name, 'visualization.qzv')
        visualization = Visualization._from_data_dir(self.data_dir,
                                                     self.provenance)
        visualization.save(fp)
        visualization = Visualization.load(fp)

        actual = visualization.get_index_paths()
        expected = {'html': 'data/index.html'}
        self.assertEqual(actual, expected)
開發者ID:Kleptobismol,項目名稱:qiime2,代碼行數:10,代碼來源:test_visualization.py

示例6: test_peek

    def test_peek(self):
        visualization = Visualization._from_data_dir(self.data_dir, None)
        fp = os.path.join(self.test_dir.name, 'visualization.qza')
        visualization.save(fp)

        metadata = Visualization.peek(fp)

        self.assertIsInstance(metadata, ResultMetadata)
        self.assertEqual(metadata.type, qiime.core.type.Visualization)
        self.assertIsNone(metadata.provenance)
        self.assertEqual(metadata.uuid, visualization.uuid)
開發者ID:Kleptobismol,項目名稱:qiime2,代碼行數:11,代碼來源:test_visualization.py

示例7: test_ne_different_data_different_uuid

    def test_ne_different_data_different_uuid(self):
        visualization1 = Visualization._from_data_dir(
            self.data_dir, self.make_provenance_capture())

        data_dir = os.path.join(self.test_dir.name, 'mc-viz-output1')
        os.mkdir(data_dir)
        most_common_viz(data_dir,
                        collections.Counter(range(42)))
        visualization2 = Visualization._from_data_dir(
            data_dir, self.make_provenance_capture())

        self.assertNotEqual(visualization1, visualization2)
開發者ID:qiime2,項目名稱:qiime2,代碼行數:12,代碼來源:test_visualization.py

示例8: test_peek

    def test_peek(self):
        visualization = Visualization._from_data_dir(
            self.data_dir, self.make_provenance_capture())
        fp = os.path.join(self.test_dir.name, 'visualization.qzv')
        visualization.save(fp)

        metadata = Visualization.peek(fp)

        self.assertIsInstance(metadata, ResultMetadata)
        self.assertEqual(metadata.type, 'Visualization')
        self.assertEqual(metadata.uuid, str(visualization.uuid))
        self.assertIsNone(metadata.format)
開發者ID:qiime2,項目名稱:qiime2,代碼行數:12,代碼來源:test_visualization.py

示例9: test_roundtrip

    def test_roundtrip(self):
        fp1 = os.path.join(self.test_dir.name, 'visualization1.qzv')
        fp2 = os.path.join(self.test_dir.name, 'visualization2.qzv')
        visualization = Visualization._from_data_dir(
            self.data_dir, self.make_provenance_capture())
        visualization.save(fp1)

        visualization1 = Visualization.load(fp1)
        visualization1.save(fp2)
        visualization2 = Visualization.load(fp2)

        self.assertEqual(visualization1.type, visualization2.type)
        self.assertEqual(visualization1.uuid, visualization2.uuid)
開發者ID:qiime2,項目名稱:qiime2,代碼行數:13,代碼來源:test_visualization.py

示例10: test_get_index_paths_multiple_html_load

    def test_get_index_paths_multiple_html_load(self):
        data_dir = os.path.join(self.test_dir.name, 'multi-html-viz1')
        os.mkdir(data_dir)
        multi_html_viz(data_dir, [1, 42])

        fp = os.path.join(self.test_dir.name, 'visualization.qzv')
        visualization = Visualization._from_data_dir(data_dir,
                                                     self.provenance)
        visualization.save(fp)
        visualization = Visualization.load(fp)

        with self.assertRaises(ValueError):
            visualization.get_index_paths()
開發者ID:Kleptobismol,項目名稱:qiime2,代碼行數:13,代碼來源:test_visualization.py

示例11: test_get_index_paths_multiple_load

    def test_get_index_paths_multiple_load(self):
        data_dir = os.path.join(self.test_dir.name, 'mc-viz-output1')
        os.mkdir(data_dir)
        most_common_viz(data_dir,
                        collections.Counter(range(42)))
        fp = os.path.join(self.test_dir.name, 'visualization.qzv')
        visualization = Visualization._from_data_dir(data_dir,
                                                     self.provenance)
        visualization.save(fp)
        visualization = Visualization.load(fp)

        actual = visualization.get_index_paths()
        expected = {'html': 'data/index.html',
                    'tsv': 'data/index.tsv'}
        self.assertEqual(actual, expected)
開發者ID:Kleptobismol,項目名稱:qiime2,代碼行數:15,代碼來源:test_visualization.py

示例12: inspect_visualization

def inspect_visualization(uuid):
    try:
        metadata = Visualization.peek(VISUALIZATIONS[uuid])
    except Exception:
        abort(404)

    return jsonify({'uuid': metadata.uuid, 'type': metadata.type})
開發者ID:robertoalvarezm,項目名稱:qiime-studio,代碼行數:7,代碼來源:workspace.py

示例13: test_from_data_dir_with_provenance

    def test_from_data_dir_with_provenance(self):
        visualization = Visualization._from_data_dir(self.data_dir,
                                                     self.provenance)

        self.assertEqual(visualization.type, qiime.core.type.Visualization)
        self.assertEqual(visualization.provenance, self.provenance)
        self.assertIsInstance(visualization.uuid, uuid.UUID)
開發者ID:Kleptobismol,項目名稱:qiime2,代碼行數:7,代碼來源:test_visualization.py

示例14: test_get_index_paths_single_from_data_dir

    def test_get_index_paths_single_from_data_dir(self):
        visualization = Visualization._from_data_dir(self.data_dir,
                                                     self.provenance)

        actual = visualization.get_index_paths()
        expected = {'html': 'data/index.html'}
        self.assertEqual(actual, expected)
開發者ID:Kleptobismol,項目名稱:qiime2,代碼行數:7,代碼來源:test_visualization.py

示例15: test_from_data_dir

    def test_from_data_dir(self):
        visualization = Visualization._from_data_dir(self.data_dir, None)

        self.assertEqual(visualization.type, qiime.core.type.Visualization)
        self.assertIsNone(visualization.provenance)
        # We don't know what the UUID is because it's generated within
        # Visualization._from_data_dir.
        self.assertIsInstance(visualization.uuid, uuid.UUID)
開發者ID:Kleptobismol,項目名稱:qiime2,代碼行數:8,代碼來源:test_visualization.py


注:本文中的qiime.sdk.Visualization類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。