This Pull Request adds a custom snakemake renderer that produces a workflow in snakemake. This will be an example renderer for a tutorial on how to create a custom renderer in dewret. The renderer is tested with most of snakemakes quirks to produce a workflow with minimal tweaks to be executable. I've added # TODOs inside the renderer for possible features which I will also list here
Changes
Added SnakemakeRenderer class to examples as it needs approval - if approved I can move it to renderers dewrete.renderers.
Split each snakemake rule into separated blocks in:
InputDefinition: Which contains the input and parameters blocks. I've combined the params and input blocks into InputDefinition to eliminate redundancy. The input block in Snakemake specifies the required input files for a rule to run, while the params block defines the actual arguments for the rule. Both blocks required similar processing, so merging them seemed more efficient.
OutputDefinition: Which defines the output block of snakemake - Output block defines what files need to exist in order for the rule to be considered finished.
RunDefinition: Which defines the run block of snakemake - Run block defines what processes are needed to run (e.g. dewret Tasks).
Added and example using the snakemake renderer.
Motivation
To be used as an example custom renderer for a tutorial on how custom renderers are created. The Snakemake language is widely used in the bioinformatics community for creating reproducible and scalable workflows so the snakemake renderer was a good choice for both usability and an example.
Possible improvements
Feature: add a rule all: In snakemake if you want to run multiple connected rules you have a rule all with the input definition being the last task's output to make sure all of the rules run.
Feature: add tests.
Refactor: better way to handle the types. to_snakemake_type methods conversion of types could be imrpoved.
Refactor: introduce better error handling.
Refactor: better way to handle input/output files.
Issues
pre-commit hooks don't take into account my local environment and show a variety of unfixable errors.
task() annotations of a workflow must be removed before executing snakemake generated workflow.
Checklist
[x] My code follows the style guidelines of this project.
[x] I have performed a self-review of my own code.
[x] I have added docstrings.
[x] I have commented my code, particularly in hard-to-understand areas.
[x] I have linted, formated and mypy checked my code as per project requirements.
Summary
This Pull Request adds a custom snakemake renderer that produces a workflow in snakemake. This will be an example renderer for a tutorial on how to create a custom renderer in dewret. The renderer is tested with most of snakemakes quirks to produce a workflow with minimal tweaks to be executable. I've added # TODOs inside the renderer for possible features which I will also list here
Changes
SnakemakeRenderer
class toexamples
as it needs approval - if approved I can move it to renderers dewrete.renderers.Motivation
To be used as an example custom renderer for a tutorial on how custom renderers are created. The Snakemake language is widely used in the bioinformatics community for creating reproducible and scalable workflows so the snakemake renderer was a good choice for both usability and an example.
Possible improvements
Feature: add a rule all: In snakemake if you want to run multiple connected rules you have a rule all with the input definition being the last task's output to make sure all of the rules run.
Feature: add tests.
Refactor: better way to handle the types.
to_snakemake_type
methods conversion of types could be imrpoved.Refactor: introduce better error handling.
Refactor: better way to handle input/output files.
Issues
pre-commit hooks don't take into account my local environment and show a variety of unfixable errors.
task() annotations of a workflow must be removed before executing snakemake generated workflow.
Checklist
[x] My code follows the style guidelines of this project.
[x] I have performed a self-review of my own code.
[x] I have added docstrings.
[x] I have commented my code, particularly in hard-to-understand areas.
[x] I have linted, formated and mypy checked my code as per project requirements.
[ ] I have written tests.