Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,17 @@ workflow {
single: it[2].size() == 1
multiple: it[2].size() > 1
}.set { bam }
bam.single.map {
idPatient, idSample, idRun, bam ->
[idPatient, idSample, bam]
}

bam.single.view()
bam.multiple.view()
bam_single = bam.single.map {
idPatient, idSample, idRun, bam, bai ->
[idPatient, idSample, bam[0], bai[0]]
}

//multipleBam = multipleBam.mix(multipleBamSentieon)
MERGE_BAM_MAPPED(bam.multiple)

bam_mapped = bam_single.mix(MERGE_BAM_MAPPED(bam.multiple))

bam_mapped.view()

OUTPUT_DOCUMENTATION(
output_docs,
Expand Down
9 changes: 5 additions & 4 deletions modules/local/merge_mapped_bam.nf
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
process MERGE_BAM_MAPPED {
label 'cpus'

tag "${idPatient}-${idSample}"
tag "${patient}-${sample}"

input:
tuple idPatient, idSample, idRun, path(bam), path(bai)// from multiple
tuple patient, sample, run, path(bam), path(bai)

output:
tuple idPatient, idSample, path("${idSample}.bam") //into bam_mapped_merged
tuple patient, sample, path("${sample}.bam"), path("${sample}.bam.bai")

script:
"""
samtools merge --threads ${task.cpus} ${idSample}.bam ${bam}
samtools merge --threads ${task.cpus} ${sample}.bam ${bam}
samtools index ${sample}.bam
"""
}