Skip to content Skip to sidebar Skip to footer

Specifying Python Version Within Snakemake Using Script Parameter

I have some code that I am incorporating into a Snakemake pipeline. I also want to be able to run the code independently of Snakemake, so I want to write flexible code. I have a co

Solution 1:

You could use Conda - it would both provide fine-grained control over execution contexts and improve the pipeline reproducibility. See Documentation.

First, you'll need an environment definition YAML file. For example,

envs/py37.yml

channels:
  - defaults
dependencies:
  - python=3.7

Add in any other requirements you need in that file. Then your rule would be

Snakefile

rule some_rule:input:input_fileoutput:output_fileconda:envs/py37.ymlscript:runfile.py

Lastly, you now need to use the additional flag --use-conda when launching this job, e.g.,

shell

snakemake --use-conda output_file

Post a Comment for "Specifying Python Version Within Snakemake Using Script Parameter"