diff --git a/conf/base.config b/conf/base.config index 566fe7e..a022789 100644 --- a/conf/base.config +++ b/conf/base.config @@ -65,9 +65,9 @@ process { cpus = { check_max( 12 * task.attempt, 'cpus' ) } memory = { check_max( 4.GB * task.attempt, 'memory' ) } } - withName: 'BWAMEM1_MEM|BWAMEM2_MEM' { + withName: 'BWAMEM2_MEM|BWAMEM2_MEM' { cpus = { check_max( 24 * task.attempt, 'cpus' ) } - memory = { check_max( 30.GB * task.attempt, 'memory' ) } + memory = { check_max( 72.GB * task.attempt, 'memory' ) } } withName: 'PARABRICKS_FQ2BAM' { cpus = { check_max( 24 * task.attempt, 'cpus' ) } diff --git a/conf/modules/aligner.config b/conf/modules/aligner.config index 7e783a8..62d46de 100644 --- a/conf/modules/aligner.config +++ b/conf/modules/aligner.config @@ -84,4 +84,14 @@ process { withName: 'MERGE_BAM' { ext.prefix = { "${meta.id}.sorted" } } + + + withName: 'CRAM_TO_BAM_FINAL' { + publishDir = [ + mode: params.publish_dir_mode, + path: { "${params.outdir}/alignment/final/${meta.id}/" }, + pattern: "*{bam,bai}", + ] + } } + diff --git a/conf/modules/recalibrate.config b/conf/modules/recalibrate.config index fe11ecb..5e3fe0b 100644 --- a/conf/modules/recalibrate.config +++ b/conf/modules/recalibrate.config @@ -18,7 +18,7 @@ process { withName: 'GATK4_APPLYBQSR|GATK4_APPLYBQSR_SPARK' { ext.prefix = { meta.num_intervals <= 1 ? "${meta.id}.recal" : "${meta.id}_${intervals.simpleName}.recal" } publishDir = [ - enabled: !params.save_output_as_bam, + enabled: params.save_mapped, mode: params.publish_dir_mode, path: { "${params.outdir}/alignment/" }, pattern: "*cram", @@ -30,7 +30,7 @@ process { ext.prefix = { "${meta.id}.recal" } publishDir = [ - enabled: !params.save_output_as_bam, + enabled: params.save_mapped, mode: params.publish_dir_mode, path: { "${params.outdir}/alignment/recalibrated/${meta.id}/" }, pattern: "*cram" @@ -39,7 +39,7 @@ process { withName: 'MSKILABORG_NFJABBA:NFJABBA:(BAM_APPLYBQSR|BAM_APPLYBQSR_SPARK):CRAM_MERGE_INDEX_SAMTOOLS:INDEX_CRAM' { publishDir = [ - enabled: !params.save_output_as_bam, + enabled: params.save_mapped, mode: params.publish_dir_mode, path: { "${params.outdir}/alignment/recalibrated/${meta.id}/" }, pattern: "*{recal.cram,recal.cram.crai}" @@ -50,7 +50,7 @@ process { ext.prefix = { "${meta.id}.recal" } publishDir = [ - enabled: params.save_output_as_bam, + enabled: params.save_mapped, mode: params.publish_dir_mode, path: { "${params.outdir}/alignment/recalibrated/${meta.id}/" }, pattern: "*{recal.bam,recal.bam.bai}" diff --git a/modules/nf-core/bwamem2/index/main.nf b/modules/nf-core/bwamem2/index/main.nf index 9fabda2..7c6036c 100644 --- a/modules/nf-core/bwamem2/index/main.nf +++ b/modules/nf-core/bwamem2/index/main.nf @@ -1,6 +1,6 @@ process BWAMEM2_INDEX { tag "$fasta" - label 'process_low' + label 'process_high' conda "bioconda::bwa-mem2=2.2.1" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? diff --git a/nextflow.config b/nextflow.config index 2405679..9d9fbdb 100644 --- a/nextflow.config +++ b/nextflow.config @@ -48,7 +48,7 @@ params { fq2bam_mark_duplicates = true // Whether fq2bam should mark duplicates, set false if not using fq2bam fq2bam_low_memory = false // Set to true if using fq2bam with gpus that have <24GB memory optical_duplicate_pixel_distance = 2500 // For computing optical duplicates, 2500 for NovaSeqX+ - save_mapped = true // Mapped BAMs are saved + save_mapped = false // Mapped BAMs are saved save_output_as_bam = true // Output files from alignment are saved as bam by default and not as cram files seq_center = null // No sequencing center to be written in read group CN field by aligner seq_platform = null // Default platform written in read group PL field by aligner, null by default. diff --git a/tests/test_runs/full_test/params.json b/tests/test_runs/full_test/params.json index e12c32a..bba1b60 100644 --- a/tests/test_runs/full_test/params.json +++ b/tests/test_runs/full_test/params.json @@ -6,7 +6,7 @@ "bwa": "/gpfs/commons/home/sdider/DB/GATK/bwa/", "outdir": "./results", "pon_dryclean": "/gpfs/commons/home/tdey/data/dryclean/MONSTER_PON_RAW/MONSTER_PON_RAW_SORTED/fixed.detergent.rds", - "tools": "fusions", + "tools": "bamqc", "field_dryclean": "reads", "genome": "GATK.GRCh37", "email": "shihabdider@gmail.com" diff --git a/workflows/nfcasereports.nf b/workflows/nfcasereports.nf index fe41b47..c2b2eed 100644 --- a/workflows/nfcasereports.nf +++ b/workflows/nfcasereports.nf @@ -368,6 +368,14 @@ inputs = inputs ch_items.meta = ch_items.meta - ch_items.meta.subMap('lane') + [num_lanes: num_lanes.toInteger(), read_group: read_group.toString(), size: 1] + } else if (ch_items.fastq_2) { + ch_items.meta = ch_items.meta + [id: ch_items.meta.sample.toString()] + def CN = params.seq_center ? "CN:${params.seq_center}\\t" : '' + + def flowcell = flowcellLaneFromFastq(ch_items.fastq_1) + def read_group = "\"@RG\\tID:${flowcell}.${ch_items.meta.sample}\\t${CN}PU:${ch_items.meta.sample}\\tSM:${ch_items.meta.patient}_${ch_items.meta.sample}\\tLB:${ch_items.meta.sample}\\tDS:${params.fasta}\\tPL:${params.seq_platform}\"" + + ch_items.meta = ch_items.meta + [num_lanes: num_lanes.toInteger(), read_group: read_group.toString(), size: 1] } else if (ch_items.meta.lane && ch_items.bam) { ch_items.meta = ch_items.meta + [id: "${ch_items.meta.sample}-${ch_items.meta.lane}".toString()] def CN = params.seq_center ? "CN:${params.seq_center}\\t" : ''