3

I work on an SGE cluster where some tools are available with conda :

source activate unicycler-0.4.7

I can use conda on my snakemake workflow with yaml, but in this way, I will going to reinstall the environment.

name: unicycler
channels:
  - bioconda
  - conda-forge
  - defaults
dependencies:
  - unicycler=0.4.7

Is it possible to activate an existing environment?

Thanks very much for your helps!

Version :

  • snakemake 5.4.0
  • conda 4.6.14

Best regards,

Midoux
  • 51
  • 5

2 Answers2

0

I should add at the beginning of the Snakefile :

shell.executable("/bin/bash")
shell.prefix("source /usr/local/genome/Anaconda3/etc/profile.d/conda.sh; ") 

Prefix to be adapted according to your installation.

After that, envs can be load like in interactive session with conda activate unicycler-0.4.7 for example.

Midoux
  • 51
  • 5
0

This has gotten support recently: https://snakemake.readthedocs.io/en/stable/snakefiles/deployment.html#using-already-existing-named-conda-environments

rule NAME:
    input:
        "table.txt"
    output:
        "plots/myplot.pdf"
    conda:
        "unicycler"
    script:
        "scripts/unicycler.py"
Maarten-vd-Sande
  • 3,413
  • 10
  • 27