示例#1
0
    def test_call(self):
        def validate_func(a, b, c, d):
            return 42

        def html_generator_func(a, b, c, d):
            return 42

        # Test the install procedure
        atypes = [QiitaArtifactType('Name', 'Description', False, True, False,
                                    [('plain_text', False)])]
        tester = QiitaTypePlugin("NewPlugin", "1.0.0", "Description",
                                 validate_func, html_generator_func, atypes)

        # Generate the config file for the new plugin
        tester.generate_config('ls', 'echo',
                               server_cert=self.server_cert)
        # Ask Qiita to reload the plugins
        self.qclient.post('/apitest/reload_plugins/')

        # Install the current plugin
        tester("https://localhost:21174", 'register', 'ignored')

        # Check that it has been installed
        obs = self.qclient.get('/qiita_db/plugins/NewPlugin/1.0.0/')
        self.assertEqual(obs['name'], 'NewPlugin')
        self.assertEqual(obs['version'], '1.0.0')
示例#2
0
    def test_generate_config(self):
        def validate_func(a, b, c, d):
            return 42

        def html_generator_func(a, b, c, d):
            return 42
        atypes = [QiitaArtifactType('Name', 'Description', False, True, False,
                                    [('plain_text', False)])]
        tester = QiitaTypePlugin("NewPlugin", "1.0.0", "Description",
                                 validate_func, html_generator_func, atypes)

        tester.generate_config('ls', 'echo')
        self.assertTrue(exists(tester.conf_fp))
        with open(tester.conf_fp, 'U') as f:
            conf = f.readlines()

        exp_lines = ['[main]\n',
                     'NAME = NewPlugin\n',
                     'VERSION = 1.0.0\n',
                     'DESCRIPTION = Description\n',
                     'ENVIRONMENT_SCRIPT = ls\n',
                     'START_SCRIPT = echo\n',
                     'PLUGIN_TYPE = artifact definition\n',
                     'PUBLICATIONS = \n',
                     '\n',
                     '[oauth2]\n',
                     'SERVER_CERT = \n']
        # We will test the last 2 lines independently since they're variable
        # in each test run
        self.assertEqual(conf[:-2], exp_lines)
        self.assertTrue(conf[-2].startswith('CLIENT_ID = '))
        self.assertTrue(conf[-1].startswith('CLIENT_SECRET = '))
示例#3
0
    def test_init(self):
        def validate_func(a, b, c, d):
            return 42

        def html_generator_func(a, b, c, d):
            return 42

        atypes = [QiitaArtifactType('Name', 'Description', False, True, False,
                                    [('plain_text', False)])]
        obs = QiitaTypePlugin("NewPlugin", "1.0.0", "Description",
                              validate_func, html_generator_func,
                              atypes)
        self.assertEqual(obs.name, "NewPlugin")
        self.assertEqual(obs.version, "1.0.0")
        self.assertEqual(obs.description, "Description")
        self.assertEqual(set(obs.task_dict.keys()),
                         {'Validate', 'Generate HTML summary'})
        self.assertEqual(obs.task_dict['Validate'].function, validate_func)
        self.assertEqual(obs.task_dict['Generate HTML summary'].function,
                         html_generator_func)
        self.assertEqual(obs.artifact_types, atypes)
        self.assertEqual(basename(obs.conf_fp), 'NewPlugin_1.0.0.conf')
示例#4
0
    #                   can_be_submitted_to_vamps, is_user_uploadable,
    #                   filepath_types):
    QiitaArtifactType('SFF', 'Raw SFF files', False, False, True,
                      [('raw_sff', True)]),
    QiitaArtifactType('FASTA_Sanger', 'Raw fasta files from Sanger sequencing',
                      False, False, False, [('raw_fasta', True)]),
    QiitaArtifactType('FASTQ', 'Raw fastq files, with or without paired ends',
                      False, False, True, [('raw_forward_seqs', True),
                                           ('raw_reverse_seqs', False),
                                           ('raw_barcodes', True)]),
    QiitaArtifactType('FASTA', 'Raw fasta files', False, False, True,
                      [('raw_fasta', True), ('raw_qual', False)]),
    QiitaArtifactType('FASTA_preprocessed', 'preprocessed fasta files', False,
                      False, False, [('preprocessed_fasta', True),
                                     ('log', False)]),
    QiitaArtifactType('per_sample_FASTQ', 'Raw per sample FASTQ files', False,
                      False, True, [('raw_forward_seqs', True),
                                    ('raw_reverse_seqs', False)]),
    QiitaArtifactType('Demultiplexed',
                      'Demultiplexed and QC sequeunces with QIIME labels',
                      True, True, False, [('preprocessed_fasta', True),
                                          ('preprocessed_fastq', True),
                                          ('preprocessed_demux', False),
                                          ('log', False)]),
]

# Initialize the plugin
plugin = QiitaTypePlugin('Sequencing Data Type', '2022.07',
                         'Sequencing artifact types plugin', validate,
                         generate_html_summary, artifact_types)
示例#5
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 QiitaTypePlugin, QiitaArtifactType

from .validate import validate
from .summary import generate_html_summary

# Define the supported artifact types
artifact_types = [
    QiitaArtifactType('BIOM', 'BIOM table', False, False, True,
                      [('biom', True), ('directory', False), ('log', False),
                       ('preprocessed_fasta', False), ('plain_text', False),
                       ('qza', False)])
]

# Initialize the plugin
plugin = QiitaTypePlugin('BIOM type', '2.1.4 - Qiime2',
                         'The Biological Observation Matrix format', validate,
                         generate_html_summary, artifact_types)
示例#6
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 QiitaTypePlugin, QiitaArtifactType

from .validate import validate
from .summary import generate_html_summary

# Define the supported artifact types
artifact_types = [
    QiitaArtifactType(
        'distance_matrix', 'Distance matrix holding pairwise distance between '
        'samples', False, False, False, [('plain_text', True)]),
    QiitaArtifactType('ordination_results', 'Ordination results', False, False,
                      False, [('plain_text', True)]),
    QiitaArtifactType('alpha_vector', 'Alpha Diversity per sample results',
                      False, False, False, [('plain_text', True)])
]

# Initialize the plugin
plugin = QiitaTypePlugin('Diversity types', '0.1.0',
                         'Diversity artifacts type plugin', validate,
                         generate_html_summary, artifact_types)
示例#7
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 QiitaTypePlugin, QiitaArtifactType

from .validate import validate

# Define the supported artifact types
artifact_types = [
    QiitaArtifactType('q2_visualization', 'Qiime 2 visualization',
                      False, False, [('qzv', True)])]


# The visualization is the summary itself, so we don't need a
# generate_html_summary function. However, the plugins requires to
# register a function for it
def generate_html_summary(qclient, job_id, parameters, out_dir):
    return True, None, ""


# Initialize the plugin
plugin = QiitaTypePlugin('Visualization types', '0.1.0',
                         'Visualization artifacts type plugin',
                         validate, generate_html_summary,
                         artifact_types)
示例#8
0
from .validate import validate
from .summary import generate_html_summary

# DEfine the supported artifact types
artifact_types = [
    QiitaArtifactType('SFF', 'Raw SFF files', False, False,
                      [('raw_sff', True)]),
    QiitaArtifactType('FASTA_Sanger', 'Raw fasta files from Sanger sequencing',
                      False, False, [('raw_fasta', True)]),
    QiitaArtifactType('FASTQ', 'Raw fastq files, with or without paired ends',
                      False, False, [('raw_forward_seqs', True),
                                     ('raw_reverse_seqs', False),
                                     ('raw_barcodes', True)]),
    QiitaArtifactType('FASTA', 'Raw fasta files', False, False,
                      [('raw_fasta', True), ('raw_qual', False)]),
    QiitaArtifactType('per_sample_FASTQ', 'Raw per sample FASTQ files', False,
                      False, [('raw_forward_seqs', True),
                              ('raw_reverse_seqs', False)]),
    QiitaArtifactType('Demultiplexed',
                      'Demultiplexed and QC sequeunces with QIIME labels',
                      True, True, [('preprocessed_fasta', True),
                                   ('preprocessed_fastq', True),
                                   ('preprocessed_demux', False),
                                   ('log', False)]),
]

# Initialize the plugin
plugin = QiitaTypePlugin('Target Gene type', '0.1.0',
                         'Target gene artifact types plugin',
                         validate, generate_html_summary, artifact_types)