snakemake 在 conda 环境中找不到可执行文件

snakemake not finding executable in conda environment

我有以下conda环境

channels:
      - conda-forge
      - bioconda

dependencies:
      - perl=5.22.0.1
      - samtools=1.3
      - kallisto=0.43.1
      - cutadapt=1.9.1
      - trim-galore=0.4.3

当我 运行 snakemake --use-conda

时加载

Activating conda environment: /fullpathto/.snakemake/conda/4ac435d8

但是我得到了错误:

/usr/bin/bash: trim_galore: command not found

即使我可以手动 运行 trim_galore 可执行文件成功地:.snakemake/conda/4ac435d8/bin/trim_galore

调用trim_galore的规则是:

rule trim_galore:
    input:
        unpack(in_funcs.get_trim_galore_input(config))
    output:
        r1 = join(config['outs']['trim_fq_out_path'], '{sample}1_val_1.fq.gz'),
        r2 = join(config['outs']['trim_fq_out_path'], '{sample}2_val_2.fq.gz'),
    params:
        out_path = config['outs']['trim_fq_out_path'],
    conda:
        join(config['protospork'], 'envs/biotools.yaml'),
    shell:
        'trim_galore --gzip -o {params.out_path} --paired {input.r1} {input.r2}'

我是否需要以某种方式指定此 trim_galore 可执行文件应来自 conda 环境?

我明白了,我使用的是 python 从 virtualenv 安装而不是创建 conda 环境。 希望这对其他人有帮助

之前的解决方法在很多方面都不令人满意:

rule trim_galore:
    input:
        unpack(in_funcs.get_trim_galore_input(config))
    output:
        r1 = join(config['outs']['trim_fq_out_path'], '{sample}1_val_1.fq.gz'),
        r2 = join(config['outs']['trim_fq_out_path'], '{sample}2_val_2.fq.gz'),
    params:
        exec_path = glob.glob(join(config['protospork'],'.snakemake','conda','*','bin','trim_galore'))[0],
        out_path = config['outs']['trim_fq_out_path'],
    conda:
        join(config['protospork'], 'envs/biotools.yaml'),
    shell:
        '{params.exec_path} --gzip -o {params.out_path} --paired {input.r1} {input.r2}'