def test_call(self): def func(qclient, job_id, job_params, working_dir): fp = join(working_dir, 'test.fastq') with open(fp, 'w') as f: f.write('') res = ArtifactInfo('out1', 'Demultiplexed', [[fp, 'preprocessed_fastq']]) return True, "", [res] tester = QiitaPlugin("NewPlugin", "0.0.1", "description") cmd = QiitaCommand("NewCmd", "Desc", func, {'p1': ('artifact', ['FASTQ'])}, {'p2': ('string', 'dflt')}, {'out1': 'Demultiplexed'}) tester.register_command(cmd) a_cmd = QiitaCommand("NewCmdAnalysis", "Desc", func, {'p1': ('artifact', ['FASTQ'])}, {'p2': ('string', 'dflt')}, {'out1': 'Demultiplexed'}) tester.register_command(a_cmd) tester.generate_config('ls', 'echo', server_cert=self.server_cert) self.qclient.post('/apitest/reload_plugins/') tester("https://localhost:21174", 'register', 'ignored') obs = self.qclient.get('/qiita_db/plugins/NewPlugin/0.0.1/') self.assertEqual(obs['name'], 'NewPlugin') self.assertEqual(obs['version'], '0.0.1') # I can't use assertItemsEqual because it is not available in py3 # and I can't user assertCountEqual because it is not avaialable in py2 self.assertEqual(sorted(obs['commands']), sorted(['NewCmd', 'NewCmdAnalysis'])) # Create a new job data = {'command': dumps(['NewPlugin', '0.0.1', 'NewCmd']), 'parameters': dumps({'p1': '1', 'p2': 'a'}), 'status': 'queued'} job_id = self.qclient.post('/apitest/processing_job/', data=data)['job'] tester("https://localhost:21174", job_id, self.outdir) status = self._wait_for_running_job(job_id) self.assertEqual(status, 'success')
# ----------------------------------------------------------------------------- # Copyright (c) {% now 'local', '%Y' %}, {{cookiecutter.author}}. # # Distributed under the terms of the {{cookiecutter.license}} License. # # The full license is in the file LICENSE, distributed with this software. # ----------------------------------------------------------------------------- from qiita_client import QiitaPlugin, QiitaCommand # TODO: include relevant imports here # from .mycommand import my_command_function # Initialize the plugin plugin = QiitaPlugin('{{cookiecutter.project_name}}', '0.0.1', 'Qiita Plugin: {{cookiecutter.project_name}}') # TODO: Define your commands. Here is an example on how to define one command. # You can define as many as needed # followed by the description of the API # req_params = {'Input artifact': ('artifact', ['Demultiplexed']), # 'Input integer': ('integer', 1000)} # req_params is a dictionary defining the requried parameters of the command. # "required" means that the user is forced to provide a value in the Qiita GUI # The keys are the parameter names and the values are 2-tuples in which the # first element of the tuple is the parameter type and the second element # is defined as: # If the parameter type is an artifact, then is a list with the accepted # artifact type # Otherwise is a default value for the parameter
# ----------------------------------------------------------------------------- # Copyright (c) 2018, Qiita development team. # # Distributed under the terms of the BSD 3-clause License License. # # The full license is in the file LICENSE, distributed with this software. # ----------------------------------------------------------------------------- from qiita_client import QiitaPlugin, QiitaCommand # TODO: include relevant imports here # from .mycommand import my_command_function # Initialize the plugin plugin = QiitaPlugin('mass_spec', '0.0.1', 'Qiita Plugin: mass_spec') # TODO: Define your commands. Here is an example on how to define one command. # You can define as many as needed # followed by the description of the API req_params = { 'Input artifact': ('artifact', ['Demultiplexed']), 'Input integer': ('integer', 1000) } # req_params is a dictionary defining the requried parameters of the command. # "required" means that the user is forced to provide a value in the Qiita GUI # The keys are the parameter names and the values are 2-tuples in which the # first element of the tuple is the parameter type and the second element # is defined as: # If the parameter type is an artifact, then is a list with the accepted # artifact type
from os import environ from os.path import join from glob import glob from qiita_client import QiitaPlugin, QiitaCommand from .qp_qiime2 import (QIITA_Q2_SEMANTIC_TYPE, Q2_QIITA_SEMANTIC_TYPE, Q2_ALLOWED_PLUGINS, PRIMITIVE_TYPES, call_qiime2, RENAME_COMMANDS, NOT_VALID_OUTPUTS, Q2_EXTRA_COMMANDS) from .util import get_qiime2_type_name_and_predicate from qiime2 import __version__ as qiime2_version from qiime2.sdk.util import actions_by_input_type from qiime2.sdk import PluginManager # Initialize the qiita_plugin plugin = QiitaPlugin('qiime2', qiime2_version, 'QIIME 2') # The extra commands require a folder where all the pre-calculated databases # exist, which is set up via a ENV variable, if not present we should raise # an error qp_qiime2_dbs = environ.get('QP_QIIME2_DBS') if qp_qiime2_dbs is None: raise ValueError("Missing ENV var QP_QIIME2_DBS, please set.") qp_qiime2_dbs = glob(join(qp_qiime2_dbs, '*.qza')) if len(qp_qiime2_dbs) < 1: raise ValueError( "ENV QP_QIIME2_DBS points to a folder without QZA files, please set.") # Similar to the precomputed databases, we also need a folder containing all # the valid per-sequence filtering artifacts qp_filtering_qza = environ.get('QP_QIIME2_FILTER_QZA')
# ----------------------------------------------------------------------------- # Copyright (c) 2014--, The Qiita Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # ----------------------------------------------------------------------------- from qiita_client import QiitaPlugin from .trim import trim_cmd from .filter import filter_cmd from .shogun import shogun_cmd # Initialize the plugin plugin = QiitaPlugin('qp-shogun', '0.0.1', 'Shogun analysis tools for shotgun data') plugin.register_command(trim_cmd) plugin.register_command(filter_cmd) plugin.register_command(shogun_cmd)
# ----------------------------------------------------------------------------- # Copyright (c) 2020--, The Qiita Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # ----------------------------------------------------------------------------- from qiita_client import QiitaPlugin, QiitaCommand from .woltka import woltka from qp_woltka.util import generate_woltka_dflt_params, get_dbs, plugin_details from os import environ # Initialize the plugin plugin = QiitaPlugin(**plugin_details) db_list = list(get_dbs(environ["QC_WOLTKA_DB_DP"]).values()) req_params = {'input': ('artifact', ['per_sample_FASTQ'])} opt_params = { # database 'Database': [ "choice: [%s]" % ','.join([f'"{db}"' for db in db_list]), # making the first option default and rm quotes db_list[0] ], } outputs = { 'Alignment Profile': 'BIOM', 'Taxonomic Predictions - phylum': 'BIOM', 'Taxonomic Predictions - genus': 'BIOM',
# ----------------------------------------------------------------------------- # Copyright (c) 2014--, The Qiita Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # ----------------------------------------------------------------------------- from qiita_client import QiitaPlugin, QiitaCommand from .split_libraries import split_libraries, split_libraries_fastq from .pick_otus import pick_closed_reference_otus from .trimming import trimming # Initialize the plugin plugin = QiitaPlugin( 'QIIMEq2', '1.9.1', 'Quantitative Insights Into Microbial Ecology (QIIME)') # Define the Split libraries command req_params = {'input_data': ('artifact', ['FASTA', 'FASTA_Sanger', 'SFF'])} opt_params = { 'barcode_type': ['string', 'golay_12'], 'disable_bc_correction': ['boolean', 'False'], 'disable_primers': ['boolean', 'False'], 'max_ambig': ['integer', '6'], 'max_barcode_errors': ['float', '1.5'], 'max_homopolymer': ['integer', '6'], 'max_primer_mismatch': ['integer', '0'], 'max_seq_len': ['integer', '1000'], 'min_qual_score': ['integer', '25'], 'min_seq_len': ['integer', '200'], 'qual_score_window': ['integer', '0'],
# ----------------------------------------------------------------------------- # Copyright (c) 2014--, The Qiita Development Team. # # Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # ----------------------------------------------------------------------------- from qiita_client import QiitaPlugin from .humann2 import humann2_cmd from .kneaddata import kneaddata_cmd # Initialize the plugin plugin = QiitaPlugin('qp-shotgun', '0.0.1', 'Analysis tools for shotgun data') plugin.register_command(humann2_cmd) plugin.register_command(kneaddata_cmd)
# Copyright (c) 2020, Qiita development team. # # Distributed under the terms of the BSD 3-clause License License. # # The full license is in the file LICENSE, distributed with this software. # ----------------------------------------------------------------------------- from qiita_client import QiitaPlugin, QiitaCommand from .qp_fastp_minimap2 import get_dbs_list, fastp_minimap2 from .utils import plugin_details from os.path import splitext THREADS = 15 # Initialize the plugin plugin = QiitaPlugin(**plugin_details) # Define the command dbs = get_dbs_list() dbs_without_extension = [splitext(db)[0] for db in dbs] dbs_defaults = ', '.join([f'"{x}"' for x in dbs_without_extension]) req_params = {'input': ('artifact', ['per_sample_FASTQ'])} opt_params = { 'reference': [f'choice:["None", {dbs_defaults}]', dbs_without_extension[0]], 'threads': ['integer', f'{THREADS}'] } outputs = {'Filtered files': 'per_sample_FASTQ'} default_params = { 'auto-detect adapters only filtering [not recommended]': {
from os import environ from os.path import join from glob import glob from qiita_client import QiitaPlugin, QiitaCommand from .qp_qiime2 import ( QIITA_Q2_SEMANTIC_TYPE, Q2_QIITA_SEMANTIC_TYPE, Q2_ALLOWED_PLUGINS, PRIMITIVE_TYPES, call_qiime2, RENAME_COMMANDS) from qiime2 import __version__ as qiime2_version from qiime2.sdk.util import actions_by_input_type from qiime2.sdk import PluginManager # Initialize the qiita_plugin plugin = QiitaPlugin('qiime2', qiime2_version, 'QIIME 2') # The extra commands require a folder where all the pre-calculated databases # exist, which is set up via a ENV variable, if not present we should raise # an error qp_qiime2_dbs = environ.get('QP_QIIME2_DBS') if qp_qiime2_dbs is None: raise ValueError("Missing ENV var QP_QIIME2_DBS, please set.") qp_qiime2_dbs = glob(join(qp_qiime2_dbs, '*.qza')) if len(qp_qiime2_dbs) < 1: raise ValueError( "ENV QP_QIIME2_DBS points to a folder without QZA files, please set.") # PLEASE READ: # There are 2 main steps: # 1. We are going loop over QIITA_Q2_SEMANTIC_TYPE (lookup table) so we can
# Distributed under the terms of the BSD 3-clause License. # # The full license is in the file LICENSE, distributed with this software. # ----------------------------------------------------------------------------- import os from qiita_client import QiitaPlugin, QiitaCommand from .deblur import deblur __all__ = ['deblur'] # Initialize the plugin plugin = QiitaPlugin( 'deblur', '1.1.0', 'A greedy deconvolution algorithm based on Illumina ' 'Miseq/Hiseq error profiles') # Define the deblur-workflow command req_params = {'Demultiplexed sequences': ('artifact', ['Demultiplexed'])} opt_params = { # parameters not being passed # output-dir # keep-tmp-files # log-level # log-file # overwrite # is-worker-thread 'Positive filtering database': ['choice:["default"]', 'default'], 'Negative filtering database': ['choice:["default"]', 'default'], 'Indexed positive filtering database': ['choice:["default"]', 'default'],
from qiita_client import QiitaPlugin, QiitaCommand from .qp_spades import spades THREADS = "16" MEMORY = "200" KMERS = "21,33,55,77,99,127" plugin_details = { 'name': 'qp-spades', 'version': '3.15.2', 'description': 'spades pipeline' } # Initialize the plugin plugin = QiitaPlugin(**plugin_details) # Define the command req_params = {'input': ('artifact', ['per_sample_FASTQ'])} opt_params = { 'type': ['choice:["meta", "isolate"]', "meta"], 'merging': ['choice:["no merge", "flash 65%"]', "flash 65%"], 'threads': ['integer', THREADS], 'memory': ['integer', MEMORY], 'k-mers': ['string', KMERS], } outputs = {'Preprocessed FASTA': 'FASTA_preprocessed'} default_params = { 'no merging + meta': { 'type': 'meta',