Skip to content

Commit d7aec03

Browse files
authored
add execute_pipeline to StandardMetatranscriptomicWorkflow (#101)
* add execute_pipeline to StandardMetatranscriptomicWorkflow * fix CI * fix configure_klp.py
1 parent 2d0f041 commit d7aec03

File tree

5 files changed

+60
-36
lines changed

5 files changed

+60
-36
lines changed

.github/workflows/qiita-plugin-ci.yml

+19-20
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
on:
44
push:
5-
branches: [ dev ]
5+
branches: [dev]
66
pull_request:
77

88
jobs:
@@ -83,7 +83,7 @@ jobs:
8383
8484
conda activate klp
8585
86-
export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt
86+
export QIITA_ROOTCA_CERT=`pwd`/qiita-dev/qiita_core/support_files/ci_rootca.crt
8787
export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg
8888
pip --quiet install -U pip
8989
@@ -95,8 +95,8 @@ jobs:
9595
9696
export QP_KLP_CONFIG_FP=`pwd`/configuration.json
9797
98-
configure_qtp_job_output_folder --env-script "source /home/runner/.profile; conda activate klp" --server-cert $QIITA_SERVER_CERT
99-
configure_klp --env-script "source /home/runner/.profile; export QP_KLP_CONFIG_FP=$QP_KLP_CONFIG_FP; conda activate klp" --server-cert $QIITA_SERVER_CERT
98+
configure_qtp_job_output_folder --env-script "source /home/runner/.profile; conda activate klp" --ca-cert $QIITA_ROOTCA_CERT
99+
configure_klp --env-script "source /home/runner/.profile; export QP_KLP_CONFIG_FP=$QP_KLP_CONFIG_FP; conda activate klp" --ca-cert $QIITA_ROOTCA_CERT
100100
101101
echo "Available Qiita plugins"
102102
ls ~/.qiita_plugins/
@@ -105,7 +105,7 @@ jobs:
105105
shell: bash -l {0}
106106
run: |
107107
conda activate qiita
108-
export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt
108+
export QIITA_ROOTCA_CERT=`pwd`/qiita-dev/qiita_core/support_files/ci_rootca.crt
109109
export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg
110110
sed "s#/home/runner/work/qiita/qiita#${PWD}/qiita-dev/#g" `pwd`/qiita-dev/qiita_core/support_files/config_test.cfg > ${QIITA_CONFIG_FP}
111111
@@ -137,28 +137,27 @@ jobs:
137137
COVER_PACKAGE: ${{ matrix.cover_package }}
138138
run: |
139139
conda activate klp
140-
export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt
140+
export QIITA_ROOTCA_CERT=`pwd`/qiita-dev/qiita_core/support_files/ci_rootca.crt
141141
export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg
142142
export QP_KLP_CONFIG_FP=`pwd`/configuration.json
143143
export PYTHONWARNINGS="ignore:Certificate for localhost has no \`subjectAltName\`"
144144
nosetests --with-doctest --with-coverage -v --cover-package=qp_klp
145145
- uses: codecov/codecov-action@v3
146146
with:
147-
token: ${{ secrets.CODECOV_TOKEN }}
147+
token: ${{ secrets.CODECOV_TOKEN }}
148148

149149
lint:
150150
runs-on: ubuntu-latest
151151
steps:
152-
- name: flake8
153-
uses: actions/setup-python@v2
154-
with:
155-
python-version: 3.9
156-
- name: install dependencies
157-
run: python -m pip install --upgrade pip
158-
- name: Check out repository code
159-
uses: actions/checkout@v2
160-
- name: lint
161-
run: |
162-
pip install -q flake8
163-
flake8 qp_klp
164-
152+
- name: flake8
153+
uses: actions/setup-python@v2
154+
with:
155+
python-version: 3.9
156+
- name: install dependencies
157+
run: python -m pip install --upgrade pip
158+
- name: Check out repository code
159+
uses: actions/checkout@v2
160+
- name: lint
161+
run: |
162+
pip install -q flake8
163+
flake8 qp_klp

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,6 @@ dmypy.json
127127

128128
# Pyre type checker
129129
.pyre/
130+
131+
# ignore local changes
132+
qp_klp/tests/data/sample-sheets/*/*/*.csv

qp_klp/Assays.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,6 @@ def load_preps_into_qiita(self):
521521

522522
return df
523523

524-
525-
class Metagenomic(MetaOmic):
526-
METAGENOMIC_TYPE = 'Metagenomic'
527-
assay_type = ASSAY_NAME_METAGENOMIC
528-
529524
def execute_pipeline(self):
530525
'''
531526
Executes steps of pipeline in proper sequence.
@@ -632,6 +627,11 @@ def execute_pipeline(self):
632627
self.execute_commands()
633628

634629

630+
class Metagenomic(MetaOmic):
631+
METAGENOMIC_TYPE = 'Metagenomic'
632+
assay_type = ASSAY_NAME_METAGENOMIC
633+
634+
635635
class Metatranscriptomic(MetaOmic):
636636
METATRANSCRIPTOMIC_TYPE = 'Metatranscriptomic'
637637
assay_type = ASSAY_NAME_METATRANSCRIPTOMIC

qp_klp/scripts/configure_klp.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
@click.command()
1717
@click.option('--env-script', prompt='Environment script', required=True,
1818
default='source activate qp-klp')
19-
@click.option('--server-cert', prompt='Server certificate', required=False,
19+
@click.option('--ca-cert', prompt='Server certificate', required=False,
2020
default='None', show_default=True)
21-
def config(env_script, server_cert):
21+
def config(env_script, ca_cert):
2222
"""Generates the Qiita configuration files"""
23-
if server_cert == 'None':
24-
server_cert = None
25-
plugin.generate_config(env_script, 'start_klp', server_cert=server_cert)
23+
if ca_cert == 'None':
24+
ca_cert = None
25+
plugin.generate_config(env_script, 'start_klp', ca_cert)
2626

2727

2828
if __name__ == '__main__':

qp_klp/tests/test_WorkflowFactory.py

+28-6
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@
66
# The full license is in the file LICENSE, distributed with this software.
77
# -----------------------------------------------------------------------------
88
from qp_klp.WorkflowFactory import WorkflowFactory
9-
from unittest import TestCase
9+
from unittest import main
1010
from os import makedirs
1111
from qp_klp.Protocol import (PROTOCOL_NAME_ILLUMINA,
1212
PROTOCOL_NAME_TELLSEQ)
1313
from qp_klp.Assays import (ASSAY_NAME_METAGENOMIC,
1414
ASSAY_NAME_METATRANSCRIPTOMIC,
1515
ASSAY_NAME_AMPLICON)
1616
from shutil import rmtree
17+
from qiita_client.testing import PluginTestCase
18+
from qiita_client.exceptions import NotFoundError
1719

1820

19-
class WorkflowFactoryTests(TestCase):
21+
class WorkflowFactoryTests(PluginTestCase):
2022
def setUp(self):
2123
self.remove_these = []
2224

@@ -100,7 +102,7 @@ def test_invalid_sample_sheets(self):
100102
def test_metagenomic_workflow_creation(self):
101103
kwargs = {"uif_path": "qp_klp/tests/data/sample-sheets/metagenomic/"
102104
"illumina/good_sheet1.csv",
103-
"qclient": None,
105+
"qclient": self.qclient,
104106
"lane_number": "1",
105107
"config_fp": "qp_klp/tests/data/configuration.json",
106108
"run_identifier": "211021_A00000_0000_SAMPLE",
@@ -117,10 +119,14 @@ def test_metagenomic_workflow_creation(self):
117119
self.assertEqual(wf.protocol_type, PROTOCOL_NAME_ILLUMINA)
118120
self.assertEqual(wf.assay_type, ASSAY_NAME_METAGENOMIC)
119121

122+
with self.assertRaisesRegex(
123+
NotFoundError, '{"message": "Study not found"}'):
124+
wf.execute_pipeline()
125+
120126
def test_metatranscriptomic_workflow_creation(self):
121127
kwargs = {"uif_path": "qp_klp/tests/data/sample-sheets/"
122128
"metatranscriptomic/illumina/good_sheet1.csv",
123-
"qclient": None,
129+
"qclient": self.qclient,
124130
"lane_number": "1",
125131
"config_fp": "qp_klp/tests/data/configuration.json",
126132
"run_identifier": "211021_A00000_0000_SAMPLE",
@@ -137,9 +143,13 @@ def test_metatranscriptomic_workflow_creation(self):
137143
self.assertEqual(wf.protocol_type, PROTOCOL_NAME_ILLUMINA)
138144
self.assertEqual(wf.assay_type, ASSAY_NAME_METATRANSCRIPTOMIC)
139145

146+
with self.assertRaisesRegex(
147+
NotFoundError, '{"message": "Study not found"}'):
148+
wf.execute_pipeline()
149+
140150
def test_amplicon_workflow_creation(self):
141151
kwargs = {"uif_path": "qp_klp/tests/data/pre-preps/good_pre_prep1.txt",
142-
"qclient": None,
152+
"qclient": self.qclient,
143153
"config_fp": "qp_klp/tests/data/configuration.json",
144154
"run_identifier": "211021_A00000_0000_SAMPLE",
145155
"output_dir": "qp_klp/tests/test_output",
@@ -155,10 +165,14 @@ def test_amplicon_workflow_creation(self):
155165
self.assertEqual(wf.protocol_type, PROTOCOL_NAME_ILLUMINA)
156166
self.assertEqual(wf.assay_type, ASSAY_NAME_AMPLICON)
157167

168+
with self.assertRaisesRegex(
169+
NotFoundError, '{"message": "Study not found"}'):
170+
wf.execute_pipeline()
171+
158172
def test_tellseq_workflow_creation(self):
159173
kwargs = {"uif_path": "qp_klp/tests/data/sample-sheets/metagenomic/"
160174
"tellseq/good_sheet1.csv",
161-
"qclient": None,
175+
"qclient": self.qclient,
162176
"config_fp": "qp_klp/tests/data/configuration.json",
163177
"run_identifier": "211021_A00000_0000_SAMPLE",
164178
"output_dir": "qp_klp/tests/test_output",
@@ -174,3 +188,11 @@ def test_tellseq_workflow_creation(self):
174188
# confirm that the proper type of workflow was generated.
175189
self.assertEqual(wf.protocol_type, PROTOCOL_NAME_TELLSEQ)
176190
self.assertEqual(wf.assay_type, ASSAY_NAME_METAGENOMIC)
191+
192+
with self.assertRaisesRegex(
193+
NotFoundError, '{"message": "Study not found"}'):
194+
wf.execute_pipeline()
195+
196+
197+
if __name__ == '__main__':
198+
main()

0 commit comments

Comments
 (0)