You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Nextflow读取CSV迭代样本时FASTP进程重复使用报错求助

Nextflow工作流迭代CSV时出现FASTP进程重复使用报错

我正在开发Nextflow工作流,需读取含5列的CSV文件,格式如下:

sample1,path/normal_R1.fastq,path/normal_R2.fastq,path/tumor_R1.fastq,path/tumor_R2.fastq
sample2,path/normal_R1.fastq,path/normal_R2.fastq,path/tumor_R1.fastq,path/tumor_R2.fastq

读取文件后创建LinkedHashMap,计划对每个样本运行多个进程。这些进程在直接通过tumor和normal文件channel提供输入时运行正常,但添加CSV迭代相关代码后出现报错:

Process 'FASTP' has been already used -- If you need to reuse the same component, include it with a different name or include it in a different workflow context

相关主流程代码

include { FASTP} from './fastp_process.nf'
include {bwa_index} from './index_process.nf'

include { align_bwa_mem} from './bwamem_process_already_index.nf'
include { gatk_markduplicates} from './gatk_markduplicates_process.nf'
include {setupnmdtags} from './setupnmdtags_process.nf'
include { recalibrate_bam } from './recalibratebam_process.nf'
include { applybqsr } from './applybqsr_process.nf'
include { mutect2 } from './mutect2_process.nf'
include { lancet } from './lancet_process.nf'
include { manta } from './manta_process.nf'
include { strelka } from './strelka_process.nf'
include { gatk_merge_vcfs } from  './gatk_merge_vcfs.nf'

workflow {
def csvFile = file("input_nextflow_files.csv")
def csvLines = csvFile.text.readLines()

def sampleMap = csvLines.collectEntries { line ->
    def lineCols = line.split(',')
    
    if (lineCols.size() >= 5) {
        def sampleName = lineCols[0]
        def normalR1 = file(lineCols[1])
        def normalR2 = file(lineCols[2])
        def tumorR1 = file(lineCols[3])
        def tumorR2 = file(lineCols[4])

        [(sampleName): [tuple(normalR1, normalR2), tuple(tumorR1, tumorR2)]]
    } else {
        return [:]
    }
}

sampleMap.each { sampleName, pairList ->
    def normalPair = pairList[0]
    def tumorPair = pairList[1]
    
    FASTP(tumorPair,normalPair,sampleName)
    align_bwa_mem(FASTP.out.reads_tumor,FASTP.out.reads_normal) //already_created index
    }
}

FASTP进程定义

process FASTP {
    maxForks 3
    debug true

    input:
    path(reads_tumor)  //val outdir  //doesn't work with path (outdir) // we pass multiple reads - for tumor and normal
    path(reads_normal)  //val outdir  //doesn't work with path (outdir)
    val (sample_name)

    output:

    tuple val(sample_name), path("${sample_id_tumor}_trim_{1,2}.fq.gz"), emit: reads_tumor
    path("${sample_id_tumor}.fastp.json"), emit: json_tumor
    path("${sample_id_tumor}.fastp.html"), emit: html_tumor
    
    tuple val(sample_id_normal), path("${sample_id_normal}_trim_{1,2}.fq.gz"), emit: reads_normal
    path("${sample_id_normal}.fastp.json"), emit: json_normal
    path("${sample_id_normal}.fastp.html"), emit: html_normal
    
    script:
    def (r1_normal, r2_normal) = reads_normal
    def (r1_tumor, r2_tumor)=reads_tumor

    """


ml fastp

    fastp  --in1 "${r1_normal}" --in2 "${r2_normal}" -q 20  -u 20 -l 40 --detect_adapter_for_pe --out1 "${sample_id_normal}_trim_1.fq.gz" --out2 "${sample_id_normal}_trim_2.fq.gz" --json "${sample_id_normal}.fastp.json" --html "${sample_id_normal}.fastp.html" --thread 12 
 
    fastp  --in1 "${r1_tumor}" --in2 "${r2_tumor}" -q 20  -u 20 -l 40 --detect_adapter_for_pe --out1 "${sample_id_tumor}_trim_1.fq.gz" --out2 "${sample_id_tumor}_trim_2.fq.gz" --json "${sample_id_tumor}.fastp.json" --html "${sample_id_tumor}.fastp.html" --thread 12 

echo "Exiting fastp"
 
   """
}

我已确认没有重复引入FASTP进程,但问题仍未解决,希望得到解决思路。

内容的提问来源于stack exchange,提问作者Death Metal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.14 01:08:23