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

时间:2018-08-28 23:50:33

标签: snakemake

我具有以下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

即使我可以使用.snakemake/conda/4ac435d8/bin/trim_galore

手动成功运行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环境?

1 个答案:

答案 0 :(得分:0)

我知道了,我使用的是virtualenv中的python安装,而不是创建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}'