首页 > 解决方案 > Snakemake使用错误的环境

问题描述

我正在从 shell 脚本调用 Snakemake 工作流程。
但首先我需要激活一个包含 snakemake 和其他已安装库的环境。

source ${CONDA_HOME}/etc/profile.d/conda.sh
conda activate myenv
# then call the workflow.

snakemake 工作流程中的规则conda:用于创建自己的环境。其中一条规则使用 python 运行一些脚本:

rule readsStat:
    """
    Input is the reads output is info about reads
    """
    input: expand(data_dir + "/{sample}", sample=sample_list)
    output:data_dir + "/statitics/raw_reads/reads_stat.txt",
    message: "Calculating read coverage statitics for: {input}",
    params:
        read_stat_script = rawcoverage_script,
    threads: config['read_raw_coverage_threads']
    benchmark: data_dir + "/benchmark/raw_reads/stat.benchmark.txt"
    conda: STAT_ENV
    shell:
        """
        python {params.read_stat_script} -i {input} -o {output} -t {threads}
        """

问题是在规则激活了正确的环境而不是使用它(例如,.snakemake/conda/532a617ec7374b7bff46f066e73/bin/python)之后,他们仍然使用我之前在调用脚本中激活的myenvpython 。envs/myenv/bin/python

知道我该如何解决吗?

谢谢

更新:
版本
conda 4.10.1
Snakemake 6.2.1

标签: pythoncondasnakemake

解决方案


问题在于:
source ${CONDA_HOME}/etc/profile.d/conda.sh
删除此行使 Snakemake 按预期工作。
谢谢


推荐阅读