Skip to content

Commit

Permalink
feat: release v16.0.1 (#1532)
Browse files Browse the repository at this point in the history
### Removed

- case_report.html from delivery command
  • Loading branch information
mathiasbio authored Feb 10, 2025
1 parent 2580640 commit cff0826
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 69 deletions.
43 changes: 2 additions & 41 deletions BALSAMIC/commands/report/deliver.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
"""Report deliver CLI command."""
import logging
import subprocess
import sys
from pathlib import Path
from typing import Any, Dict, List, Optional
from typing import Any, Dict, List

import click
import snakemake
from BALSAMIC.constants.constants import FileType

from BALSAMIC.commands.options import (
OPTION_DISABLE_VARIANT_CALLER,
OPTION_RULES_TO_DELIVER,
OPTION_SAMPLE_CONFIG,
)
from BALSAMIC.constants.analysis import RunMode
from BALSAMIC.models.config import ConfigModel
from BALSAMIC.models.snakemake import SnakemakeExecutable
from BALSAMIC.utils.cli import (
get_snakefile,
convert_deliverables_tags,
Expand All @@ -31,13 +26,11 @@
@click.command(
"deliver", short_help="Create a <case_id>.hk file with output analysis files"
)
@OPTION_DISABLE_VARIANT_CALLER
@OPTION_RULES_TO_DELIVER
@OPTION_SAMPLE_CONFIG
@click.pass_context
def deliver(
context: click.Context,
disable_variant_caller: Optional[str],
rules_to_deliver: List[str],
sample_config: str,
):
Expand All @@ -48,33 +41,12 @@ def deliver(
config_model: ConfigModel = ConfigModel(**config)
output_dir: Path = Path(config_model.analysis.result, "delivery_report")
output_dir.mkdir(exist_ok=True)
working_dir: Path = Path(
config_model.analysis.analysis_dir,
config_model.analysis.case_id,
"BALSAMIC_run",
)
html_report: Path = Path(output_dir, f"{config_model.analysis.case_id}_report.html")

snakefile: Path = get_snakefile(
analysis_type=config_model.analysis.analysis_type,
analysis_workflow=config_model.analysis.analysis_workflow,
)

LOG.info(f"Creating HTML report file: {html_report.as_posix()}")
snakemake_executable: SnakemakeExecutable = SnakemakeExecutable(
case_id=config_model.analysis.case_id,
config_path=sample_config,
disable_variant_caller=disable_variant_caller,
report_path=html_report,
run_analysis=True,
run_mode=RunMode.LOCAL,
snakefile=snakefile,
snakemake_options=["--quiet"],
working_dir=working_dir,
)
subprocess.check_output(
f"{sys.executable} -m {snakemake_executable.get_command()}".split(), shell=False
)

LOG.info(f"Delivering analysis workflow: {config_model.analysis.analysis_workflow}")
hk_file: Path = Path(output_dir, f"{config_model.analysis.case_id}.hk")
delivery_ready_file: Path = Path(
Expand All @@ -92,17 +64,6 @@ def deliver(
delivery_json=hk_deliverables, sample_config_dict=config
)

# HTML analysis report
hk_deliverables.append(
{
"path": html_report.as_posix(),
"step": "balsamic_delivery",
"format": get_file_extension(html_report.as_posix()),
"tag": ["balsamic-report"],
"id": config_model.analysis.case_id,
}
)

# Sample configuration file
hk_deliverables.append(
{
Expand Down
9 changes: 0 additions & 9 deletions BALSAMIC/models/snakemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class SnakemakeExecutable(BaseModel):
profile (Optional[ClusterProfile]) : Cluster profile to submit jobs.
qos (Optional[QOS]) : QOS for sbatch jobs.
quiet (Optional[bool]) : Quiet mode for snakemake.
report_path (Optional[Path]) : Snakemake generated report path.
run_analysis (bool) : Flag to run the actual analysis.
run_mode (RunMode) : Cluster run mode to execute analysis.
script_dir (Optional[DirectoryPath]) : Cluster profile scripts directory.
Expand All @@ -66,7 +65,6 @@ class SnakemakeExecutable(BaseModel):
profile: Optional[ClusterProfile] = None
qos: Optional[QOS] = None
quiet: bool = False
report_path: Optional[Path] = None
run_analysis: bool = False
run_mode: RunMode
script_dir: Optional[DirectoryPath] = None
Expand Down Expand Up @@ -113,12 +111,6 @@ def get_quiet_flag(self) -> str:
return "--quiet"
return ""

def get_report_path_option(self) -> str:
"""Return string representation of the report_path option."""
if self.report_path:
return f"--report {self.report_path.as_posix()}"
return ""

def get_run_analysis_flag(self) -> str:
"""Return string representation of the run_analysis flag."""
if not self.run_analysis:
Expand Down Expand Up @@ -154,7 +146,6 @@ def get_command(self) -> str:
f"{self.get_force_flag()} "
f"{self.get_run_analysis_flag()} "
f"{self.get_snakemake_cluster_options()} "
f"{self.get_report_path_option()} "
f"{self.get_config_options()} "
f"{self.get_snakemake_options_command()}"
)
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
[16.0.1]
-------

Removed:
^^^^^^^^
* remove snakemake case_report.html report creation https://github.com/Clinical-Genomics/BALSAMIC/pull/1530


[16.0.0]
-------

Expand Down
2 changes: 0 additions & 2 deletions tests/commands/report/test_deliver.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ def test_deliver_tumor_only_panel(
"deliver",
"--sample-config",
tumor_only_config,
"--disable-variant-caller",
"cnvkit",
]
)

Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2469,7 +2469,6 @@ def fixture_snakemake_executable_validated_data(
"profile": ClusterProfile.SLURM,
"qos": QOS.HIGH,
"quiet": True,
"report_path": None,
"run_analysis": True,
"run_mode": RunMode.CLUSTER,
"script_dir": session_tmp_path,
Expand Down
16 changes: 0 additions & 16 deletions tests/models/test_snakemake_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,6 @@ def test_quiet_flag(snakemake_executable: SnakemakeExecutable):
assert quiet_flag == "--quiet"


def test_get_report_path_option(
session_tmp_path: Path, snakemake_executable: SnakemakeExecutable
):
"""Test formatting of the report path option."""

# GIVEN a snakemake executable model with a report path option
snakemake_model: SnakemakeExecutable = copy.deepcopy(snakemake_executable)
snakemake_model.report_path = session_tmp_path

# WHEN calling the method
report_path_option: str = snakemake_model.get_report_path_option()

# THEN the expected format should be returned
assert report_path_option == f"--report {session_tmp_path.as_posix()}"


def test_get_run_analysis_flag(snakemake_executable: SnakemakeExecutable):
"""Test formatting of the run analysis flag."""

Expand Down

0 comments on commit cff0826

Please sign in to comment.