Skip to content

Commit

Permalink
RNAFUSION: use config files instead of nf-core hasta profile (#3868)
Browse files Browse the repository at this point in the history
### Changed

- Unified the config and param file generation for rnafusion with the other nf workflows, using Clinical-Genomics/servers#1467
  • Loading branch information
rannick authored Nov 12, 2024
1 parent 63d2812 commit bc10c5c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
11 changes: 4 additions & 7 deletions cg/meta/workflow/rnafusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from cg.constants import Workflow
from cg.constants.constants import GenomeVersion, Strandedness
from cg.constants.nf_analysis import MULTIQC_NEXFLOW_CONFIG, RNAFUSION_METRIC_CONDITIONS
from cg.constants.nf_analysis import RNAFUSION_METRIC_CONDITIONS
from cg.constants.scout import RNAFUSION_CASE_TAGS
from cg.exc import MissingMetrics
from cg.meta.workflow.nf_analysis import NfAnalysisAPI
Expand Down Expand Up @@ -34,6 +34,9 @@ def __init__(
self.profile: str = config.rnafusion.profile
self.conda_env: str = config.rnafusion.conda_env
self.conda_binary: str = config.rnafusion.conda_binary
self.config_platform: str = config.rnafusion.config_platform
self.config_params: str = config.rnafusion.config_params
self.config_resources: str = config.rnafusion.config_resources
self.tower_binary_path: str = config.tower_binary_path
self.tower_workflow: str = config.rnafusion.tower_workflow
self.account: str = config.rnafusion.slurm.account
Expand Down Expand Up @@ -61,10 +64,6 @@ def get_genome_build(self, case_id: str) -> GenomeVersion:
"""Return reference genome for a case. Currently fixed for hg38."""
return GenomeVersion.HG38

def get_nextflow_config_content(self, case_id: str) -> str:
"""Return nextflow config content."""
return MULTIQC_NEXFLOW_CONFIG

@staticmethod
def get_bundle_filenames_path() -> Path:
"""Return Rnafusion bundle filenames path."""
Expand All @@ -88,11 +87,9 @@ def get_workflow_parameters(
) -> RnafusionParameters:
"""Get Rnafusion parameters."""
return RnafusionParameters(
cluster_options=f"--qos={self.get_slurm_qos_for_case(case_id=case_id)}",
genomes_base=genomes_base or self.get_references_path(),
input=self.get_sample_sheet_path(case_id=case_id),
outdir=self.get_case_path(case_id=case_id),
priority=self.account,
)

def get_references_path(self, genomes_base: Path | None = None) -> Path:
Expand Down
3 changes: 3 additions & 0 deletions cg/models/cg_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ class RnafusionConfig(CommonAppConfig):
compute_env: str
conda_binary: str | None = None
conda_env: str
config_platform: str
config_params: str
config_resources: str
launch_directory: str
profile: str
references: str
Expand Down
11 changes: 0 additions & 11 deletions cg/models/rnafusion/rnafusion.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from pathlib import Path

from pydantic import Field

from cg.constants.constants import Strandedness
from cg.models.nf_analysis import NextflowSampleSheetEntry, WorkflowParameters
from cg.models.qc_metrics import QCMetrics
Expand Down Expand Up @@ -29,15 +27,6 @@ class RnafusionParameters(WorkflowParameters):
"""Rnafusion parameters."""

genomes_base: Path
all: bool = False
arriba: bool = True
cram: str = "arriba,starfusion"
fastp_trim: bool = True
fusioncatcher: bool = True
starfusion: bool = True
trim_tail: int = 50
clusterOptions: str = Field(str, alias="cluster_options")
priority: str


class RnafusionSampleSheetEntry(NextflowSampleSheetEntry):
Expand Down
10 changes: 5 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from typing import Any, Generator

import pytest
from pytest_mock import MockFixture
from housekeeper.store.models import File, Version
from pytest_mock import MockFixture
from requests import Response

from cg.apps.crunchy import CrunchyAPI
Expand Down Expand Up @@ -68,9 +68,7 @@
TaxprofilerSampleSheetEntry,
)
from cg.models.tomte.tomte import TomteParameters, TomteSampleSheetHeaders
from cg.services.deliver_files.rsync.service import (
DeliveryRsyncService,
)
from cg.services.deliver_files.rsync.service import DeliveryRsyncService
from cg.services.illumina.backup.encrypt_service import IlluminaRunEncryptionService
from cg.services.illumina.data_transfer.data_transfer_service import (
IlluminaDataTransferService,
Expand Down Expand Up @@ -2139,6 +2137,9 @@ def context_config(
"compute_env": "nf_tower_compute_env",
"conda_binary": conda_binary.as_posix(),
"conda_env": "S_RNAFUSION",
"config_platform": str(nf_analysis_platform_config_path),
"config_params": str(nf_analysis_pipeline_params_path),
"config_resources": str(nf_analysis_pipeline_resource_optimisation_path),
"launch_directory": Path("path", "to", "launchdir").as_posix(),
"workflow_path": Path("workflow", "path").as_posix(),
"profile": "myprofile",
Expand Down Expand Up @@ -2696,7 +2697,6 @@ def raredisease_context(
mocker.patch.object(RarediseaseAnalysisAPI, "get_target_bed_from_lims")
RarediseaseAnalysisAPI.get_target_bed_from_lims.return_value = "some_target_bed_file"

samples = [sample_enough_reads, another_sample_enough_reads]
return cg_context


Expand Down

0 comments on commit bc10c5c

Please sign in to comment.