nf-core 是一个由社区领导的项目,旨在开发一套使用 Nextflow 工作流管理系统建造的最佳实践管道。
nf-core pipelines 托管在GitHub。
nf-core 提供了一些工具来帮助人们运行和开发管道。nf-core 工具使用Python编写,可以从命令行运行,也可以导入在其它包里面使用。
nf-core会自动检查是否有新版本可用。如果想要跳过这个检查,可以设置环境变量 NFCORE_NO_VERSION_CHECK。例如
export NFCORE_NO_VERSION_CHECK=1
列出可用的nf-core管道
最简单的子命令是nf-core list
,它会列出所有在GitHub仓库上可用的管道。输出大致如下:
,--./,-.
___ __ __ __ ___ /,-._.--~\
|\ | |__ __ / ` / \ |__) |__ } {
| \| | \__, \__/ | \ |___ \`-._,-`-,
`._,._,'
nf-core/tools version 2.1
┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┓
┃ Pipeline Name ┃ Stars ┃ Latest Release ┃ Released ┃ Last Pulled ┃ Have latest release? ┃
┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━┩
│ mhcquant │ 14 │ 2.0.0 │ 4 days ago │ - │ - │
│ bacass │ 28 │ 2.0.0 │ 2 weeks ago │ - │ - │
│ viralrecon │ 48 │ 2.2 │ 1 months ago │ - │ - │
│ rnaseq │ 364 │ 3.3 │ 1 months ago │ - │ - │
│ mag │ 63 │ 2.1.0 │ 1 months ago │ - │ - │
│ fetchngs │ 25 │ 1.2 │ 1 months ago │ - │ - │
│ bcellmagic │ 14 │ 2.0.0 │ 2 months ago │ - │ - │
│ ampliseq │ 67 │ 2.0.0 │ 2 months ago │ - │ - │
[..truncated..]
过滤/排序可用的管道
可以再子命令list
之后加上其它关键字,则会筛选列出的管道。例如:
$ nf-core list rna rna-seq
可以使用选项--sort
来排序输出的结果。例如:最近的release(--sort release
),按字母表排序(–sort name),按GitHub 星标数排序(--sort stars
)
运行nf-core管道
nf-core管道依赖的软件有:docker,singularity和conda。nextflow会负责容器的下载和conda环境的安装。理论上,也可以使用其它方法(例如手动安装软件),但是不推荐这样做。
可以使用以下命令从 nf-core github 站点获取管道的最新版本。
$ nextflow pull nf-core/<PIPELINE>
为了更好的可重现性,最好显示的标志出管道的版本号,使用-revision/-r
。
$ nextflow pull nf-core/rnaseq -revision 3.0
使用说明和文档
在nf-core官方网站上可以找到有关nextflow和nf-core的文档。每个pipeline都有自己的网址,例如:https://nf-co.re/rnaseq。
除了文档,每个管道都有基本的命令行接口,可以跳过参数--help
来查看。例如:
$ nextflow run -r 3.4 nf-core/rnaseq --help
输出如下:
N E X T F L O W ~ version 20.10.0
Launching `nf-core/rnaseq` [silly_miescher] - revision: 964425e3fd [3.4]
------------------------------------------------------
,--./,-.
___ __ __ __ ___ /,-._.--~'
|\ | |__ __ / ` / \ |__) |__ } {
| \| | \__, \__/ | \ |___ \`-._,-`-,
`._,._,'
nf-core/rnaseq v3.0
------------------------------------------------------
Typical pipeline command:
nextflow run nf-core/rnaseq --input samplesheet.csv --genome GRCh37 -profile docker
Input/output options
--input [string] Path to comma-separated file containing information about the samples in the experiment.
--outdir [string] Path to the output directory where the results will be saved.
--public_data_ids [string] File containing SRA/ENA/GEO identifiers one per line in order to download their associated FastQ files.
--email [string] Email address for completion summary.
--multiqc_title [string] MultiQC report title. Printed as page header, used for filename if not otherwise specified.
--skip_sra_fastq_download [boolean] Only download metadata for public data database ids and don't download the FastQ files.
--save_merged_fastq [boolean] Save FastQ files after merging re-sequenced libraries in the results directory.
..truncated..
nf-core launch 命令
从上面的输出可以看到,有许多标志需要在命令行上传递: 一些是强制的,一些是可选的。
为了更加方便的使用pipelinne,这些参数通常会保存在json文件内。
nf-core launch
命令可以来构建一个交互式命令行向导,该向导会遍历不同的选项,显示默认值并提示输入值。
填写完所有的提示后,非默认值会被保存到params.json
文件,改文件可以通过-params-file
选项传递给nextflow。例如:
$ nf-core launch -r 3.0 rnaseq
配置文件
nf-core 管道使用 Nextflow 的配置文件来指定管道如何运行、定义自定义参数以及使用什么样的软件管理系统,例如 docker、 singular 或 conda。
Nextflow 可以从多个位置加载管道配置。可以使用-c
选项来指定配置文件。
$ nextflow run nf-core/rnaseq -r 3.0 -c mylocal.config
管道参数可以使用--<Parameter>
语法在命令行上传递。例如:
$ nextflow run nf-core/rnaseq -r 3.0 --email "my@email.com"`
Config Profiles
nf-core 使用 Nextflow 配置profile
,使得在命令行上应用一组选项变得非常容易。
配置文件可以包含一个或多个profile。profile是一组配置属性,可以在使用-profile
命令行选项启动管道执行时激活/选择这些属性。
多个profile用逗号分隔。当不同配置文件提供不同的profile时,最右侧的配置文件优先。
$ nextflow run nf-core/rnaseq -r 3.0 -profile test,conda
离线使用nf-core的pipeline
上面描述的许多技术和资源在运行时都需要互联网连接:管道文件、配置文件和软件容器都是在管道启动时动态获取的。对于使用未连接到 Internet 的人来说,这可能是一个问题。
为了帮助解决这个问题,nf-core download
命令自动获取脱机运行 nf-core 管道所需的文件。该命令可以使用-r/--release
下载管道的特定版本。
如果指定了标志--singularity
,它还将下载所需的镜像文件(这需要安装 Singularity)。所有文件都保存在一个目录中,准备传输到将要执行管道的集群。
$ nf-core download nf-core/rnaseq -r 3.4