Beispiel #1
0
from qiime2.plugin import Plugin, Str, Range, Choices, Float, Int, Bool, List
from q2_types.feature_table import FeatureTable, Frequency
from q2_types.tree import Phylogeny, Rooted

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.',
)

# 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)
Beispiel #2
0
    output_descriptions={
        'heatmap':
        '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 sample 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, Probabilities)
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)
Beispiel #3
0
# ----------------------------------------------------------------------------

import q2_ili
from ._plot import plot
from ._semantics import STLDirFmt, Model
from qiime2.plugin import Plugin, Metadata, Citations

plugin = Plugin(
    name='ili',
    version=q2_ili.__version__,
    website='https://ili.embl.de/',
    citations=Citations.load('citations.bib', package='q2_ili'),
    package='q2_ili',
    description=('This QIIME 2 plugin wraps `ili and '
                 'supports interactive visualization of 3D models'),
    short_description='Plugin for spatial mapping with `ili')

# type registration
plugin.register_views(STLDirFmt)
plugin.register_semantic_types(Model)
plugin.register_semantic_type_to_format(Model, artifact_format=STLDirFmt)

plugin.visualizers.register_function(
    function=plot,
    inputs={'model': Model},
    parameters={'metadata': Metadata},
    input_descriptions={'model': 'The model where the data will be plotted.'},
    parameter_descriptions={'metadata': 'Metadata used to color the model'},
    name='Visualize and interact with 3D models',
    description='Visualize and interact with 3D models colored using metadata')
Beispiel #4
0
import q2_network

plugin = Plugin(
    name='network',
    version=q2_network.__version__,
    website="https://github.com/shafferm/q2-network",
    package='q2_network',
    description=(
        'This QIIME 2 plugin supports methods for analysis of netwoks '
        'generated from correlations or other sources and provides '
        'rudimentary network statistics.'),
    short_description='Plugin for network analysis.',
)

plugin.register_semantic_types(Network)
plugin.register_semantic_types(PairwiseFeatureData)

plugin.register_formats(GraphModelingLanguageFormat)
plugin.register_formats(GraphModelingLanguageDirectoryFormat)
plugin.register_formats(PairwiseFeatureDataFormat)
plugin.register_formats(PairwiseFeatureDataDirectoryFormat)

plugin.register_semantic_type_to_format(
    Network, artifact_format=GraphModelingLanguageDirectoryFormat)
plugin.register_semantic_type_to_format(
    PairwiseFeatureData, artifact_format=PairwiseFeatureDataDirectoryFormat)

plugin.methods.register_function(
    function=calculate_correlations,
    inputs={'table': FeatureTable[Frequency]
                     'divide itself again. If there is fewer than this number '
                     'of samples in a bin the tree will not subdivide again.',
        'x_coord': 'Metadata column containing x coordinates, i.e. longitude.',
        'y_coord': 'Metadata column containing y coordinates, i.e. latitude'},
    name='Divide samples into bins by quadtrees based on'
         'x and y coordinates',
    description='Objective binning of samples based on spatial data '
                'by quadtrees. While there are samples '
                '(greater than the threshold) in a partition '
                'that partition will split into four allowing for quick '
                'binning based both on location and sample density.',

)
# Registrations
plugin.register_formats(CoordinatesFormat, CoordinatesDirectoryFormat)

plugin.register_semantic_types(Coordinates)

plugin.register_semantic_type_to_format(
    SampleData[Coordinates],
    artifact_format=CoordinatesDirectoryFormat)

plugin.register_formats(QuadTreeFormat, QuadTreeDirectoryFormat)

plugin.register_semantic_types(QuadTree)

plugin.register_semantic_type_to_format(
    SampleData[QuadTree],
    artifact_format=QuadTreeDirectoryFormat)
importlib.import_module('q2_coordinates._transformer')
Beispiel #6
0
citations = Citations.load('citations.bib', package='q2_demux')

plugin = Plugin(
    name='demux',
    version=q2_demux.__version__,
    website='https://github.com/qiime2/q2-demux',
    package='q2_demux',
    description=('This QIIME 2 plugin supports demultiplexing of '
                 'single-end and paired-end sequence reads and '
                 'visualization of sequence quality information.'),
    short_description='Plugin for demultiplexing & viewing sequence quality.'
)

plugin.register_semantic_types(
    RawSequences, EMPSingleEndSequences, EMPPairedEndSequences,
    ErrorCorrectionDetails)

plugin.register_formats(EMPMultiplexedDirFmt, ErrorCorrectionDetailsDirFmt,
                        EMPSingleEndDirFmt, EMPSingleEndCasavaDirFmt,
                        EMPPairedEndDirFmt, EMPPairedEndCasavaDirFmt)

# TODO: remove when aliasing exists
plugin.register_semantic_type_to_format(
    RawSequences,
    artifact_format=EMPSingleEndDirFmt
)

plugin.register_semantic_type_to_format(
    EMPSingleEndSequences,
    artifact_format=EMPSingleEndDirFmt
Beispiel #7
0
from ._type import SeqAlnMap, BLAST6Out, SimpleMap, NCBINodes, GeneCoordinates

from woltka import __version__
from woltka.q2.plugin import classify, psfilter, collapse, coverage

plugin = Plugin(
    name='woltka',
    version=__version__,
    website="https://github.com/qiyunzhu/woltka",
    citations=[],
    short_description='Plugin for metagenomics analysis',
    description=('This is a QIIME 2 plugin supporting various analyses of '
                 'shotgun metagenome datasets'),
    package='woltka')

plugin.register_semantic_types(SeqAlnMap, BLAST6Out, SimpleMap, NCBINodes,
                               GeneCoordinates)

plugin.register_formats(SeqAlnMapFormat, SeqAlnMapDirFmt, BLAST6OutFormat,
                        BLAST6OutDirFmt, SimpleMapFormat, SimpleMapDirFmt,
                        NCBINodesFormat, NCBINodesDirFmt, GeneCoordFormat,
                        GeneCoordDirFmt)

plugin.register_semantic_type_to_format(FeatureData[SeqAlnMap],
                                        artifact_format=SeqAlnMapDirFmt)
plugin.register_semantic_type_to_format(FeatureData[BLAST6Out],
                                        artifact_format=BLAST6OutDirFmt)
plugin.register_semantic_type_to_format(FeatureData[SimpleMap],
                                        artifact_format=SimpleMapDirFmt)
plugin.register_semantic_type_to_format(FeatureData[NCBINodes],
                                        artifact_format=NCBINodesDirFmt)
plugin.register_semantic_type_to_format(GeneCoordinates,
Beispiel #8
0
                      'table')
    },
    parameter_descriptions={},
    output_descriptions={},
    name='Run Phylofactor',
    description='Phylofactor defines clades that are associated with '
    'metadata columns of interest')

plugin.methods.register_function(
    function=cross_validate_map,
    inputs={
        'table': FeatureTable[Frequency],
        'groups': FeatureData[FactorGroups],
        'phylogeny': Phylogeny[Unrooted],
        'full_phylogeny': Phylogeny[Unrooted],
    },
    parameters={},
    outputs=[('featuretable', FeatureTable[Frequency]),
             ('groups', FeatureData[FactorGroups])],
    input_descriptions={},
    parameter_descriptions={},
    output_descriptions={},
    name='Cross validate factor groups',
    description='Applies factor groupings to new data sets')

plugin.register_formats(FactorGroupsFormat, FactorGroupsDirFmt)
plugin.register_semantic_types(FactorGroups)
plugin.register_semantic_type_to_format(FeatureData[FactorGroups],
                                        FactorGroupsDirFmt)
importlib.import_module('q2_phylofactor._transform')
Beispiel #9
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)
    },
Beispiel #10
0
    "are used. (Description from sklearn.metrics.pairwise_distances)")

plugin = Plugin(
    name="mlab",
    version=q2_mlab.__version__,
    website="https://dev.qiime2.org/",
    package="q2_mlab",
    citations=Citations.load("citations.bib", package="q2_mlab"),
    description=("This QIIME 2 plugin is in development"
                 " and does sweet stuff."),
    short_description="Plugin for machine learning automated benchmarking.",
)

plugin.register_formats(ResultsFormat, ResultsDirectoryFormat)

plugin.register_semantic_types(Target)
plugin.register_semantic_type_to_format(
    SampleData[Target], artifact_format=PredictionsDirectoryFormat)

plugin.register_semantic_types(Results)
plugin.register_semantic_type_to_format(SampleData[Results],
                                        artifact_format=ResultsDirectoryFormat)

plugin.pipelines.register_function(
    function=q2_mlab.preprocess,
    inputs={
        "table": FeatureTable[Frequency],
        "phylogeny": Phylogeny[Rooted]
    },
    parameters={
        "metadata": Metadata,
Beispiel #11
0
from qiime2.plugin import Plugin, Str, Range, Choices, Float, Int
from q2_types.feature_table import FeatureTable, Frequency
from q2_types.tree import Phylogeny, Rooted

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

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

PARAMS = {
    'database': Str % Choices(['all', 'pubchem']),
    'sirius_path': Str,
    'profile': Str % Choices(['qtof', 'orbitrap', 'fticr']),
    'fingerid_db': Str % Choices(['all', 'pubchem', 'bio', 'kegg', 'hmdb']),
    'ppm_max': Int % Range(0, 30, inclusive_end=True),
    'n_jobs': Int % Range(1, None),
    'num_candidates': Int % Range(5, 100, inclusive_end=True),
    'tree_timeout': Int % Range(600, 3000, inclusive_end=True),
    'maxmz': Int % Range(100, 850, inclusive_end=True),
    'zodiac_threshold': Float % Range(0, 1, inclusive_end=True),
}
Beispiel #12
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
    }

    selected_types.append(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):
                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")

    selected_types.append(primitive_unions())

    register_single_type_tests(plugin, selected_types)

    return plugin
Beispiel #13
0
    name='dummy-plugin',
    description='Description of dummy plugin.',
    short_description='Dummy plugin for testing.',
    version='0.0.0-dev',
    website='https://github.com/qiime2/qiime2',
    package='qiime2.core.testing',
    user_support_text='For help, see https://qiime2.org',
    citations=[citations['unger1998does'], citations['berry1997flying']])

import_module('qiime2.core.testing.transformer')
import_module('qiime2.core.testing.validator')

# Register semantic types
dummy_plugin.register_semantic_types(IntSequence1, IntSequence2, IntSequence3,
                                     Mapping, FourInts, Kennel, Dog, Cat,
                                     SingleInt, C1, C2, C3, Foo, Bar, Baz,
                                     AscIntSequence, Squid, Octopus,
                                     Cuttlefish)

# Register formats
dummy_plugin.register_formats(IntSequenceFormatV2, MappingFormat,
                              IntSequenceV2DirectoryFormat,
                              IntSequenceMultiFileDirectoryFormat,
                              MappingDirectoryFormat, EchoDirectoryFormat,
                              EchoFormat, Cephalapod,
                              CephalapodDirectoryFormat)

dummy_plugin.register_formats(FourIntsDirectoryFormat,
                              UnimportableDirectoryFormat,
                              UnimportableFormat,
                              citations=[citations['baerheim1994effect']])
Beispiel #14
0
        'display conserved positions on.',
        'nterm_offset':
        'Number of the amino acids that'
        'are missing from the N-terminus'
        'of the PDB structure. Defaults'
        'to 1.'
    },
    name='PCA loadings plot',
    description=(
        'Visualise principal component loadings to find which positions '
        'within the alignment/protein sequence contribute most/least to'
        'the observed variance. Ultimately, find which positions are most/'
        'least conserved within a protein sequence.'))

# Registrations
plugin.register_formats(PositionMappingFormat, PositionMappingDirectoryFormat)
plugin.register_formats(RankedProteinAlignmentFormat,
                        RankedProteinAlignmentDirectoryFormat)

plugin.register_semantic_types(PositionMapping)
plugin.register_semantic_types(RankedProteinAlignment)

plugin.register_semantic_type_to_format(
    FeatureData[PositionMapping],
    artifact_format=PositionMappingDirectoryFormat)
plugin.register_semantic_type_to_format(
    FeatureData[RankedProteinAlignment],
    artifact_format=RankedProteinAlignmentDirectoryFormat)

importlib.import_module('q2_protein_pca._transformer')
Beispiel #15
0
        'max_centroids_per_class': Int,
        'feature_extractor_specification': Str,
        'knn_classifier_specification': Str,
        'n_jobs': Int,
        'random_state': Int
    },
    outputs=[('nearest_neighbors', q2_clawback.PrecalculatedNearestNeighbors)],
    name='Calculate nearest neighbors for estimating class weight importance',
    description=('Fit a kNN classifier to the optionally undersampled '
                 'reference data and cache the neighbors'))

plugin.visualizers.register_function(
    function=q2_clawback.kNN_LOOCV_F_measures,
    inputs={
        'nearest_neighbors': q2_clawback.PrecalculatedNearestNeighbors,
        'class_weight': FeatureTable[RelativeFrequency]
    },
    parameters={},
    name='Estimate importance of class weights',
    description=('Calculated k Nearest Neighbors Leave-One-Out Cross '
                 'Validated F-measures for weighted and uniform assumptions'))

plugin.register_semantic_types(q2_clawback.PrecalculatedNearestNeighbors)
plugin.register_formats(
    q2_clawback.PrecalculatedNearestNeighborsFormat,
    q2_clawback.PrecalculatedNearestNeighborsDirectoryFormat)
plugin.register_semantic_type_to_format(
    q2_clawback.PrecalculatedNearestNeighbors,
    artifact_format=q2_clawback.PrecalculatedNearestNeighborsDirectoryFormat)
importlib.import_module('q2_clawback._transformer')
@plugin.register_transformer
def _5(ff: BooleanSeriesFormat) -> (pd.Series):
    with ff.open() as fh:
        df = _read_dataframe(fh)
        return df.iloc[:, 0]


@plugin.register_transformer
def _6(ff: BooleanSeriesFormat) -> (qiime2.Metadata):
    with ff.open() as fh:
        return qiime2.Metadata(_read_dataframe(fh))


plugin.register_formats(BooleanSeriesFormat, BooleanSeriesDirectoryFormat)

plugin.register_semantic_types(BooleanSeries)

plugin.register_semantic_type_to_format(
    SampleData[BooleanSeries], artifact_format=BooleanSeriesDirectoryFormat)

description = ('Predicts a {0} sample metadata column using a {1}. Splits '
               'input data into training and test sets. The training set is '
               'used to train and test the estimator using a stratified '
               'k-fold cross-validation scheme. This includes optional steps '
               'for automated feature extraction and hyperparameter '
               'optimization. The test set validates classification accuracy '
               'of the optimized estimator. Outputs classification results '
               'for test set. For more details on the learning  algorithm, '
               'see http://scikit-learn.org/stable/supervised_learning.html')

inputs = {'table': FeatureTable[Frequency]}
Beispiel #17
0
import q2_ninja_ops

plugin = Plugin(
    name='ninja-ops',
    version=q2_ninja_ops.__version__,
    website='https://github.com/knights-lab/q2-ninja-ops',
    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
Beispiel #18
0
citations = Citations.load('citations.bib', package='qiime2.core.testing')
dummy_plugin = Plugin(
    name='dummy-plugin',
    description='Description of dummy plugin.',
    short_description='Dummy plugin for testing.',
    version='0.0.0-dev',
    website='https://github.com/qiime2/qiime2',
    package='qiime2.core.testing',
    user_support_text='For help, see https://qiime2.org',
    citations=[citations['unger1998does'], citations['berry1997flying']]
)

import_module('qiime2.core.testing.transformer')

# Register semantic types
dummy_plugin.register_semantic_types(IntSequence1, IntSequence2, Mapping,
                                     FourInts, Kennel, Dog, Cat, SingleInt)

# 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']])
Beispiel #19
0
citations = Citations.load('citations.bib', package='genome_sampler')

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(VCFLikeMaskFormat)
plugin.register_formats(VCFLikeMaskDirFmt)
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=VCFLikeMaskDirFmt)


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

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

    include = inclusion.index[inclusion]
from q2_covid.common import (IDSelectionDirFmt, IDSelection, Selection,
                             IDMetadataFormat, UNIXListFormat)
from q2_covid.subsample_random import subsample_random

plugin = Plugin(
    name='covid',
    website='https://github.com/caporaso-lab/q2-covid',
    package='q2_covid',
    version=q2_covid.__version__,
    description='Tools for genomic epidemiology focused on the SARS-CoV-2'
                ' virus.',
    short_description='Tools for genomic epidemiology.'
)

plugin.register_formats(IDSelectionDirFmt)
plugin.register_semantic_types(Selection)
plugin.register_semantic_type_to_format(FeatureData[Selection],
                                        artifact_format=IDSelectionDirFmt)

@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))
    with open(result.excluded.path_maker(), 'w') as fh:
@plugin.register_transformer
def _5(ff: BooleanSeriesFormat) -> (pd.Series):
    with ff.open() as fh:
        return _read_dataframe(fh)


@plugin.register_transformer
def _6(ff: BooleanSeriesFormat) -> (qiime2.Metadata):
    with ff.open() as fh:
        return qiime2.Metadata(_read_dataframe(fh))


plugin.register_formats(CoordinatesFormat, CoordinatesDirectoryFormat,
                        BooleanSeriesFormat, BooleanSeriesDirectoryFormat)

plugin.register_semantic_types(Coordinates, BooleanSeries)

plugin.register_semantic_type_to_format(
    SampleData[Coordinates],
    artifact_format=CoordinatesDirectoryFormat)

plugin.register_semantic_type_to_format(
    SampleData[BooleanSeries],
    artifact_format=BooleanSeriesDirectoryFormat)

description = ('Predicts a {0} sample metadata category using a {1}. Splits '
               'input data into training and test sets. The training set is '
               'used to train and test the estimator using a stratified '
               'k-fold cross-validation scheme. This includes optional steps '
               'for automated feature extraction and hyperparameter '
               'optimization. The test set validates classification accuracy '
        'ids_to_keep':
        'List of IDs to keep (as Metadata). Selecting these '
        'IDs occurs after inclusion and exclusion filtering.',
        'include':
        'List of search terms. Taxa containing one or more of '
        'these terms will be retained. Inclusion filtering occurs '
        'prior to exclusion filtering and selecting `ids_to_keep`.',
        'exclude':
        'List of search terms. Taxa containing one or more of '
        'these terms will be excluded. Exclusion filtering occurs '
        'after inclusion filtering and prior to selecting '
        '`ids_to_keep`.'
    },
    output_descriptions={'filtered_taxonomy': 'The filtered taxonomy.'},
    name='Filter taxonomy by list of IDs or search criteria.',
    description=('Filter taxonomy by list of IDs or search criteria.'),
)

# Registrations
plugin.register_semantic_types(SILVATaxonomy, SILVATaxidMap, RNASequence)
plugin.register_semantic_type_to_format(
    FeatureData[SILVATaxonomy], artifact_format=SILVATaxonomyDirectoryFormat)
plugin.register_semantic_type_to_format(
    FeatureData[SILVATaxidMap], artifact_format=SILVATaxidMapDirectoryFormat)
plugin.register_semantic_type_to_format(
    FeatureData[RNASequence], artifact_format=RNASequencesDirectoryFormat)
plugin.register_formats(SILVATaxonomyFormat, SILVATaxonomyDirectoryFormat,
                        SILVATaxidMapFormat, SILVATaxidMapDirectoryFormat,
                        RNAFASTAFormat, RNASequencesDirectoryFormat)
importlib.import_module('rescript.types._transformer')
Beispiel #23
0
from ._type import RawSequences, EMPSingleEndSequences, EMPPairedEndSequences
from ._format import (EMPMultiplexedDirFmt, EMPSingleEndDirFmt,
                      EMPSingleEndCasavaDirFmt, EMPPairedEndDirFmt,
                      EMPPairedEndCasavaDirFmt)

plugin = Plugin(
    name='demux',
    version=q2_demux.__version__,
    website='https://github.com/qiime2/q2-demux',
    package='q2_demux',
    description=('This QIIME 2 plugin supports demultiplexing of '
                 'single-end and paired-end sequence reads and '
                 'visualization of sequence quality information.'),
    short_description='Plugin for demultiplexing & viewing sequence quality.')

plugin.register_semantic_types(RawSequences, EMPSingleEndSequences,
                               EMPPairedEndSequences)

plugin.register_formats(EMPMultiplexedDirFmt, EMPSingleEndDirFmt,
                        EMPSingleEndCasavaDirFmt, EMPPairedEndDirFmt,
                        EMPPairedEndCasavaDirFmt)

# TODO: remove when aliasing exists
plugin.register_semantic_type_to_format(RawSequences,
                                        artifact_format=EMPSingleEndDirFmt)

plugin.register_semantic_type_to_format(EMPSingleEndSequences,
                                        artifact_format=EMPSingleEndDirFmt)

plugin.register_semantic_type_to_format(EMPPairedEndSequences,
                                        artifact_format=EMPPairedEndDirFmt)
Beispiel #24
0
)

plugin.register_formats(KmerMapFormat, 
                        KmerMapDirFmt, 
                        KmerAlignFormat, 
                        KmerAlignDirFmt,
                        SidleReconFormat, 
                        SidleReconDirFormat,
                        ReconSummaryFormat,
                        ReconSummaryDirFormat,
                        )


plugin.register_semantic_types(KmerMap, 
                               KmerAlignment,
                               SidleReconstruction,
                               ReconstructionSummary,
                               )


plugin.register_semantic_type_to_format(FeatureData[KmerMap], 
                                        KmerMapDirFmt)


plugin.register_semantic_type_to_format(FeatureData[KmerAlignment], 
                                        KmerAlignDirFmt)


plugin.register_semantic_type_to_format(FeatureData[SidleReconstruction], 
                                        SidleReconDirFormat)
citations = Citations.load('citations.bib', package='q2_longitudinal')

plugin = Plugin(
    name='longitudinal',
    version=q2_longitudinal.__version__,
    website="https://github.com/qiime2/q2-longitudinal",
    package='q2_longitudinal',
    description=(
        'This QIIME 2 plugin supports methods for analysis of time series '
        'data, involving either paired sample comparisons or longitudinal '
        'study designs.'),
    short_description='Plugin for paired sample and time series analyses.',
    citations=[citations['bokulich2017q2']])

plugin.register_semantic_types(FirstDifferences)

plugin.register_formats(FirstDifferencesFormat,
                        FirstDifferencesDirectoryFormat)

plugin.register_semantic_type_to_format(
    SampleData[FirstDifferences],
    artifact_format=FirstDifferencesDirectoryFormat)

miscellaneous_parameters = {
    'state_column': Str,
    'replicate_handling': Str % Choices(['error', 'random', 'drop'])
}

shared_parameters = {
    'metadata': Metadata,
Beispiel #26
0
from q2_beast.formats import (PosteriorLogFormat, NexusFormat,
                              BEASTControlFileFormat, BEASTOpsFileFormat,
                              BEASTPosteriorDirFmt, NexusDirFmt)

plugin = Plugin(name='beast',
                website='',
                package='q2_beast',
                version=q2_beast.__version__,
                description='',
                short_description='')

plugin.register_formats(PosteriorLogFormat, NexusFormat,
                        BEASTControlFileFormat, BEASTOpsFileFormat,
                        BEASTPosteriorDirFmt, NexusDirFmt)

plugin.register_semantic_types(Chain, BEAST, MCC)
plugin.register_semantic_type_to_format(Chain[BEAST],
                                        artifact_format=BEASTPosteriorDirFmt)
plugin.register_semantic_type_to_format(Phylogeny[MCC],
                                        artifact_format=NexusDirFmt)

importlib.import_module('q2_beast.transformers')

NONZERO_INT = Int % Range(1, None)
NONNEGATIVE_INT = Int % Range(0, None)

plugin.methods.register_function(
    function=gtr_single_partition,
    inputs={'alignment': FeatureData[AlignedSequence]},
    parameters={
        'time': MetadataColumn[Numeric],
Beispiel #27
0
        'subsample_size':
            Float % Range(0, 1, inclusive_start=False, inclusive_end=True),
        'random_seed': Int % Range(1, None)
    },
    outputs=[('sample_sequences', FeatureData[T])],
    input_descriptions={'sequences': 'Sequences to subsample from.'},
    parameter_descriptions={
        'subsample_size': 'Size of the random sample as a '
                          'fraction of the total count',
        'random_seed': 'Seed to be used for random sampling.'
    },
    output_descriptions={
        'sample_sequences': 'Sample of original sequences.', },
    name='Subsample an indicated number of sequences from a FASTA file.',
    description=(
        "Subsample a set of sequences (either plain or aligned DNA)"
        "based on a fraction of original sequences."),
)

# Registrations
plugin.register_semantic_types(SILVATaxonomy, SILVATaxidMap)
plugin.register_semantic_type_to_format(
    FeatureData[SILVATaxonomy],
    artifact_format=SILVATaxonomyDirectoryFormat)
plugin.register_semantic_type_to_format(
    FeatureData[SILVATaxidMap],
    artifact_format=SILVATaxidMapDirectoryFormat)
plugin.register_formats(SILVATaxonomyFormat, SILVATaxonomyDirectoryFormat,
                        SILVATaxidMapFormat, SILVATaxidMapDirectoryFormat)
importlib.import_module('rescript.types._transformer')
Beispiel #28
0
    package='q2_phylogenomics',
    description='A QIIME 2 plugin for phylogenomics analyses.',
    short_description='A QIIME 2 plugin for phylogenomics analyses.',
)

plugin.register_formats(GenBankFormat, GenBankDirFmt, citations=[])
plugin.register_formats(BAMFormat,
                        SAMFormat,
                        BAMFilesDirFmt,
                        SAMFilesDirFmt,
                        PileUpTSVFormat,
                        PileUpFilesDirFmt,
                        citations=[])
plugin.register_formats(FASTAFilesDirFmt)

plugin.register_semantic_types(AlignmentMap, PileUp, ConsensusSequences,
                               ReferenceSequence)

# before release we want to use GenBank format for this,
# but I think it's broken with skbio < 0.5.6 - I get this
# error when trying to load a genbank file:
# ValueError: cannot set WRITEABLE flag to True of this array
# plugin.register_semantic_type_to_format(ReferenceSequence, GenBankDirFmt)
plugin.register_semantic_type_to_format(ReferenceSequence,
                                        DNASequencesDirectoryFormat)
plugin.register_semantic_type_to_format(SampleData[PileUp], PileUpFilesDirFmt)
plugin.register_semantic_type_to_format(SampleData[AlignmentMap],
                                        BAMFilesDirFmt)
plugin.register_semantic_type_to_format(SampleData[ConsensusSequences],
                                        FASTAFilesDirFmt)

importlib.import_module('q2_phylogenomics._transformers')
Beispiel #29
0
import q2_SCNIC

citations = Citations.load('citations.bib', package='q2_SCNIC')

plugin = Plugin(
    name='SCNIC',
    version=q2_SCNIC.__version__,
    website="https://github.com/shafferm/q2-SCNIC",
    package='q2_SCNIC',
    description=('This QIIME 2 plugin allows for use of the SCNIC methods '
                 'to build correlation networks as well as detect and '
                 'summarize modules of highy intercorrelated features'),
    short_description='Plugin for SCNIC usage.',
    citations=[citations['SciPyProceedings_11']])

plugin.register_semantic_types(Network)
plugin.register_semantic_types(PairwiseFeatureData)
plugin.register_semantic_types(ModuleMembership)

plugin.register_formats(GraphModelingLanguageFormat)
plugin.register_formats(GraphModelingLanguageDirectoryFormat)
plugin.register_formats(PairwiseFeatureDataFormat)
plugin.register_formats(PairwiseFeatureDataDirectoryFormat)
plugin.register_formats(ModuleMembershipTSVFormat)
plugin.register_formats(ModuleMembershipTSVDirectoryFormat)

plugin.register_semantic_type_to_format(
    Network, artifact_format=GraphModelingLanguageDirectoryFormat)
plugin.register_semantic_type_to_format(
    PairwiseFeatureData, artifact_format=PairwiseFeatureDataDirectoryFormat)
plugin.register_semantic_type_to_format(
Beispiel #30
0
citations = Citations.load('citations.bib', package='qiime2.core.testing')
dummy_plugin = Plugin(
    name='dummy-plugin',
    description='Description of dummy plugin.',
    short_description='Dummy plugin for testing.',
    version='0.0.0-dev',
    website='https://github.com/qiime2/qiime2',
    package='qiime2.core.testing',
    user_support_text='For help, see https://qiime2.org',
    citations=[citations['unger1998does'], citations['berry1997flying']])

import_module('qiime2.core.testing.transformer')

# Register semantic types
dummy_plugin.register_semantic_types(IntSequence1, IntSequence2, IntSequence3,
                                     Mapping, FourInts, Kennel, Dog, Cat,
                                     SingleInt, C1, C2, C3, Foo, Bar, Baz)

# Register formats
dummy_plugin.register_formats(IntSequenceFormatV2, MappingFormat,
                              IntSequenceV2DirectoryFormat,
                              IntSequenceMultiFileDirectoryFormat,
                              MappingDirectoryFormat, EchoDirectoryFormat,
                              EchoFormat)

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

dummy_plugin.register_views(int,
plugin = Plugin(
    name='ninja-ops',
    version=q2_ninja_ops.__version__,
    website='https://github.com/knights-lab/q2-ninja-ops',
    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