Skip to content

Commit

Permalink
feat: Allow outputting of rendered yte config in Datavzrd wrapper (#3123
Browse files Browse the repository at this point in the history
)

<!-- Ensure that the PR title follows conventional commit style (<type>:
<description>)-->
<!-- Possible types are here:
https://github.com/commitizen/conventional-commit-types/blob/master/index.json
-->

<!-- Add a description of your PR here-->

### QC
<!-- Make sure that you can tick the boxes below. -->

* [ ] I confirm that I have followed the [documentation for contributing
to
`snakemake-wrappers`](https://snakemake-wrappers.readthedocs.io/en/stable/contributing.html).

While the contributions guidelines are more extensive, please
particularly ensure that:
* [ ] `test.py` was updated to call any added or updated example rules
in a `Snakefile`
* [ ] `input:` and `output:` file paths in the rules can be chosen
arbitrarily
* [ ] wherever possible, command line arguments are inferred and set
automatically (e.g. based on file extensions in `input:` or `output:`)
* [ ] temporary files are either written to a unique hidden folder in
the working directory, or (better) stored where the Python function
`tempfile.gettempdir()` points to
* [ ] the `meta.yaml` contains a link to the documentation of the
respective tool or command under `url:`
* [ ] conda environments use a minimal amount of channels and packages,
in recommended ordering


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **New Features**
- Added an optional output configuration file in YAML format for
enhanced tracking of pipeline parameters and settings.
- Implemented functionality to save processed data to a specified output
configuration path, improving workflow management.
- Enhanced metadata in the configuration file with additional context
regarding the output structure and location.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Johannes Köster <[email protected]>
  • Loading branch information
fxwiegand and johanneskoester authored Aug 21, 2024
1 parent 62b0231 commit e74be78
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utils/datavzrd/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ description: |
Any files specified in the configuration file have to be also specified as additional input files in the
datavzrd rule.
url: https://github.com/datavzrd/datavzrd
output:
- config: Path to the rendered yte config
authors:
- Felix Mölder
2 changes: 2 additions & 0 deletions utils/datavzrd/test/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ rule datavzrd:
# see https://snakemake.readthedocs.io/en/stable/snakefiles/reporting.html
# for additional options like caption, categories and labels
),
# optionally output the rendered config
config = "resources/datavzrd/{sample}.rendered_config.yaml"
log:
"logs/datavzrd_report/{sample}.log",
wrapper:
Expand Down
3 changes: 3 additions & 0 deletions utils/datavzrd/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import tempfile
from yte import process_yaml
from snakemake.shell import shell
import shutil

log = snakemake.log_fmt_shell(stdout=True, stderr=True)

Expand All @@ -27,4 +28,6 @@
)
processed.flush()

if snakemake.output.config:
shutil.copy(processed.name, snakemake.output.config)
shell("datavzrd {processed.name} {extra} --output {snakemake.output[0]} {log}")

0 comments on commit e74be78

Please sign in to comment.