Skip to content

Commit

Permalink
feat: wire up estimatelibrarycomplexity to bam_qc
Browse files Browse the repository at this point in the history
  • Loading branch information
shihabdider committed Oct 17, 2024
1 parent 92c7be5 commit d4422a1
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
8 changes: 8 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ process {
]
}

withName: 'GATK4_ESTIMATELIBRARYCOMPLEXITY' {
publishDir = [
mode: params.publish_dir_mode,
path: { "${params.outdir}/qc_reports/gatk/${meta.id}" },
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
]
}

withName: 'SAMTOOLS_STATS' {
ext.when = { !(params.skip_tools && params.skip_tools.split(',').contains('samtools')) }
ext.prefix = { "${meta.id}.sorted.cram" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

include { PICARD_COLLECTWGSMETRICS } from '../../../modules/nf-core/picard/collectwgsmetrics/main'
include { PICARD_COLLECTMULTIPLEMETRICS } from '../../../modules/nf-core/picard/collectmultiplemetrics/main'
include { GATK4_ESTIMATELIBRARYCOMPLEXITY } from '../../../modules/nf-core/gatk4/estimatelibrarycomplexity/main'

fasta = WorkflowNfcasereports.create_file_channel(params.fasta)
fai = WorkflowNfcasereports.create_file_channel(params.fasta_fai)
intervals = WorkflowNfcasereports.create_file_channel(params.intervals)
fasta = WorkflowNfcasereports.create_file_channel(params.fasta)
fai = WorkflowNfcasereports.create_file_channel(params.fasta_fai)
intervals = WorkflowNfcasereports.create_file_channel(params.intervals)

workflow BAM_QC_PICARD {
workflow BAM_QC {
take:
bam // channel: [mandatory] [ meta, bam, bai ]
dict

main:
versions = Channel.empty()
Expand All @@ -30,13 +32,23 @@ workflow BAM_QC_PICARD {
fai.map{ it -> [ [ id:'fai' ], it ] },
)

bam_only = bam.map{ meta, bam, bai -> [ meta, bam ] }
GATK4_ESTIMATELIBRARYCOMPLEXITY(
bam_only,
fasta,
fai,
dict
)

// Gather all reports generated
reports = reports.mix(PICARD_COLLECTWGSMETRICS.out.metrics)
reports = reports.mix(PICARD_COLLECTMULTIPLEMETRICS.out.metrics)
reports = reports.mix(GATK4_ESTIMATELIBRARYCOMPLEXITY.out.metrics)

// Gather versions of all tools used
versions = versions.mix(PICARD_COLLECTWGSMETRICS.out.versions)
versions = versions.mix(PICARD_COLLECTMULTIPLEMETRICS.out.versions)
versions = versions.mix(GATK4_ESTIMATELIBRARYCOMPLEXITY.out.versions)

emit:
reports
Expand Down
2 changes: 1 addition & 1 deletion tests/test_runs/chr21_test/params.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"fasta": "/gpfs/commons/home/sdider/DB/GATK/human_g1k_v37_decoy.fasta",
"fasta_fai": "/gpfs/commons/home/sdider/DB/GATK/human_g1k_v37_decoy.fasta.fai",
"bwa": "/gpfs/commons/home/sdider/DB/GATK/bwa/",
"tools": "snv_multiplicity",
"tools": "bamqc",
"outdir": "./results",
"pon_dryclean": "/gpfs/commons/home/sdider/Projects/nf-casereports/tests/test_data/chr21_pon.rds",
"field_dryclean": "reads",
Expand Down
11 changes: 7 additions & 4 deletions workflows/nfcasereports.nf
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ include { CRAM_QC_MOSDEPTH_SAMTOOLS as CRAM_QC_NO_MD } from '../subworkflows/loc
include { CRAM_QC_MOSDEPTH_SAMTOOLS as CRAM_QC_RECAL } from '../subworkflows/local/cram_qc_mosdepth_samtools/main'

// BAM Picard QC
include { BAM_QC_PICARD } from '../subworkflows/local/bam_qc_picard/main'
include { BAM_QC } from '../subworkflows/local/bam_qc/main'

// Create recalibration tables
include { BAM_BASERECALIBRATOR } from '../subworkflows/local/bam_baserecalibrator/main'
Expand Down Expand Up @@ -876,11 +876,14 @@ workflow NFCASEREPORTS {
bam_qc_calling = alignment_bams_final
.join(bam_qc_inputs)
.map { it -> [ it[1], it[2], it[3] ] } // meta, bam, bai
BAM_QC_PICARD(bam_qc_calling)

// omit meta since it is not used in the BAM_QC
dict_path = dict.map{ meta, dict -> dict }
BAM_QC(bam_qc_calling, dict_path)

// Gather QC
reports = reports.mix(BAM_QC_PICARD.out.reports.collect{ meta, report -> report })
versions = versions.mix(BAM_QC_PICARD.out.versions)
reports = reports.mix(BAM_QC.out.reports.collect{ meta, report -> report })
versions = versions.mix(BAM_QC.out.versions)
}

// SV Calling
Expand Down

0 comments on commit d4422a1

Please sign in to comment.