【问题标题】:Can I use multiple conda environments in the nextflow config?我可以在 nextflow 配置中使用多个 conda 环境吗?
【发布时间】:2022-11-10 23:58:43
【问题描述】:

我正在 Nextflow 中编写一个管道,并希望使用多个不同的 conda(现有)环境来避免工具安装和共享管道的特定模块的不一致。 Nextflow 文档指出,最佳实践是在 nextflow.config - see here. 中指定 conda 环境。但是,声明只是process.conda,似乎适用于所有进程,而不是特定于进程。

我知道我可以在each process 中指定一个现有的 conda 环境,但我正在努力遵守可移植性的最佳实践。

由于我无法在网上找到有关此特定问题的任何文档,因此我在配置文件中尝试了以下声明:

profiles {
    conda {
        process.conda = "something" // works but single env for all processes
        fastqc.conda = "something" // where fastqc is the name of the process - FAILS
        process.fastqc.conda = "something" // FAILS
    }
}

我也试过:

profiles {
    conda {
        process {
            withName: fastqc {
                 process.conda = "something"
            }
        }
    }
}

这也因错误而失败:unknown config attribute withName

有趣的是,

process {
        conda {
            withName: fastqc {
                 process.conda = "something"
            }
        }
    }

确实允许我为每个进程运行不同的 conda 环境,但不能通过 -profile 选项打开和关闭(因为指定配置文件块会破坏它)。

【问题讨论】:

    标签: conda config nextflow


    【解决方案1】:

    不确定是否有“最佳实践”,但我认为通常的方法是创建一个单独的 Conda 配置文件并使用 withNamewithLabel process selectors 使用 conda 指令指定环境。例如,conf/conda.config 的内容可能如下所示:

    process {
    
        withLabel: 'fastqc' {
            conda = 'fastqc=0.11.8=1'
        }
    
        withName: 'cutadapt' {
            conda = 'cutadapt=2.10=py37h516909a_0'
        }
    }
    

    然后,在您的nextflow.config 中包含一个“conda”配置文件以包含上述配置文件并启用 Conda 环境的使用。请注意,在 Nextflow 的较新版本中现在需要后者:

    includeConfig 'conf/base.config'
    
    profiles {
    
        'conda' {
            includeConfig 'conf/conda.config'
            conda.enabled = true
        }
    

    在上面的示例中,conf/base.config 将始终被应用,无论配置文件如何,并且可能包含通常的 cpus/memory/time 指令和 errorStrategy 等。

    【讨论】:

      猜你喜欢
      • 2021-03-11
      • 1970-01-01
      • 2018-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-17
      相关资源
      最近更新 更多