【问题标题】:Snakemake use the wrong environmentSnakemake使用错误的环境
【发布时间】:2021-05-02 02:58:29
【问题描述】:

我正在从 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),他们仍然使用我之前在调用脚本中激活的myenv python envs/myenv/bin/python

知道如何解决这个问题吗?

谢谢

更新:
版本
conda 4.10.1
Snakemake 6.2.1

【问题讨论】:

  • 我不知道它是否相关,但source ... 建议您使用的是旧版本的 conda 或未正确安装 conda,因为您不需要这样做。您能否提供有关 conda 和 snakemake 版本的更多详细信息,您如何执行它们以及理想情况下的最小示例?
  • 只是为了确定,您是否使用--use-conda 运行?你所描述的看起来不错(就蛇形而言)。
  • @dariober 我更新了问题,添加了 conda、snakemake 版本和规则示例。我尝试激活环境并直接运行snakemake(没有包装脚本),仍然面临同样的问题。
  • @TroyComi 是的,我使用--use-conda
  • @dariober 谢谢,删除源命令行使其正常工作。

标签: python conda snakemake


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-27
    • 1970-01-01
    • 1970-01-01
    • 2014-09-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多