Version 7.3.8
I commonly structure my config.yaml such that public datasets can be automatically downloaded if not present using:
# config.yaml
paths:
vcf: 'path/to/vcf_{chrom}.vcf'
...
urls:
vcf: 'ftp://path_to_vcf_{chrom}.vcf'
...
# Snakefile
for key, url in config['urls'].items():
rule:
name: f'download_{key}'
output: config['paths'][key]
params: url=url
shell: # do download
Since the addition of the name directive, I can give the rules meaningful names (which is great!). The issue is I'd like to specify all these download rules are localrules. I can use
# Snakefile
localrules:
download_vcf,
...
where download_vcf is a token, not a string, so I have to manually keep that list up to date with my config. I'd like to programmatically add each url to local rules. I can do something like:
workflow._localrules.update(f'download_{key}' for key in config['urls'])
but I'd like to avoid using the private variable.
Any other recommendations? Is this something worth a feature request? Either a method to update localrules or a new directive localrule to replace rule (similar to checkpoint)? The more I think about it, the more it makes sense to label a rule as local instead of a separate localrules directive.