def test_constructor(self): class MockEntryPoint(pkg_resources.EntryPoint): def __init__(self, plugin): self.plugin = plugin def load(self): return self.plugin plugin1 = Plugin(name='dummy-plugin', version='0.4.2', website='www.dummy-plugin-hub.com', package='dummy_plugin') plugin2 = Plugin(name='other-dummy-plugin', version='0.4.2', website='www.dummy-plugin-hub.com', package='dummy_plugin') def mock_iter_entry_points(group): return [MockEntryPoint(plugin1), MockEntryPoint(plugin2)] with unittest.mock.patch.object(pkg_resources, 'iter_entry_points', mock_iter_entry_points): plugin_manager = PluginManager() self.assertEqual(plugin_manager.plugins, { 'dummy-plugin': plugin1, 'other-dummy-plugin': plugin2 })
def setUp(self): # TODO standardize temporary directories created by QIIME self.test_dir = tempfile.TemporaryDirectory(prefix='qiime2-temp-') self.markdown_fp = os.path.join(self.test_dir.name, 'dummy_markdown_workflow.md') with open(self.markdown_fp, 'w') as markdown_fh: markdown_fh.write(markdown_template) self.plugin = Plugin(name='dummy-plugin', version='0.4.2', website='www.dummy-plugin-hub.com', package='dummy_plugin')
# ---------------------------------------------------------------------------- # Copyright (c) 2016--, Jorden Kreps. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ---------------------------------------------------------------------------- from qiime.plugin import Plugin, Int, Bool import test_plugin from q2_types import FeatureTable, Frequency, RelativeFrequency plugin = Plugin(name='test-plugin', version=test_plugin.__version__, website='http://github.com/jakereps/q2-test-plugin', package='test_plugin') plugin.methods.register_function( function=test_plugin.blocking_test, inputs={'table': FeatureTable[Frequency]}, parameters={'timeout': Int}, outputs=[('rarefied_table', FeatureTable[Frequency])], name='Blocking test', description='Set a timeout for this script to run, ' 'then try to run more things!') plugin.methods.register_function( function=test_plugin.stdio_test, inputs={'table': FeatureTable[Frequency]}, parameters={'number': Int},
# ---------------------------------------------------------------------------- # Copyright (c) 2016--, QIIME development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ---------------------------------------------------------------------------- from qiime.plugin import Plugin import q2_alignment plugin = Plugin(name='alignment', version=q2_alignment.__version__, website='https://github.com/qiime2/q2-alignment', package='q2_alignment')
# ---------------------------------------------------------------------------- # Copyright (c) 2016--, QIIME development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ---------------------------------------------------------------------------- from qiime.plugin import Plugin, Str import q2_diversity from q2_types import FeatureTable, Frequency, DistanceMatrix, Phylogeny plugin = Plugin(name='diversity', version=q2_diversity.__version__, website='https://github.com/qiime2-plugins/q2-diversity', package='q2_diversity') # TODO create decorator for promoting functions to workflows. This info would # be moved to the decorator calls. plugin.register_function( function=q2_diversity.beta_diversity, # TODO require a uniform sampling effort FeatureTable when predicates exist inputs={ 'metric': Str, 'feature_table': FeatureTable[Frequency], # TODO this is optional; how do we handle that here? 'phylogeny': Phylogeny }, outputs=[('distance_matrix', DistanceMatrix)], name='Beta diversity',
# Copyright (c) 2016--, QIIME development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ---------------------------------------------------------------------------- from qiime.plugin import Plugin from q2_types.tree import Phylogeny, Unrooted, Rooted from q2_types.feature_data import FeatureData, AlignedSequence from q2_types.feature_table import FeatureTable, Frequency import q2_phylogeny plugin = Plugin(name='phylogeny', version=q2_phylogeny.__version__, website='https://github.com/qiime2/q2-phylogeny', package='q2_phylogeny') plugin.methods.register_function( function=q2_phylogeny.midpoint_root, inputs={'tree': Phylogeny[Unrooted]}, parameters={}, outputs=[('rooted_tree', Phylogeny[Rooted])], name='Midpoint root an unrooted phylogenetic tree.', description=("Midpoint root an unrooted phylogenetic tree.")) plugin.methods.register_function( function=q2_phylogeny.fasttree, inputs={'alignment': FeatureData[AlignedSequence]}, parameters={}, outputs=[('tree', Phylogeny[Unrooted])],
# ---------------------------------------------------------------------------- # Copyright (c) 2016--, QIIME development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file LICENSE, distributed with this software. # ---------------------------------------------------------------------------- from qiime.plugin import Plugin, Int import q2_feature_table from q2_types import (FeatureTable, Frequency, RelativeFrequency, PresenceAbsence) plugin = Plugin(name='feature-table', version=q2_feature_table.__version__, website='https://github.com/qiime2-plugins/q2-feature-table', package='q2_feature_table') # TODO create decorator for promoting functions to workflows. This info would # be moved to the decorator calls. plugin.register_function( function=q2_feature_table.rarefy, # TODO use more restrictive primitive type for `depth` inputs={ 'table': FeatureTable[Frequency], 'depth': Int }, outputs=[('rarefied_table', FeatureTable[Frequency])], name='Rarefaction', doc="Let's rarefy!")