Skip to content

add execute_pipeline to StandardMetatranscriptomicWorkflow #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 17, 2025
Merged
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
39 changes: 19 additions & 20 deletions .github/workflows/qiita-plugin-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

on:
push:
branches: [ dev ]
branches: [dev]
pull_request:

jobs:
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:

conda activate klp

export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt
export QIITA_ROOTCA_CERT=`pwd`/qiita-dev/qiita_core/support_files/ci_rootca.crt
export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg
pip --quiet install -U pip

Expand All @@ -95,8 +95,8 @@ jobs:

export QP_KLP_CONFIG_FP=`pwd`/configuration.json

configure_qtp_job_output_folder --env-script "source /home/runner/.profile; conda activate klp" --server-cert $QIITA_SERVER_CERT
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
configure_qtp_job_output_folder --env-script "source /home/runner/.profile; conda activate klp" --ca-cert $QIITA_ROOTCA_CERT
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

echo "Available Qiita plugins"
ls ~/.qiita_plugins/
Expand All @@ -105,7 +105,7 @@ jobs:
shell: bash -l {0}
run: |
conda activate qiita
export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt
export QIITA_ROOTCA_CERT=`pwd`/qiita-dev/qiita_core/support_files/ci_rootca.crt
export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg
sed "s#/home/runner/work/qiita/qiita#${PWD}/qiita-dev/#g" `pwd`/qiita-dev/qiita_core/support_files/config_test.cfg > ${QIITA_CONFIG_FP}

Expand Down Expand Up @@ -137,28 +137,27 @@ jobs:
COVER_PACKAGE: ${{ matrix.cover_package }}
run: |
conda activate klp
export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt
export QIITA_ROOTCA_CERT=`pwd`/qiita-dev/qiita_core/support_files/ci_rootca.crt
export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg
export QP_KLP_CONFIG_FP=`pwd`/configuration.json
export PYTHONWARNINGS="ignore:Certificate for localhost has no \`subjectAltName\`"
nosetests --with-doctest --with-coverage -v --cover-package=qp_klp
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}

lint:
runs-on: ubuntu-latest
steps:
- name: flake8
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: install dependencies
run: python -m pip install --upgrade pip
- name: Check out repository code
uses: actions/checkout@v2
- name: lint
run: |
pip install -q flake8
flake8 qp_klp

- name: flake8
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: install dependencies
run: python -m pip install --upgrade pip
- name: Check out repository code
uses: actions/checkout@v2
- name: lint
run: |
pip install -q flake8
flake8 qp_klp
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# ignore local changes
qp_klp/tests/data/sample-sheets/*/*/*.csv
10 changes: 5 additions & 5 deletions qp_klp/Assays.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,11 +521,6 @@ def load_preps_into_qiita(self):

return df


class Metagenomic(MetaOmic):
METAGENOMIC_TYPE = 'Metagenomic'
assay_type = ASSAY_NAME_METAGENOMIC

def execute_pipeline(self):
'''
Executes steps of pipeline in proper sequence.
Expand Down Expand Up @@ -632,6 +627,11 @@ def execute_pipeline(self):
self.execute_commands()


class Metagenomic(MetaOmic):
METAGENOMIC_TYPE = 'Metagenomic'
assay_type = ASSAY_NAME_METAGENOMIC


class Metatranscriptomic(MetaOmic):
METATRANSCRIPTOMIC_TYPE = 'Metatranscriptomic'
assay_type = ASSAY_NAME_METATRANSCRIPTOMIC
10 changes: 5 additions & 5 deletions qp_klp/scripts/configure_klp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
@click.command()
@click.option('--env-script', prompt='Environment script', required=True,
default='source activate qp-klp')
@click.option('--server-cert', prompt='Server certificate', required=False,
@click.option('--ca-cert', prompt='Server certificate', required=False,
default='None', show_default=True)
def config(env_script, server_cert):
def config(env_script, ca_cert):
"""Generates the Qiita configuration files"""
if server_cert == 'None':
server_cert = None
plugin.generate_config(env_script, 'start_klp', server_cert=server_cert)
if ca_cert == 'None':
ca_cert = None
plugin.generate_config(env_script, 'start_klp', ca_cert)


if __name__ == '__main__':
Expand Down
34 changes: 28 additions & 6 deletions qp_klp/tests/test_WorkflowFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------------------------------------------
from qp_klp.WorkflowFactory import WorkflowFactory
from unittest import TestCase
from unittest import main
from os import makedirs
from qp_klp.Protocol import (PROTOCOL_NAME_ILLUMINA,
PROTOCOL_NAME_TELLSEQ)
from qp_klp.Assays import (ASSAY_NAME_METAGENOMIC,
ASSAY_NAME_METATRANSCRIPTOMIC,
ASSAY_NAME_AMPLICON)
from shutil import rmtree
from qiita_client.testing import PluginTestCase
from qiita_client.exceptions import NotFoundError


class WorkflowFactoryTests(TestCase):
class WorkflowFactoryTests(PluginTestCase):
def setUp(self):
self.remove_these = []

Expand Down Expand Up @@ -100,7 +102,7 @@ def test_invalid_sample_sheets(self):
def test_metagenomic_workflow_creation(self):
kwargs = {"uif_path": "qp_klp/tests/data/sample-sheets/metagenomic/"
"illumina/good_sheet1.csv",
"qclient": None,
"qclient": self.qclient,
"lane_number": "1",
"config_fp": "qp_klp/tests/data/configuration.json",
"run_identifier": "211021_A00000_0000_SAMPLE",
Expand All @@ -117,10 +119,14 @@ def test_metagenomic_workflow_creation(self):
self.assertEqual(wf.protocol_type, PROTOCOL_NAME_ILLUMINA)
self.assertEqual(wf.assay_type, ASSAY_NAME_METAGENOMIC)

with self.assertRaisesRegex(
NotFoundError, '{"message": "Study not found"}'):
wf.execute_pipeline()

def test_metatranscriptomic_workflow_creation(self):
kwargs = {"uif_path": "qp_klp/tests/data/sample-sheets/"
"metatranscriptomic/illumina/good_sheet1.csv",
"qclient": None,
"qclient": self.qclient,
"lane_number": "1",
"config_fp": "qp_klp/tests/data/configuration.json",
"run_identifier": "211021_A00000_0000_SAMPLE",
Expand All @@ -137,9 +143,13 @@ def test_metatranscriptomic_workflow_creation(self):
self.assertEqual(wf.protocol_type, PROTOCOL_NAME_ILLUMINA)
self.assertEqual(wf.assay_type, ASSAY_NAME_METATRANSCRIPTOMIC)

with self.assertRaisesRegex(
NotFoundError, '{"message": "Study not found"}'):
wf.execute_pipeline()

def test_amplicon_workflow_creation(self):
kwargs = {"uif_path": "qp_klp/tests/data/pre-preps/good_pre_prep1.txt",
"qclient": None,
"qclient": self.qclient,
"config_fp": "qp_klp/tests/data/configuration.json",
"run_identifier": "211021_A00000_0000_SAMPLE",
"output_dir": "qp_klp/tests/test_output",
Expand All @@ -155,10 +165,14 @@ def test_amplicon_workflow_creation(self):
self.assertEqual(wf.protocol_type, PROTOCOL_NAME_ILLUMINA)
self.assertEqual(wf.assay_type, ASSAY_NAME_AMPLICON)

with self.assertRaisesRegex(
NotFoundError, '{"message": "Study not found"}'):
wf.execute_pipeline()

def test_tellseq_workflow_creation(self):
kwargs = {"uif_path": "qp_klp/tests/data/sample-sheets/metagenomic/"
"tellseq/good_sheet1.csv",
"qclient": None,
"qclient": self.qclient,
"config_fp": "qp_klp/tests/data/configuration.json",
"run_identifier": "211021_A00000_0000_SAMPLE",
"output_dir": "qp_klp/tests/test_output",
Expand All @@ -174,3 +188,11 @@ def test_tellseq_workflow_creation(self):
# confirm that the proper type of workflow was generated.
self.assertEqual(wf.protocol_type, PROTOCOL_NAME_TELLSEQ)
self.assertEqual(wf.assay_type, ASSAY_NAME_METAGENOMIC)

with self.assertRaisesRegex(
NotFoundError, '{"message": "Study not found"}'):
wf.execute_pipeline()


if __name__ == '__main__':
main()