diff --git a/cg/cli/workflow/base.py b/cg/cli/workflow/base.py index e159534808..2d1cc1590c 100644 --- a/cg/cli/workflow/base.py +++ b/cg/cli/workflow/base.py @@ -14,6 +14,7 @@ from cg.cli.workflow.mip_dna.base import mip_dna from cg.cli.workflow.mip_rna.base import mip_rna from cg.cli.workflow.mutant.base import mutant +from cg.cli.workflow.nallo.base import nallo from cg.cli.workflow.raredisease.base import raredisease from cg.cli.workflow.rnafusion.base import rnafusion from cg.cli.workflow.taxprofiler.base import taxprofiler @@ -27,16 +28,17 @@ def workflow(): workflow.add_command(balsamic) workflow.add_command(balsamic_qc) -workflow.add_command(balsamic_umi) workflow.add_command(balsamic_pon) +workflow.add_command(balsamic_umi) +workflow.add_command(fluffy) +workflow.add_command(jasen) workflow.add_command(microsalt) workflow.add_command(mip_dna) workflow.add_command(mip_rna) -workflow.add_command(fluffy) -workflow.add_command(jasen) workflow.add_command(mutant) +workflow.add_command(nallo) workflow.add_command(raredisease) +workflow.add_command(raw_data) workflow.add_command(rnafusion) workflow.add_command(taxprofiler) workflow.add_command(tomte) -workflow.add_command(raw_data) diff --git a/cg/cli/workflow/nallo/__init__.py b/cg/cli/workflow/nallo/__init__.py new file mode 100644 index 0000000000..d3a1fde1a8 --- /dev/null +++ b/cg/cli/workflow/nallo/__init__.py @@ -0,0 +1 @@ +"""Init for module""" diff --git a/cg/cli/workflow/nallo/base.py b/cg/cli/workflow/nallo/base.py new file mode 100644 index 0000000000..39c27232a0 --- /dev/null +++ b/cg/cli/workflow/nallo/base.py @@ -0,0 +1,20 @@ +"""CLI support to create config and/or start NALLO.""" + +import logging + +import rich_click as click + +from cg.cli.utils import CLICK_CONTEXT_SETTINGS +from cg.constants.constants import MetaApis +from cg.meta.workflow.analysis import AnalysisAPI +from cg.meta.workflow.nallo import NalloAnalysisAPI + +LOG = logging.getLogger(__name__) + + +@click.group(invoke_without_command=True, context_settings=CLICK_CONTEXT_SETTINGS) +@click.pass_context +def nallo(context: click.Context) -> None: + """GMS/Nallo analysis workflow.""" + AnalysisAPI.get_help(context) + context.obj.meta_apis[MetaApis.ANALYSIS_API] = NalloAnalysisAPI(config=context.obj) diff --git a/cg/meta/workflow/nallo.py b/cg/meta/workflow/nallo.py new file mode 100644 index 0000000000..ede48ea93e --- /dev/null +++ b/cg/meta/workflow/nallo.py @@ -0,0 +1,20 @@ +"""Module for Nallo Analysis API.""" + +import logging +from cg.constants import Workflow +from cg.meta.workflow.nf_analysis import NfAnalysisAPI +from cg.models.cg_config import CGConfig + +LOG = logging.getLogger(__name__) + + +class NalloAnalysisAPI(NfAnalysisAPI): + """Handles communication between Nallo processes + and the rest of CG infrastructure.""" + + def __init__( + self, + config: CGConfig, + workflow: Workflow = Workflow.NALLO, + ): + super().__init__(config=config, workflow=workflow) diff --git a/tests/cli/workflow/nf_analysis/test_cli_workflow_base.py b/tests/cli/workflow/nf_analysis/test_cli_workflow_base.py index c8a127ece7..aa6cdcfc3e 100644 --- a/tests/cli/workflow/nf_analysis/test_cli_workflow_base.py +++ b/tests/cli/workflow/nf_analysis/test_cli_workflow_base.py @@ -10,7 +10,7 @@ @pytest.mark.parametrize( "workflow", - NEXTFLOW_WORKFLOWS + [Workflow.JASEN], + NEXTFLOW_WORKFLOWS + [Workflow.JASEN] + [Workflow.NALLO], ) def test_workflow_no_args(cli_runner: CliRunner, workflow: Workflow, request): """Test to see that workflow is added and prints help when no subcommand is specified.""" diff --git a/tests/conftest.py b/tests/conftest.py index e53ff46ea5..8d2b9210fe 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -44,6 +44,7 @@ from cg.meta.tar.tar import TarAPI from cg.meta.transfer.external_data import ExternalDataAPI from cg.meta.workflow.jasen import JasenAnalysisAPI +from cg.meta.workflow.nallo import NalloAnalysisAPI from cg.meta.workflow.raredisease import RarediseaseAnalysisAPI from cg.meta.workflow.rnafusion import RnafusionAnalysisAPI from cg.meta.workflow.taxprofiler import TaxprofilerAnalysisAPI @@ -2481,6 +2482,16 @@ def sequencing_platform() -> str: return SequencingPlatform.ILLUMINA +# Nallo fixtures +@pytest.fixture(scope="function") +def nallo_context( + cg_context: CGConfig, +) -> CGConfig: + """Context to use in cli.""" + cg_context.meta_apis["analysis_api"] = NalloAnalysisAPI(config=cg_context) + return cg_context + + # Raredisease fixtures @pytest.fixture(scope="function") def raredisease_dir(tmpdir_factory, apps_dir: Path) -> str: