Skip to content

Commit

Permalink
Adding sample-level coverage to primary MultiQC report
Browse files Browse the repository at this point in the history
  • Loading branch information
marchoeppner committed Oct 1, 2024
1 parent 7e637ec commit 60ad4c9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/samtools/merge/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ process SAMTOOLS_MERGE {
tag "${meta.sample_id}"

input:
tuple val(meta), path(aligned_bam_list)
tuple val(meta), path(aligned_bam_list, stageAs: 'input*/*')

output:
tuple val(meta), path(merged_bam), emit: bam
Expand Down
17 changes: 16 additions & 1 deletion subworkflows/coverage/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ workflow COVERAGE {
)
ch_bam = ch_bam.mix(ALIGN_LONG_READS.out.bam)

/*
We need both platform-specific as well as
sample-level coverage reports. So we combine all bams
for one sample to compute a global coverage in addition
to the platform-level reports
*/
bam_mapped = ch_bam.map { meta, bam ->
new_meta = [:]
new_meta.sample_id = meta.sample_id
Expand All @@ -68,9 +74,18 @@ workflow COVERAGE {
multiple: it[1].size() > 1
}.set { bam_to_merge }

SAMTOOLS_MERGE(
bam_to_merge.multiple
)

bam_to_merge.single.mix(SAMTOOLS_MERGE.out.bam).map { m,b ->
m.platform = "ALL"
tuple(m,b)
}.set { ch_bam_all }

// Index the BAM files
SAMTOOLS_INDEX(
ch_bam
ch_bam.mix(ch_bam_all)
)

// Calculate coverage
Expand Down
4 changes: 4 additions & 0 deletions subworkflows/find_references/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ workflow FIND_REFERENCES {
tuple(m, r)
}.set { mash_with_gbk }

mash_with_gbk.map { m,r ->
"${m.sample_id}\t${r.getBaseName()}"
}.view()

mash_with_gbk.map { m, r ->
m.gbk
}.unique()
Expand Down
5 changes: 5 additions & 0 deletions workflows/gabi.nf
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ workflow GABI {
m.platform == "PACBIO"
}.map { m,r -> r }
)
multiqc_files = multiqc_files.mix(
COVERAGE.out.report.filter { m,r ->
m.platform == "ALL"
}.map { m,r -> r }
)

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 60ad4c9

Please sign in to comment.