'add `shell.prefix()` in snakemake profile?

For using conda activate myenv inside a script rule, I should add

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

at the beginning of the Snakefile.

I would like to add this option in my profile. For example in config.yaml or in sge-submit.py.

I tried to add it in sge-jobscript.sh, but it doesn't seem to work.

Is there a solution for this ? Do you have the same problem ?
Thanks in advance



Solution 1:[1]

I think you should be able to add a prefix variable to your config.yaml:

prefix: "source /usr/local/genome/Anaconda3/etc/profile.d/conda.sh;"

and then in your snakefile:

shell.prefix(config["prefix"])

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Maarten-vd-Sande