I have 36 samples in total in the bam_files folder, with the name like this 20230306_CH_EP_C01.md.bam
I expect the code to output all the 36 samples, one by one. But the run stopped after only running one sample. I have searched online, but did not find a solution. I am using nextflow version 2.
bam_chl = Channel
.fromPath("bam_files/*.md.bam")
.map{ item -> tuple(item.baseName.substring(0, 18), item) }
ref_chl = Channel
.fromPath("sequences/hg38.fa")
ref_index_chl = Channel
.fromPath("sequences/hg38.fa.fai")
amplicon_chl = Channel
.fromPath("sequences/tp53_amplicon.hg38.interval_list")
target_chl = Channel
.fromPath("sequences/TP53.hg38.interval_list")
process get_pcr_metric {
publishDir path: 'pcr_metric', pattern: '*.csv'
input:
tuple val(pair_id), path(bam)
path(ref)
path(ref_index)
path(amplicon)
path(target)
output:
path("*.pcr_metrics.csv")
"""
java -jar /picard.jar CollectTargetedPcrMetrics \
I=$bam \
O=${pair_id}_pcr_metrics.txt \
R=$ref \
AMPLICON_INTERVALS=$amplicon \
TARGET_INTERVALS=$target
sed -n -e 7p -e 8p ${pair_id}_pcr_metrics.txt | sed 's/\t/,/g' > ${pair_id}.pcr_metrics.csv
"""
}
workflow {
get_pcr_metric(bam_chl, ref_chl,ref_index_chl, amplicon_chl, target_chl)
}