How do I call a different snakemake workflow, with its own environment and configfile, as a part of my subworkflow?
I want to wrap a published snakemake workflow called MGEfinder with my code in order to automatically prepare its input files and deploy it in multiple subdirectories
- I tried using
subworkflowbut the problem is that it runs first while I need it to run after a certain output is made - I was considering using
includebut it prevents me from using a unique environment or config file. - I was considering creating a third workflow to call both subworkflows but didn't try it yet and it would complicate my debugging
- I was considering modifying the original code to include my 'env' of choice but it is (a) time-consuming (b) complicates my publication and (c) not ideal in terms of best practices
- Finally, I made a conda rule that calls it. It works but my workflow sees it as one job and it is certainly far from best practices:
rule mgefinder:
input:
lambda wildcards:
expand("mgefinder/{group}/00.bam/{sample2}.{sample1}.bam.bai",
sample1=GROUPS.get(int(wildcards.group)),
sample2=GROUPS.get(int(wildcards.group)),
allow_missing=True),
lambda wildcards:
expand("mgefinder/{group}/00.{dirname}/{sample}.fna",
sample=GROUPS.get(int(wildcards.group)),
dirname=["assembly","genome"],allow_missing=True),
output:
"mgefinder/{group}/dummy.txt"
params:
prefix="mgefinder/{group}/"
conda:
"database/mgefinder.yaml"
shell:
"mgefinder workflow denovo {params.prefix}; touch {params.prefix}/dummy.txt"