Skip to content

Commit

Permalink
Merge pull request #249 from MaxUlysse/prepocessing_dsl2
Browse files Browse the repository at this point in the history
bam_mapped have single and multiple bams
  • Loading branch information
FriederikeHanssen authored Jul 17, 2020
2 parents 70d8fca + e4c3ca8 commit 2fc24b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
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
"""
}

0 comments on commit 2fc24b3

Please sign in to comment.