Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/qiita-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
sed -i "s/f'Entered BaseQiitaPlugin._register_command({command.name})'/'Entered BaseQiitaPlugin._register_command(%s)' % command.name/" $CONDA_PREFIX/lib/python3.5/site-packages/qiita_client/plugin.py
pip --quiet install coveralls

configure_deblur --env-script "source /home/runner/.profile; conda activate deblur" --server-cert $QIITA_ROOTCA_CERT
configure_deblur --env-script "source /home/runner/.profile; conda activate deblur" --server-cert $QIITA_ROOTCA_CERT filesystem

echo "Available Qiita plugins"
ls ~/.qiita_plugins/
Expand All @@ -113,6 +113,7 @@ jobs:
export NGINX_FILE=`pwd`/qiita-dev/qiita_pet/nginx_example.conf
export NGINX_FILE_NEW=`pwd`/qiita-dev/qiita_pet/nginx_example_local.conf
sed "s#/home/runner/work/qiita/qiita#${PWD}/qiita-dev/#g" ${NGINX_FILE} > ${NGINX_FILE_NEW}
sed -i "s#/Users/username/qiita#${PWD}/qiita-dev#g" ${NGINX_FILE_NEW}
nginx -c ${NGINX_FILE_NEW}

echo "3. Setting up qiita"
Expand Down
37 changes: 25 additions & 12 deletions qp_deblur/deblur.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ def deblur(qclient, job_id, parameters, out_dir):
# Getting preparation information
prep_info = qclient.get(
'/qiita_db/prep_template/%s/' % artifact_info['prep_information'][0])
df = pd.read_csv(prep_info['prep-file'], sep='\t')
df = pd.read_csv(
qclient.fetch_file_from_central(prep_info['prep-file']), sep='\t')
if prep_info['data_type'] not in {'16S', '18S', 'ITS'}:
error_msg = ('deblur was developed only for amplicon sequencing data')
return False, None, error_msg
Expand Down Expand Up @@ -456,8 +457,9 @@ def deblur(qclient, job_id, parameters, out_dir):
# using the same number of parallel jobs as defined by the command
n_jobs = int(parameters['Jobs to start'])
# [0] cause there should be only 1 file
to_per_sample_files(fps['preprocessed_demux'][0],
out_dir=split_out_dir, n_jobs=n_jobs)
to_per_sample_files(
qclient.fetch_file_from_central(fps['preprocessed_demux'][0]),
out_dir=split_out_dir, n_jobs=n_jobs)

qclient.update_job_step(job_id, "Step 2 of 4: Generating per sample "
"from demux (2/2)")
Expand All @@ -467,8 +469,10 @@ def deblur(qclient, job_id, parameters, out_dir):
else:
qclient.update_job_step(job_id, "Step 2 of 4: Generating deblur "
"command")
cmd = generate_deblur_workflow_commands(fps['preprocessed_fastq'],
out_dir, parameters)
cmd = generate_deblur_workflow_commands(
list(map(qclient.fetch_file_from_central,
fps['preprocessed_fastq'])),
out_dir, parameters)

# Step 3 execute deblur
qclient.update_job_step(job_id, "Step 3 of 4: Executing deblur job")
Expand Down Expand Up @@ -582,14 +586,23 @@ def deblur(qclient, job_id, parameters, out_dir):
else:
new_placements = None

ainfo = [ArtifactInfo('deblur final table', 'BIOM',
[(final_biom, 'biom'),
(final_seqs, 'preprocessed_fasta')])]
ainfo = [
ArtifactInfo(
'deblur final table', 'BIOM',
[(qclient.push_file_to_central(final_biom),
'biom'),
(qclient.push_file_to_central(final_seqs),
'preprocessed_fasta')])]
if fp_phylogeny is not None:
ainfo.append(ArtifactInfo('deblur reference hit table', 'BIOM',
[(final_biom_hit, 'biom'),
(final_seqs_hit, 'preprocessed_fasta'),
(fp_phylogeny, 'plain_text')], new_placements))
ainfo.append(
ArtifactInfo(
'deblur reference hit table', 'BIOM',
[(qclient.push_file_to_central(final_biom_hit),
'biom'),
(qclient.push_file_to_central(final_seqs_hit),
'preprocessed_fasta'),
(qclient.push_file_to_central(fp_phylogeny),
'plain_text')], new_placements))

return True, ainfo, ""

Expand Down
9 changes: 7 additions & 2 deletions qp_deblur/tests/test_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

import json
from unittest import main
from os import close, remove
from os import close, remove, environ
from shutil import copyfile, rmtree
from tempfile import mkstemp, mkdtemp
from json import dumps
from os.path import exists, isdir

from qiita_client.testing import PluginTestCase

from qiita_client.plugin import BaseQiitaPlugin

from qp_deblur import plugin
from qp_deblur.deblur import deblur
Expand Down Expand Up @@ -65,6 +65,11 @@ def setUp(self):
'CCAGCTGTGAAATCCCCGGGCTCAACCTGGGAATTG')
]

# as we access functions directly, plugin configuration is not parsed,
# thus resort to environment variable here
self.qclient._plugincoupling = environ.get(
'QIITA_PLUGINCOUPLING', BaseQiitaPlugin._DEFAULT_PLUGIN_COUPLINGS)

def tearDown(self):
for fp in self._clean_up_files:
if exists(fp):
Expand Down
9 changes: 7 additions & 2 deletions qp_deblur/tests/test_deblur.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
# -----------------------------------------------------------------------------

from unittest import main
from os import close, remove, chmod
from os import close, remove, chmod, environ
from shutil import copyfile, rmtree
from tempfile import mkstemp, mkdtemp
from json import dumps, load
from os.path import exists, isdir, join
from os import environ

from qiita_client.testing import PluginTestCase
from qiita_client.plugin import BaseQiitaPlugin

from qp_deblur import plugin
from qp_deblur.deblur import (
Expand Down Expand Up @@ -57,6 +57,11 @@ def setUp(self):
# saving current value of PATH
self.oldpath = environ['PATH']

# as we access functions directly, plugin configuration is not parsed,
# thus resort to environment variable here
self.qclient._plugincoupling = environ.get(
'QIITA_PLUGINCOUPLING', BaseQiitaPlugin._DEFAULT_PLUGIN_COUPLINGS)

def tearDown(self):
# restore eventually changed PATH env var
environ['PATH'] = self.oldpath
Expand Down
6 changes: 4 additions & 2 deletions scripts/configure_deblur
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ from qp_deblur import plugin
@click.option('--env-script', prompt='Environment script',
default='source activate qp-deblur')
@click.option('--server-cert', prompt='Server certificate', default='None')
def config(env_script, server_cert):
@click.argument('plugincoupling', required=False, default='filesystem')
def config(env_script, server_cert, plugincoupling):
"""Generates the Qiita configuration files"""
if server_cert == 'None':
server_cert = None
plugin.generate_config(env_script, 'start_deblur',
server_cert=server_cert)
server_cert=server_cert,
plugin_coupling=plugincoupling)

if __name__ == '__main__':
config()
Loading