Skip to content
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

Add parameters to the nextflow config #3853

Merged
merged 20 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from 9 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
21 changes: 9 additions & 12 deletions cg/meta/workflow/taxprofiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from cg.constants import Workflow
from cg.constants.constants import GenomeVersion
from cg.constants.nf_analysis import MULTIQC_NEXFLOW_CONFIG
from cg.constants.sequencing import SequencingPlatform
from cg.constants.symbols import EMPTY_STRING
from cg.meta.workflow.nf_analysis import NfAnalysisAPI
Expand All @@ -31,6 +30,10 @@ def __init__(
self.nfcore_workflow_path: str = config.taxprofiler.workflow_path
self.conda_env: str = config.taxprofiler.conda_env
self.conda_binary: str = config.taxprofiler.conda_binary
self.conda_binary: str = config.taxprofiler.conda_binary
self.config_platform: str = config.taxprofiler.config_platform
self.config_params: str = config.taxprofiler.config_params
self.config_resources: str = config.taxprofiler.config_resources
self.profile: str = config.taxprofiler.profile
self.revision: str = config.taxprofiler.revision
self.hostremoval_reference: Path = Path(config.taxprofiler.hostremoval_reference)
Expand All @@ -47,25 +50,21 @@ def sample_sheet_headers(self) -> list[str]:
"""Headers for sample sheet."""
return TaxprofilerSampleSheetEntry.headers()

@property
def is_params_appended_to_nextflow_config(self) -> bool:
"""Return True if parameters should be added into the nextflow config file instead of the params file."""
return False

@property
def is_multiqc_pattern_search_exact(self) -> bool:
"""Only exact pattern search is allowed to collect metrics information from multiqc file."""
return True

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 Taxprofiler bundle filenames path."""
return TAXPROFILER_BUNDLE_FILENAMES_PATH

@property
def is_params_appended_to_nextflow_config(self) -> bool:
"""Return True if parameters should be added into the nextflow config file instead of the params file."""
sofstam marked this conversation as resolved.
Show resolved Hide resolved
return False

def get_sample_sheet_content_per_sample(self, case_sample: CaseSample) -> list[list[str]]:
"""Collect and format information required to build a sample sheet for a single sample."""
sample_name: str = case_sample.sample.name
Expand All @@ -85,12 +84,10 @@ def get_sample_sheet_content_per_sample(self, case_sample: CaseSample) -> list[l
def get_workflow_parameters(self, case_id: str) -> TaxprofilerParameters:
"""Return Taxprofiler parameters."""
return TaxprofilerParameters(
cluster_options=f"--qos={self.get_slurm_qos_for_case(case_id=case_id)}",
input=self.get_sample_sheet_path(case_id=case_id),
outdir=self.get_case_path(case_id=case_id),
databases=self.databases,
hostremoval_reference=self.hostremoval_reference,
priority=self.account,
)

def get_multiqc_search_patterns(self, case_id: str) -> dict:
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 @@ -276,6 +276,9 @@ class TaxprofilerConfig(CommonAppConfig):
conda_binary: str | None = None
conda_env: str
compute_env: str
config_platform: str
config_params: str
config_resources: str
databases: str
hostremoval_reference: str
workflow_path: str
Expand Down
19 changes: 0 additions & 19 deletions cg/models/taxprofiler/taxprofiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,7 @@ class TaxprofilerParameters(WorkflowParameters):
"""Model for Taxprofiler parameters."""

databases: Path
save_preprocessed_reads: bool = True
perform_shortread_qc: bool = True
perform_shortread_complexityfilter: bool = True
save_complexityfiltered_reads: bool = True
perform_shortread_hostremoval: bool = True
hostremoval_reference: Path
save_hostremoval_index: bool = True
save_hostremoval_mapped: bool = True
save_hostremoval_unmapped: bool = True
perform_runmerging: bool = True
run_kraken2: bool = True
kraken2_save_reads: bool = True
kraken2_save_readclassifications: bool = True
run_bracken: bool = True
run_centrifuge: bool = True
centrifuge_save_reads: bool = True
run_krona: bool = True
run_profile_standardisation: bool = True
clusterOptions: str = Field(alias="cluster_options")
priority: str


class TaxprofilerSampleSheetEntry(NextflowSampleSheetEntry):
Expand Down
3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2160,6 +2160,9 @@ def context_config(
"root": str(taxprofiler_dir),
"conda_binary": conda_binary.as_posix(),
"conda_env": "S_taxprofiler",
"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(),
"databases": Path("path", "to", "databases").as_posix(),
Expand Down
Loading