示例#1
0
    package='q2_ninja_ops',
    citation_text='Al-Ghalith GA, Montassier E, Ward HN, Knights D. '
                  'NINJA-OPS: Fast Accurate Marker Gene Alignment Using '
                  'Concatenated Ribosomes. PLoS Computational Biology. '
                  '2016 Jan;12(1).',
    short_description='Plugin for OTU picking with NINJA-OPS.',
    description='This plugin wraps the NINJA-OPS application and provides '
                'methods for clustering sequence data into OTUs.'
)

plugin.register_semantic_types(NinjaOpsDB)

plugin.register_formats(NinjaOpsDBDirFmt, Bowtie2IndexFormat,
                        TerrificCompressedFormat, NinjaReplicateMapFormat)

plugin.register_semantic_type_to_format(NinjaOpsDB,
                                        artifact_format=NinjaOpsDBDirFmt)

plugin.methods.register_function(
    function=cluster_closed_reference,
    inputs={
        'sequences': SampleData[Sequences],
        'reference_database': NinjaOpsDB
    },
    parameters={
        # TODO expose relevant NINJA-OPS parameters here
    },
    outputs=[
        ('clustered_table', FeatureTable[Frequency]),
        ('unmatched_sequences', SampleData[Sequences])
    ],
    input_descriptions={
示例#2
0
文件: plugin.py 项目: jakereps/qiime2
# Register formats
dummy_plugin.register_formats(
    IntSequenceFormatV2, MappingFormat, IntSequenceV2DirectoryFormat,
    MappingDirectoryFormat)

dummy_plugin.register_formats(
    FourIntsDirectoryFormat, UnimportableDirectoryFormat, UnimportableFormat,
    citations=[citations['baerheim1994effect']])

dummy_plugin.register_views(
    int, IntSequenceFormat, IntSequenceDirectoryFormat,
    SingleIntFormat, RedundantSingleIntDirectoryFormat,
    citations=[citations['mayer2012walking']])

dummy_plugin.register_semantic_type_to_format(
    IntSequence1,
    artifact_format=IntSequenceDirectoryFormat
)
dummy_plugin.register_semantic_type_to_format(
    IntSequence2,
    artifact_format=IntSequenceV2DirectoryFormat
)
dummy_plugin.register_semantic_type_to_format(
    Mapping,
    artifact_format=MappingDirectoryFormat
)
dummy_plugin.register_semantic_type_to_format(
    FourInts,
    artifact_format=FourIntsDirectoryFormat
)
dummy_plugin.register_semantic_type_to_format(
    SingleInt,
示例#3
0
                'formula': Str,
                'learning_rate': Float,
                'beta1': Float,
                'beta2': Float
    },
    outputs=[('differentials', FeatureData[Differential]),
             ('posterior', StrayPosterior)],
    input_descriptions={
        'table': 'The feature table of abundances.'
    },
    parameter_descriptions={
        'metadata': 'Sample metadata',
        'formula': 'The experimental condition of interest.',
        'learning_rate': 'The learning rate of the gradient descent.',
        'beta1': 'First momentum operator in ADAM gradient descent',
        'beta2': 'Second momentum operator in ADAM gradient descent'
    },
    output_descriptions={
        'differentials': 'The estimated per-feature differentials.',
        'posterior': 'The posterior distribution over all of the differentials.'
    }
)

# TODO: Need to add a visualizer to summarize the stray results
plugin.register_formats(StrayPosteriorFormat, StrayPosteriorDirFmt)
plugin.register_semantic_types(StrayPosterior)
plugin.register_semantic_type_to_format(
    StrayPosterior, StrayPosteriorDirFmt)

importlib.import_module('q2_stray._transformer')
示例#4
0
    SBMLDirectory,
    JSONFormat,
    JSONDirectory,
    CommunityModelFormat,
    CommunityModelManifest,
    CommunityModelDirectory,
    GrowthRates,
    Fluxes,
    MicomResultsDirectory,
    MicomMediumFile,
    MicomMediumDirectory,
    TradeoffResultsDirectory,
)
plugin.register_semantic_types(MetabolicModels, CommunityModels, MicomResults,
                               MicomMedium)
plugin.register_semantic_type_to_format(MetabolicModels[SBML], SBMLDirectory)
plugin.register_semantic_type_to_format(MetabolicModels[JSON], JSONDirectory)
plugin.register_semantic_type_to_format(CommunityModels[Pickle],
                                        CommunityModelDirectory)
plugin.register_semantic_type_to_format(MicomResults, MicomResultsDirectory)
plugin.register_semantic_type_to_format(TradeoffResults,
                                        TradeoffResultsDirectory)
plugin.register_semantic_type_to_format(MicomMedium[Global],
                                        MicomMediumDirectory)
plugin.register_semantic_type_to_format(MicomMedium[PerSample],
                                        MicomMediumDirectory)

plugin.methods.register_function(
    function=q2_micom.db,
    inputs={},
    parameters={
示例#5
0
citations = Citations.load('citations.bib', package='q2_shogun')

plugin = Plugin(
    name='shogun',
    version=q2_shogun.__version__,
    website='https://github.com/qiime2/q2-shogun',
    package='q2_shogun',
    description=('A QIIME 2 plugin wrapper for the SHOGUN shallow shotgun '
                 'sequencing taxonomy profiler.'),
    short_description='Shallow shotgun sequencing taxonomy profiler.',
    citations=[citations['Hillmann320986']])

plugin.register_views(Bowtie2IndexDirFmt,
                      citations=[citations['langmead2012fast']])
plugin.register_semantic_types(Bowtie2Index)
plugin.register_semantic_type_to_format(Bowtie2Index, Bowtie2IndexDirFmt)

plugin.methods.register_function(
    function=nobunaga,
    inputs={
        'query': FeatureData[Sequence],
        'reference_reads': FeatureData[Sequence],
        'reference_taxonomy': FeatureData[Taxonomy],
        'database': Bowtie2Index
    },
    parameters={
        'taxacut': Float % Range(0.0, 1.0, inclusive_end=True),
        'threads': Int % Range(1, None),
        'percent_id': Float % Range(0.0, 1.0, inclusive_end=True)
    },
    outputs=[('taxa_table', FeatureTable[Frequency])],
        'Heatmap of important features.',
        'filtered_table':
        'Filtered feature table containing data displayed '
        'in heatmap.'
    },
    name='Generate heatmap of important features.',
    description='Generate a heatmap of important features. Features are '
    'filtered based on importance scores; samples are optionally '
    'grouped by metadata; and a heatmap is generated that '
    'displays (normalized) feature abundances per sample.')

# Registrations
plugin.register_semantic_types(SampleEstimator, BooleanSeries, Importance,
                               ClassifierPredictions, RegressorPredictions,
                               Classifier, Regressor)
plugin.register_semantic_type_to_format(SampleEstimator[Classifier],
                                        artifact_format=SampleEstimatorDirFmt)
plugin.register_semantic_type_to_format(SampleEstimator[Regressor],
                                        artifact_format=SampleEstimatorDirFmt)
plugin.register_semantic_type_to_format(
    SampleData[BooleanSeries], artifact_format=BooleanSeriesDirectoryFormat)
plugin.register_semantic_type_to_format(
    SampleData[RegressorPredictions],
    artifact_format=PredictionsDirectoryFormat)
plugin.register_semantic_type_to_format(
    SampleData[ClassifierPredictions],
    artifact_format=PredictionsDirectoryFormat)
plugin.register_semantic_type_to_format(
    FeatureData[Importance], artifact_format=ImportanceDirectoryFormat)
plugin.register_formats(SampleEstimatorDirFmt, BooleanSeriesFormat,
                        BooleanSeriesDirectoryFormat, ImportanceFormat,
                        ImportanceDirectoryFormat, PredictionsFormat,
示例#7
0
                              IntSequenceV2DirectoryFormat,
                              MappingDirectoryFormat)

dummy_plugin.register_formats(FourIntsDirectoryFormat,
                              UnimportableDirectoryFormat,
                              UnimportableFormat,
                              citations=[citations['baerheim1994effect']])

dummy_plugin.register_views(int,
                            IntSequenceFormat,
                            IntSequenceDirectoryFormat,
                            SingleIntFormat,
                            RedundantSingleIntDirectoryFormat,
                            citations=[citations['mayer2012walking']])

dummy_plugin.register_semantic_type_to_format(
    IntSequence1, artifact_format=IntSequenceDirectoryFormat)
dummy_plugin.register_semantic_type_to_format(
    IntSequence2, artifact_format=IntSequenceV2DirectoryFormat)
dummy_plugin.register_semantic_type_to_format(
    Mapping, artifact_format=MappingDirectoryFormat)
dummy_plugin.register_semantic_type_to_format(
    FourInts, artifact_format=FourIntsDirectoryFormat)
dummy_plugin.register_semantic_type_to_format(
    SingleInt, artifact_format=RedundantSingleIntDirectoryFormat)
dummy_plugin.register_semantic_type_to_format(
    Kennel[Dog | Cat], artifact_format=MappingDirectoryFormat)

# TODO add an optional parameter to this method when they are supported
dummy_plugin.methods.register_function(
    function=concatenate_ints,
    inputs={
示例#8
0
def create_plugin(**filters):
    plugin = Plugin(
        name='mystery-stew',
        project_name='q2-mystery-stew',
        version=q2_mystery_stew.__version__,
        website='https://github.com/qiime2/q2-mystery-stew',
        package='q2_mystery_stew',
        description=('This QIIME 2 plugin templates out arbitrary '
                     'QIIME 2 actions to test interfaces. '),
        short_description='Plugin for generating arbitrary QIIME 2 '
        'actions.')

    plugin.register_semantic_types(SingleInt1, SingleInt2, IntWrapper,
                                   WrappedInt1, WrappedInt2, EchoOutput)

    plugin.register_formats(SingleIntFormat, SingleIntDirectoryFormat,
                            EchoOutputFmt, EchoOutputDirFmt)

    plugin.register_semantic_type_to_format(SingleInt1,
                                            SingleIntDirectoryFormat)
    plugin.register_semantic_type_to_format(SingleInt2,
                                            SingleIntDirectoryFormat)

    plugin.register_semantic_type_to_format(
        IntWrapper[WrappedInt1 | WrappedInt2], SingleIntDirectoryFormat)

    plugin.register_semantic_type_to_format(EchoOutput, EchoOutputDirFmt)

    # This transformer is being registered in this file right now because it is
    # needed by the registration functions so it needs to be registered before
    # it is called
    @plugin.register_transformer
    def _0(data: int) -> SingleIntFormat:
        ff = SingleIntFormat()
        with ff.open() as fh:
            fh.write('%d\n' % data)
        return ff

    selected_types = []
    basics = {
        'ints': int_params,
        'floats': float_params,
        'strings': string_params,
        'bools': bool_params,
        'metadata': simple_metadata,
        'primitive_unions': primitive_unions,
        'artifacts': artifact_params
    }

    for key, generator in basics.items():
        if not filters or filters.get(key, False):
            selected_types.append(generator())
            if not filters or filters.get('collections', False):
                if key != 'metadata':
                    selected_types.append(list_params(generator()))
                    selected_types.append(set_params(generator()))

    if not selected_types:
        raise ValueError("Must select at least one parameter type to use")

    register_single_type_tests(plugin, selected_types)

    return plugin
示例#9
0
plugin = Plugin(name='genome-sampler',
                website='https://caporasolab.us/genome-sampler',
                package='genome_sampler',
                version=genome_sampler.__version__,
                description='Tools for sampling from collections of genomes.',
                short_description='Genome sampler.',
                citations=[citations['genomesampler']])

plugin.register_formats(IDSelectionDirFmt)
plugin.register_formats(GISAIDDNAFASTAFormat)
plugin.register_formats(VCFMaskFormat)
plugin.register_formats(VCFMaskDirFmt)
plugin.register_semantic_types(Selection)
plugin.register_semantic_types(AlignmentMask)
plugin.register_semantic_type_to_format(FeatureData[Selection],
                                        artifact_format=IDSelectionDirFmt)
plugin.register_semantic_type_to_format(AlignmentMask,
                                        artifact_format=VCFMaskDirFmt)


@plugin.register_transformer
def _1(obj: IDSelection) -> IDSelectionDirFmt:
    result = IDSelectionDirFmt()

    inclusion = obj.inclusion
    assert not inclusion.index.has_duplicates

    include = inclusion.index[inclusion]
    exclude = inclusion.index[~inclusion]
    with open(result.included.path_maker(), 'w') as fh:
        fh.write('\n'.join(include))
示例#10
0
from qiime2.plugin import Plugin, SemanticType

from q2_types.feature_table import FeatureTable, RelativeFrequency, BIOMV210DirFmt

from q2_sqrt.action import square_root

plugin = Plugin("sqrt",
                version="0.0.1.dev",
                website="google.com",
                package="q2_sqrt")

SquareRoot = SemanticType('SquareRoot',
                          variant_of=FeatureTable.field['content'])

plugin.register_semantic_types(SquareRoot)

plugin.register_semantic_type_to_format(FeatureTable[SquareRoot],
                                        BIOMV210DirFmt)

plugin.methods.register_function(
    square_root,
    name="Square Root Transform",
    description="Convert a table from relative frequency to square root",
    inputs={"table": FeatureTable[RelativeFrequency]},
    parameters={},
    outputs=[("sqrt_table", FeatureTable[SquareRoot])],
    input_descriptions={"table": "A relative frequency table"},
    output_descriptions={'sqrt_table': 'The transformed table'})
示例#11
0
citations = Citations.load('citations.bib', package='q2_qemistree')

plugin = Plugin(
    name='qemistree',
    version=q2_qemistree.__version__,
    website='https://github.com/biocore/q2-qemistree',
    package='q2_qemistree',
    description='Hierarchical orderings for mass spectrometry data',
    short_description='Plugin for exploring chemical diversity.',
    citations=citations,
)

# type registration
plugin.register_views(MGFDirFmt)
plugin.register_semantic_types(MassSpectrometryFeatures)
plugin.register_semantic_type_to_format(MassSpectrometryFeatures,
                                        artifact_format=MGFDirFmt)

plugin.register_views(SiriusDirFmt)
plugin.register_semantic_types(SiriusFolder)
plugin.register_semantic_type_to_format(SiriusFolder,
                                        artifact_format=SiriusDirFmt)

plugin.register_views(ZodiacDirFmt)
plugin.register_semantic_types(ZodiacFolder)
plugin.register_semantic_type_to_format(ZodiacFolder,
                                        artifact_format=ZodiacDirFmt)

plugin.register_views(CSIDirFmt)
plugin.register_semantic_types(CSIFolder)
plugin.register_semantic_type_to_format(CSIFolder,
                                        artifact_format=CSIDirFmt)