如何将“打印”与流程关联?

时间:2019-01-07 11:59:21

标签: nextflow

我做了我的管道,我想在每个过程之前打印一个简短的描述。

我基本上试图在脚本的每个过程之前添加“打印”。当我运行管道时,它只会首先打印出所有描述,然后进程开始执行。

我做了什么:

// Trimming
println 'Trimming reads with AlienTrimmer'
process Trimming {
    ...
}


// Convert to fasta
println 'Convert files from fastq to fasta'
process Fastq2Fasta {
    ...
}


// Concatenate files
println 'Combine all fasta files'
reads_fasta.collectFile()


// Dereplication
if (params.prefixdrep) println 'Dereplication using prefixes'
else println 'Dereplication using full reads lentgh'
process Dereplication {
    ...
}

我得到了什么:

* Trimming reads with AlienTrimmer
* Convert files from fastq to fasta
* Combine all fasta files
* Dereplication using full reads lentgh
[74/ee63b8] Cached process > Trimming (MOBIO2-16S)
[d7/9b16c3] Cached process > Trimming (IHMS1-16S)
[e8/821f96] Cached process > Trimming (IHMS2-16S)
[2d/bfe805] Cached process > Trimming (MOBIO1-16S)
[a0/6702b3] Cached process > Fastq2Fasta (IHMS1-16S)
[c0/044dcd] Cached process > Fastq2Fasta (MOBIO2-16S)
[84/344d52] Cached process > Fastq2Fasta (MOBIO1-16S)
[7f/20caee] Cached process > Fastq2Fasta (IHMS2-16S)
[aa/ea78e8] Cached process > Dereplication (mycobiote_16S)

我想要什么:

* Trimming reads with AlienTrimmer
[74/ee63b8] Cached process > Trimming (MOBIO2-16S)
[d7/9b16c3] Cached process > Trimming (IHMS1-16S)
[e8/821f96] Cached process > Trimming (IHMS2-16S)
[2d/bfe805] Cached process > Trimming (MOBIO1-16S)
* Convert files from fastq to fasta
[a0/6702b3] Cached process > Fastq2Fasta (IHMS1-16S)
[c0/044dcd] Cached process > Fastq2Fasta (MOBIO2-16S)
[84/344d52] Cached process > Fastq2Fasta (MOBIO1-16S)
[7f/20caee] Cached process > Fastq2Fasta (IHMS2-16S)
* Combine all fasta files   
* Dereplication using full reads lentgh
[aa/ea78e8] Cached process > Dereplication (mycobiote_16S)

1 个答案:

答案 0 :(得分:0)

快速解答,开箱即用是不可能的。如果确实需要,可以在脚本部分使用print,例如:

process foo {
  script:
  println 'Hello'
  """
  your_command_here
  """
}

但是,您还需要编写代码以仅在第一次时才编写该消息。