nextflow-implementor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Nextflow Implementor Skill

Nextflow 开发者技能

Read and follow agent-conduct and nextflow-conventions before starting.
开始前请阅读并遵循agent-conductnextflow-conventions规范。

TDD Cycle

TDD 循环

For each acceptance test, follow every step:
  1. Write a failing nf-test in
    modules/local/<tool>/tests/main.nf.test
    .
  2. Run:
    nf-test test modules/local/<tool>/tests/main.nf.test
  3. Write minimal process/workflow to pass.
  4. Ensure the process emits
    versions.yml
    with tool version(s).
  5. Verify container is specified (prefer nf-core module, then Seqera Wave / BioContainers, then Docker Hub).
  6. Run:
    nf-core pipelines lint
    and fix issues.
  7. Re-run nf-test to confirm it passes.
针对每个验收测试,请遵循以下所有步骤:
  1. modules/local/<tool>/tests/main.nf.test
    中编写一个会失败的nf-test测试用例。
  2. 运行:
    nf-test test modules/local/<tool>/tests/main.nf.test
  3. 编写最小化的流程/工作流以通过测试。
  4. 确保流程输出包含工具版本信息的
    versions.yml
    文件。
  5. 确认已指定容器(优先使用nf-core模块,其次是Seqera Wave / BioContainers,最后是Docker Hub)。
  6. 运行:
    nf-core pipelines lint
    并修复问题。
  7. 重新运行nf-test以确认测试通过。

Module-per-Function Rule

单功能单模块规则

Split each tool/function into its own module under
modules/local/<tool>/main.nf
with a corresponding
tests/main.nf.test
. One process per file, one test file per module.
将每个工具/功能拆分为独立模块,存放在
modules/local/<tool>/main.nf
,并对应编写
tests/main.nf.test
测试文件。每个文件对应一个流程,每个模块对应一个测试文件。

nf-core Module Re-use

复用nf-core模块

Before creating a local module, check nf-core:
bash
nf-core modules list remote | grep <tool>
If a suitable module exists, install it (
nf-core modules install <tool>
) instead of writing a local one. Only create local modules when no nf-core module covers the requirement.
在创建本地模块前,请先检查nf-core:
bash
nf-core modules list remote | grep <tool>
如果存在合适的模块,使用
nf-core modules install <tool>
安装它,而非编写本地模块。仅当没有nf-core模块满足需求时,才创建本地模块。

Container Discovery

容器查找

For local modules without nf-core equivalents, find open-source containers:
  1. Search https://seqera.io/wave/ for the tool.
  2. Search https://biocontainers.pro/.
  3. Fall back to Docker Hub / Quay.io official images.
Specify both docker and singularity container paths.
对于没有对应nf-core模块的本地模块,查找开源容器的步骤:
  1. https://seqera.io/wave/搜索该工具。
  2. https://biocontainers.pro/搜索。
  3. 最后选择Docker Hub / Quay.io的官方镜像。
同时指定docker和singularity的容器路径。

Workflow

工作流

Implement ONE item at a time: write nf-tests for the spec.md acceptance tests, then write implementation to make them pass, strictly following the TDD cycle above. Consult spec.md for full details.
After all modules pass, ensure:
  • nextflow.config
    has default params.
  • conf/base.config
    has resource labels.
  • conf/modules.config
    has publishDir directives.
  • Profiles work:
    docker
    ,
    singularity
    ,
    test
    .
  • All versions collected into final
    versions.yml
    .
  • docs/usage.md
    and
    docs/output.md
    are written for end-users.
一次实现一个任务:为spec.md中的验收测试编写nf-tests用例,然后编写实现代码使其通过测试,严格遵循上述TDD循环。详细信息请参考spec.md。
所有模块测试通过后,请确保:
  • nextflow.config
    包含默认参数。
  • conf/base.config
    包含资源标签。
  • conf/modules.config
    包含publishDir指令。
  • 配置文件正常工作:
    docker
    singularity
    test
  • 所有版本信息已收集到最终的
    versions.yml
    中。
  • 已为终端用户编写
    docs/usage.md
    docs/output.md
    文档。