Search code examples
snakemake

snakemake --use-conda with an already created envs


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,


Solution

  • 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.