Exemple #1
0
        'representative_fragments': ('The consensus sequence fragments '
                                     'to be used for fragment insertion.'),
        'tree': 'The tree with all the reconstructed features',
        'placements': ('The location of the representative fragments '
                       'in the phylogenetic tree')
    },
    parameter_descriptions={
        'n_threads': 'the number of threads to use during fragment insertion',
    },
)

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)
Exemple #2
0
    version=q2_micom.__version__,
    website="https://github.com/micom-dev/q2-micom",
    package="q2_micom",
    description=(""),
    short_description="Plugin for metabolic modeling of microbial communities.",
    citations=[citations["micom"]],
)

plugin.register_formats(
    SBMLFormat,
    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,
import q2_covid
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))
        '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')

@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')
Exemple #6
0
    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']])

dummy_plugin.register_semantic_type_to_format(
    IntSequence1,
    artifact_format=IntSequenceDirectoryFormat
)
Exemple #7
0
#citations = Citations.load('citations.bib', package='q2_classo') 
plugin = Plugin(
name='classo',
                version='0.0.0.dev0',
website='https://github.com/Leo-Simpson/q2-classo',
package='q2-classo',
short_description=('Package for constrained sparse regression and classification'),
description=('This is QIIME 2 plugin that enables sparse and robust linear regression and classification with linear equality constraints on the model parameters.')
)


CLASSOProblem    = SemanticType("CLASSOProblem")
ConstraintMatrix = SemanticType("ConstraintMatrix")


plugin.register_formats(CLASSOProblemDirectoryFormat,ConstraintDirectoryFormat)
plugin.register_semantic_type_to_format(ConstraintMatrix,
                                        artifact_format=ConstraintDirectoryFormat)
plugin.register_semantic_type_to_format(CLASSOProblem, 
                                        artifact_format=CLASSOProblemDirectoryFormat)




plugin.methods.register_function(
           function=regress,
           inputs={'features': FeatureTable[Composition], 'c':ConstraintMatrix},
           parameters=regress_parameters,
           outputs= [('result',CLASSOProblem)],
           input_descriptions={'features': 'Matrix representing the data of the problem','c': 'Constraint matrix, default is the zero-sum',},
           parameter_descriptions=regress_parameter_descriptions,
Exemple #8
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')
Exemple #9
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
Exemple #10
0
        'table': FeatureTable[Frequency],
        'phylogeny': Phylogeny[Unrooted],
    },
    parameters={
        'metadata': Metadata,
        'formula': Str,
        'family': Str,
        'choice': Str % qiime2.plugin.Choices(_CHOICE_OPT),
        'nfactors': Int,
        'ncores': Int
    },
    outputs=[('featuretable', FeatureTable[Frequency]),
             ('tree', Phylogeny[Unrooted]), ('factors', FeatureData[Factors])],
    input_descriptions={
        'table':
        'The sample by observation table',
        'phylogeny': ('The phylogenetic tree describing the '
                      'relationship of the observations in '
                      'table')
    },
    parameter_descriptions={},
    output_descriptions={},
    name='Run Phylofactor',
    description='Phylofactor defines clades that are associated with '
    'metadata columns of interest')

plugin.register_formats(FactorsFormat, FactorsDirFmt)
plugin.register_semantic_types(Factors)
plugin.register_semantic_type_to_format(FeatureData[Factors], FactorsDirFmt)
importlib.import_module('q2_phylofactor._transform')
Exemple #11
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')
Exemple #12
0
    website='https://github.com/qiime2/qiime2',
    package='qiime2.core.testing',
    citation_text='No relevant citation.',
    user_support_text='For help, see https://qiime2.org'
)

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(
    IntSequenceFormat, IntSequenceFormatV2, MappingFormat, SingleIntFormat,
    IntSequenceDirectoryFormat, IntSequenceV2DirectoryFormat,
    MappingDirectoryFormat, FourIntsDirectoryFormat, UnimportableFormat,
    UnimportableDirectoryFormat, RedundantSingleIntDirectoryFormat
)

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
)
    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
    },
    outputs=[
        ('clustered_table', FeatureTable[Frequency]),
Exemple #14
0
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)

plugin.methods.register_function(
    function=q2_demux.emp_single,
    # TODO: remove RawSequences by creating an alias to EMPSequences
Exemple #15
0
    "code is used at all, which is useful for debugging. For n_jobs below -1, "
    "(n_cpus + 1 + n_jobs) are used. Thus for n_jobs = -2, all CPUs but one "
    "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]
    },
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,
    'individual_id_column': Str,
}
Exemple #17
0
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,
                                        artifact_format=GeneCoordDirFmt)

alnfmts = SeqAlnMap | BLAST6Out | SimpleMap
Exemple #18
0
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(
    ModuleMembership, artifact_format=ModuleMembershipTSVDirectoryFormat)

plugin.methods.register_function(
    function=sparcc_filter,
Exemple #19
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')
Exemple #20
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')
Exemple #21
0
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
    },
    outputs=[('clustered_table', FeatureTable[Frequency]),
             ('unmatched_sequences', SampleData[Sequences])],
                     'If there are more samples than this number the tree will'
                     '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')
Exemple #23
0
from genome_sampler.combine import combine_selections
from genome_sampler.summarize import summarize_selections
from genome_sampler.label_seqs import label_seqs, label_unaligned_seqs
from genome_sampler.mask import mask

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()
Exemple #24
0
    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
)

plugin.register_semantic_type_to_format(
    EMPPairedEndSequences,
    '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)
plugin.register_semantic_type_to_format(
    SampleData[Probabilities], artifact_format=ProbabilitiesDirectoryFormat)
plugin.register_formats(SampleEstimatorDirFmt, BooleanSeriesFormat,
                        BooleanSeriesDirectoryFormat, ImportanceFormat,
                        ImportanceDirectoryFormat, PredictionsFormat,
                        PredictionsDirectoryFormat, ProbabilitiesFormat,
                        ProbabilitiesDirectoryFormat)
importlib.import_module('q2_sample_classifier._transformer')
Exemple #26
0
    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, C1,
                                     C2, C3, Foo, Bar, Baz)

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

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(
    return ff


@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 '
Exemple #28
0
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]
            },  # TODO: Generalize, don't require frequency
    parameters={
        'corr_method': Str % Choices(["kendall", "pearson", "spearman"]),
Exemple #29
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')