Skip to content

Commit

Permalink
add nallo to cg workflow cli (#4077)
Browse files Browse the repository at this point in the history
### Added
- nallo to cg workflow cli
  • Loading branch information
peterpru authored Jan 14, 2025
1 parent f67b35e commit b294fc3
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 5 deletions.
10 changes: 6 additions & 4 deletions cg/cli/workflow/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
1 change: 1 addition & 0 deletions cg/cli/workflow/nallo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Init for module"""
20 changes: 20 additions & 0 deletions cg/cli/workflow/nallo/base.py
Original file line number Diff line number Diff line change
@@ -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)
20 changes: 20 additions & 0 deletions cg/meta/workflow/nallo.py
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion tests/cli/workflow/nf_analysis/test_cli_workflow_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
11 changes: 11 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit b294fc3

Please sign in to comment.