我正在构建nextflow管道,以通过测序(GBS)数据(单端Illumina)来映射和变异呼叫基因分型。我将其大部分内容基于nf-core / eager管道,因为它具有许多我想整合到管道中的工具。我已经在样本上测试了管道,并且效果很好。但是,当我尝试在更多样本上运行管道时,它会很好地读取文件并使用fastp修剪它们。但是,当我尝试在修剪过的文件上运行bwa mem时,它将仅在修剪过的fastq文件之一上工作,它似乎是随机选择的,这意味着下游进程仅在一个文件上运行。我尝试了几种不同的方法,但似乎都没有用。我猜想这可能与fasta参考/ bwa索引不是值通道有关吗?有什么建议吗?
//read reference fasta channel
Channel.fromPath("${params.fasta}")
.ifEmpty { exit 1, "No genome specified! Please specify one with --fasta or --bwa_index"}
.into {ch_fasta_for_bwa_indexing; ch_fasta_for_faidx_indexing; ch_fasta_for_variant_call; ch_fasta_for_bwamem_mapping; ch_fasta_for_qualimap}
///build_bwa_index
process build_bwa_index {
tag {fasta}
publishDir path: "${params.outdir}/bwa_index", mode: 'copy', saveAs: { filename ->
if (params.saveReference) filename
else if(!params.saveReference && filename == "where_are_my_files.txt") filename
else null
}
when: !params.bwa_index && params.fasta
input:
file fasta from ch_fasta_for_bwa_indexing
file wherearemyfiles
output:
file "*.{amb,ann,bwt,pac,sa,fasta,fa}" into bwa_index_bwamem
file "where_are_my_files.txt"
"""
bwa index $fasta
"""
}
///bwa_align process
process bwa_align {
tag "$name"
publishDir "${params.outdir}/mapping/bwamem", mode: 'copy'
input:
set val(name), file(reads) from trimmed_fastq
file fasta from ch_fasta_for_bwamem_mapping
file "*" from bwa_index_bwamem
output:
file "*_sorted.bam" into bwa_sorted_bam_idxstats, bwa_sorted_bam_filter
file "*.bai"
script:
if(params.singleEnd){
"""
bwa mem $fasta ${reads[0]} -t ${task.cpus} | samtools sort -@ ${task.cpus} -o ${name}_sorted.bam
samtools index -@ ${task.cpus} ${name}_sorted.bam
"""
} else {
"""
bwa mem $fasta ${reads[0]} ${reads[1]} -t ${task.cpus} | samtools sort -@ ${task.cpus} -o ${name}_sorted.bam
samtools index -@ ${task.cpus} ${name}_sorted.bam
"""
}
}
在此示例中,我希望bwa_align进程能够在fastp进程生成的两个文件上运行
Pipeline name : trishulagenetics/genocan
Pipeline version: 0.1dev
Run name : exotic_hoover
Reads : data_2/*.R{1,2}.fastq.gz
Fasta reference: GCA_000230575.4_ASM23057v4_genomic.fna
bwa index : false
Data type : Single-end
Max Memory : null
Max CPUs : null
Max Time : null
Output dir : ./results
Working dir : /home/debian/Trishula/SRR2060630_split/test/work
Container Engine: docker
Container : trishulagenetics/genocan:latest
Current home : /home/debian
Current user : debian
Current path : /home/debian/Trishula/SRR2060630_split/test
Script dir : /home/debian/.nextflow/assets/trishulagenetics/genocan
Config Profile : docker
=========================================
executor > local (14)
[b1/080d6a] process > get_software_versions [100%] 1 of 1 ✔
[4e/87b4c2] process > build_bwa_index (GCA_000230575.4_ASM23057v4_genomic.fna) [100%] 1 of 1 ✔
[27/64b776] process > build_fasta_index (GCA_000230575.4_ASM23057v4_genomic.fna) [100%] 1 of 1 ✔
[f6/b07508] process > fastqc (P2_E07_M_0055) [100%] 2 of 2 ✔
[87/ecd07c] process > fastp (P2_E07_M_0055) [100%] 2 of 2 ✔
[50/e7bf8c] process > bwa_align (P2_A01_M_0001) [100%] 1 of 1 ✔
[c1/3647bc] process > samtools_idxstats (P2_A01_M_0001_sorted) [100%] 1 of 1 ✔
[0c/68b22c] process > samtools_filter (P2_A01_M_0001_sorted) [100%] 1 of 1 ✔
[de/c26b2d] process > qualimap (P2_A01_M_0001_sorted.filtered) [100%] 1 of 1 ✔
[bc/f7cf86] process > variant_call (P2_A01_M_0001) [100%] 1 of 1 ✔
[6f/2a9ab8] process > multiqc [100%] 1 of 1 ✔
[bb/b8b957] process > output_documentation (null) [100%] 1 of 1 ✔
[trishulagenetics/genocan] Pipeline Complete
Completed at: 17-Aug-2019 09:51:48
Duration : 19m 34s
CPU hours : 0.3
Succeeded : 14
答案 0 :(得分:0)
是-基本上最好避免将fasta文件拆分为多个通道,而只使用一个隐式为value channel的值:
ref_fasta = file(params.fasta)
process build_bwa_index {
storeDir ...
input:
file ref_fasta
output:
file "*.{amb,ann,bwt,pac,sa}" into bwa_index
"""
bwa index "${ref_fasta}"
"""
}
process bwa_mem {
publishDir ...
input:
set name, file(reads) from trimmed_fastq
file ref_fasta
file "*" from bwa_index
...
}