Skip to content

Commit

Permalink
update process_chunk to new snakemake_invoke package
Browse files Browse the repository at this point in the history
  • Loading branch information
leoschwarz committed Nov 6, 2024
1 parent 38f32bc commit 7361a3c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/depiction_targeted_preproc/app_interface/process_chunk.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import zipfile
from pathlib import Path

import cyclopts
import yaml
import zipfile
from depiction_targeted_preproc.pipeline.prepare_params import Params
from depiction_targeted_preproc.pipeline_config.artifacts_mapping import get_result_files_new
from pathlib import Path
from snakemake_invoke.config import SnakemakeInvokeConfig
from snakemake_invoke.snakemake_invoke import SnakemakeInvoke

app = cyclopts.App()
Expand All @@ -19,8 +19,11 @@ def process_chunk(chunk_dir: Path) -> Path:
result_files = get_result_files_new(requested_artifacts=params.requested_artifacts, sample_dir=chunk_dir)

# invoke snakemake
# TODO note report file is deactivated because it's currently broken due to dependencies (jinja2)
SnakemakeInvoke(report_file=None).invoke(work_dir=chunk_dir.parent, result_files=result_files)
# TODO should we generate the report_file again? before it was broken due to jinja2 update
snakemake_config = SnakemakeInvokeConfig(
snakefile_path=Path(__file__).parents[1] / "workflow" / "Snakefile",
)
SnakemakeInvoke(snakemake_config).invoke(work_dir=chunk_dir.parent, result_files=result_files)

# zip the results
sample_name = chunk_dir.name
Expand Down
2 changes: 1 addition & 1 deletion src/snakemake_invoke/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ class SnakemakeInvokeConfig(BaseModel):
snakefile_path: Path = Path("Snakefile").absolute()
execution_model: ExecutionModel = ExecutionModel.SUBPROCESS
continue_on_error: bool = False
report_file: str | None = "report.html"
report_file: str | None = None
n_cores: int = 1
env_variables: dict[str, str] | None = None

0 comments on commit 7361a3c

Please sign in to comment.