I am working with Snakemake and I can't find a way to access to the current-rule's name.
For instance, is there a way to have an access like this:
rule job1:
input: check_inputs(rules.current.name)
output: ...
This can be very helpful when the check_inputs
function is more or less the same for each rules.
For sure, I made this and it works:
rule job1:
input: check_inputs("job1")
output: ...
However, I was wondering that if a more "Snakemaker way" to get the current-rule's name exists to avoid writing / hardcoding the rule's name each time.
Any kind of help or suggestion will be highly appreciated.
--- EDIT1 ---
The rule name is accessible via {rules.myrule.name}
only when the input
and output
statements are parsed by snakemake. So the use of {rules.myrule.name}
is not possible in input
/output
definition.
The idea is to have a quick access to the current rule's name {rules.current}
for instance, because {rules.myrule.name}
is also repetitive.