Running snakefile from directory that doesn't contain snakefile

Question:

I’m writing a pipeline that creates a snakefile in child directory.

The general structure looks like this.

> snakemake_pipeline.py
    > runs/
        > run1/
            > Snakefile
            > ... (all other necessary files for snakemake to run)         

So, each time I run snakemake_pipeline.py a new directory is created in the runs/ directory. I’d like to be able to run the snakefile in the run1/ directory from the snakemake_pipeline.py script.

At the end of my script I’ve tried the following.

os.chidir(path/to/run1)
os.system(snakemake -j5)

The end result of this is snakemake gets started, but is unable to find all the files that are in the run1/ directory.

I’ve also tried just

snakemake runs/run1/Snakefile -j5
and
snakemake runs/run1/ -j5

Both of which yield the same error
Error: no Snakefile found, tried Snakefile, snakefile, workflow/Snakefile, workflow/snakefile.

Asked By: Sam H

||

Answers:

You are looking for the --snakefile or -s option.

snakemake --snakefile runs/run1/Snakefile
Answered By: Troy Comi
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.