From 54f95be86bf2cc88c497feda6fc1b639e36d36d7 Mon Sep 17 00:00:00 2001 From: Peter Pruisscher <57712924+peterpru@users.noreply.github.com> Date: Tue, 31 Oct 2023 08:46:56 +0100 Subject: [PATCH] Revert "feat(raredisease): Add raredisease to cg workflow (#2592)" (#2646) This reverts commit d7fdd9f8ee0abff64876231378bb7b1ad236daac. --- ...508_add_raredisease_to_analysis_options.py | 77 ------------------- cg/cli/workflow/base.py | 2 - cg/cli/workflow/raredisease/__init__.py | 1 - cg/cli/workflow/raredisease/base.py | 21 ----- cg/meta/workflow/raredisease.py | 20 ----- cg/models/raredisease/__init__.py | 0 tests/cli/workflow/raredisease/conftest.py | 14 ---- .../test_cli_raredisease_compound_commands.py | 25 ------ 8 files changed, 160 deletions(-) delete mode 100644 alembic/versions/11555a6fb508_add_raredisease_to_analysis_options.py delete mode 100644 cg/cli/workflow/raredisease/__init__.py delete mode 100644 cg/cli/workflow/raredisease/base.py delete mode 100644 cg/meta/workflow/raredisease.py delete mode 100644 cg/models/raredisease/__init__.py delete mode 100644 tests/cli/workflow/raredisease/conftest.py delete mode 100644 tests/cli/workflow/raredisease/test_cli_raredisease_compound_commands.py diff --git a/alembic/versions/11555a6fb508_add_raredisease_to_analysis_options.py b/alembic/versions/11555a6fb508_add_raredisease_to_analysis_options.py deleted file mode 100644 index 1e86d1c775..0000000000 --- a/alembic/versions/11555a6fb508_add_raredisease_to_analysis_options.py +++ /dev/null @@ -1,77 +0,0 @@ -"""Add raredisease to analysis options - -Revision ID: 11555a6fb508 -Revises: 392e49db40fc -Create Date: 2023-10-30 14:32:00.803388 - -""" -import sqlalchemy as sa -from sqlalchemy.dialects import mysql -from sqlalchemy.orm import declarative_base - -from alembic import op -from cg.constants import Pipeline - - -# revision identifiers, used by Alembic. -revision = "11555a6fb508" -down_revision = "392e49db40fc" -branch_labels = None -depends_on = None - -Base = declarative_base() - -old_analysis_options = ( - "balsamic", - "balsamic-pon", - "balsamic-qc", - "balsamic-umi", - "demultiplex", - "fastq", - "fluffy", - "microsalt", - "mip-dna", - "mip-rna", - "rnafusion", - "rsync", - "sars-cov-2", - "spring", - "taxprofiler", -) -new_analysis_options = sorted(old_analysis_options + ("raredisease",)) - -old_analysis_enum = mysql.ENUM(*old_analysis_options) -new_analysis_enum = mysql.ENUM(*new_analysis_options) - - -class Analysis(Base): - __tablename__ = "analysis" - id = sa.Column(sa.types.Integer, primary_key=True) - pipeline = sa.Column(sa.types.Enum(*list(Pipeline))) - - -class Family(Base): - __tablename__ = "family" - id = sa.Column(sa.types.Integer, primary_key=True) - data_analysis = sa.Column(sa.types.Enum(*list(Pipeline))) - - -def upgrade(): - op.alter_column("family", "data_analysis", type_=new_analysis_enum) - op.alter_column("analysis", "pipeline", type_=new_analysis_enum) - - -def downgrade(): - bind = op.get_bind() - session = sa.orm.Session(bind=bind) - for analysis in session.query(Analysis).filter(Analysis.pipeline == "raredisease"): - print( - f"Changing pipeline for Analysis {Analysis.family.internal_id}, {Analysis.completed_at} to mip-dna" - ) - analysis.pipeline = "mip-dna" - for family in session.query(Family).filter(Family.data_analysis == "raredisease"): - print(f"Changing data_analysis for Family {family.internal_id} to mip-dna") - family.data_analysis = "mip-dna" - op.alter_column("family", "data_analysis", type_=old_analysis_enum) - op.alter_column("analysis", "pipeline", type_=old_analysis_enum) - session.commit() diff --git a/cg/cli/workflow/base.py b/cg/cli/workflow/base.py index 82944f7a73..4bd25014bd 100644 --- a/cg/cli/workflow/base.py +++ b/cg/cli/workflow/base.py @@ -13,7 +13,6 @@ 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.raredisease.base import raredisease from cg.cli.workflow.rnafusion.base import rnafusion from cg.cli.workflow.taxprofiler.base import taxprofiler @@ -32,7 +31,6 @@ def workflow(): workflow.add_command(mip_rna) workflow.add_command(fluffy) workflow.add_command(mutant) -workflow.add_command(raredisease) workflow.add_command(rnafusion) workflow.add_command(taxprofiler) workflow.add_command(fastq) diff --git a/cg/cli/workflow/raredisease/__init__.py b/cg/cli/workflow/raredisease/__init__.py deleted file mode 100644 index d3a1fde1a8..0000000000 --- a/cg/cli/workflow/raredisease/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Init for module""" diff --git a/cg/cli/workflow/raredisease/base.py b/cg/cli/workflow/raredisease/base.py deleted file mode 100644 index 0891d953f2..0000000000 --- a/cg/cli/workflow/raredisease/base.py +++ /dev/null @@ -1,21 +0,0 @@ -"""CLI support to create config and/or start RAREDISEASE.""" - -import logging - -import click - -from cg.constants.constants import MetaApis -from cg.meta.workflow.analysis import AnalysisAPI -from cg.meta.workflow.raredisease import RarediseaseAnalysisAPI - -LOG = logging.getLogger(__name__) - - -@click.group(invoke_without_command=True) -@click.pass_context -def raredisease(context: click.Context) -> None: - """nf-core/raredisease analysis workflow.""" - AnalysisAPI.get_help(context) - context.obj.meta_apis[MetaApis.ANALYSIS_API] = RarediseaseAnalysisAPI( - config=context.obj, - ) diff --git a/cg/meta/workflow/raredisease.py b/cg/meta/workflow/raredisease.py deleted file mode 100644 index 1223a0446a..0000000000 --- a/cg/meta/workflow/raredisease.py +++ /dev/null @@ -1,20 +0,0 @@ -"""Module for Raredisease Analysis API.""" - -import logging -from cg.constants import Pipeline -from cg.meta.workflow.nf_analysis import NfAnalysisAPI -from cg.models.cg_config import CGConfig - -LOG = logging.getLogger(__name__) - - -class RarediseaseAnalysisAPI(NfAnalysisAPI): - """Handles communication between RAREDISEASE processes - and the rest of CG infrastructure.""" - - def __init__( - self, - config: CGConfig, - pipeline: Pipeline = Pipeline.RAREDISEASE, - ): - super().__init__(config=config, pipeline=pipeline) diff --git a/cg/models/raredisease/__init__.py b/cg/models/raredisease/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/cli/workflow/raredisease/conftest.py b/tests/cli/workflow/raredisease/conftest.py deleted file mode 100644 index a9fd2f9120..0000000000 --- a/tests/cli/workflow/raredisease/conftest.py +++ /dev/null @@ -1,14 +0,0 @@ -"""Fixtures for cli workflow raredisease tests""" - -import pytest -from cg.meta.workflow.raredisease import RarediseaseAnalysisAPI -from cg.models.cg_config import CGConfig - - -@pytest.fixture(scope="function", name="raredisease_context") -def fixture_raredisease_context( - cg_context: CGConfig, -) -> CGConfig: - """Context to use in cli.""" - cg_context.meta_apis["analysis_api"] = RarediseaseAnalysisAPI(config=cg_context) - return cg_context diff --git a/tests/cli/workflow/raredisease/test_cli_raredisease_compound_commands.py b/tests/cli/workflow/raredisease/test_cli_raredisease_compound_commands.py deleted file mode 100644 index 0bd0e2a3dd..0000000000 --- a/tests/cli/workflow/raredisease/test_cli_raredisease_compound_commands.py +++ /dev/null @@ -1,25 +0,0 @@ -import logging - -from _pytest.logging import LogCaptureFixture -from click.testing import CliRunner -from cg.cli.workflow.raredisease.base import ( - raredisease, -) -from cg.constants import EXIT_SUCCESS -from cg.models.cg_config import CGConfig - - -def test_raredisease_no_args(cli_runner: CliRunner, raredisease_context: CGConfig): - """Test to see that running RAREDISEASE without options prints help and doesn't result in an error.""" - # GIVEN no arguments or options besides the command call - - # WHEN running command - result = cli_runner.invoke(raredisease, [], obj=raredisease_context) - - # THEN command runs successfully - print(result.output) - - assert result.exit_code == EXIT_SUCCESS - - # THEN help should be printed - assert "help" in result.output