From 9f8240357d0f125d2b4267b3076afb58e312fda8 Mon Sep 17 00:00:00 2001 From: "Thiseas C. Lamnidis" Date: Thu, 18 Nov 2021 10:17:01 +0100 Subject: [PATCH 1/6] split bam_trim options by library strandedness --- nextflow_schema.json | 52 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/nextflow_schema.json b/nextflow_schema.json index 60629e272..31e542802 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -964,33 +964,61 @@ "fa_icon": "fas fa-power-off", "help_text": "Turns on the BAM trimming method. Trims off `[n]` bases from reads in the deduplicated BAM file. Damage assessment in PMDTools or DamageProfiler remains untouched, as data is routed through this independently. BAM trimming is typically performed to reduce errors during genotyping that can be caused by aDNA damage.\n\nBAM trimming will only be performed on libraries indicated as `--udg_type 'none'` or `--udg_type 'half'`. Complete UDG treatment ('full') should have removed all damage. The amount of bases that will be trimmed off can be set separately for libraries with `--udg_type` `'none'` and `'half'` (see `--bamutils_clip_half_udg_left` / `--bamutils_clip_half_udg_right` / `--bamutils_clip_none_udg_left` / `--bamutils_clip_none_udg_right`).\n\n> Note: additional artefacts such as bar-codes or adapters that could potentially also be trimmed should be removed prior mapping." }, - "bamutils_clip_half_udg_left": { + "bamutils_clip_double_stranded_half_udg_left": { "type": "integer", "default": 0, "fa_icon": "fas fa-ruler-combined", - "description": "Specify the number of bases to clip off reads from 'left' end of read for half-UDG libraries.", - "help_text": "Default set to `1` and clips off one base of the left or right side of reads from libraries whose UDG treatment is set to `half`. Note that reverse reads will automatically be clipped off at the reverse side with this (automatically reverses left and right for the reverse read).\n\n> Modifies bamUtil's trimBam parameter: `-L -R`" + "description": "Specify the number of bases to clip off reads from 'left' end of read for double-stranded half-UDG libraries.", + "help_text": "Default set to `0` and clips off no bases on the left or right side of reads from double_stranded libraries whose UDG treatment is set to `half`. Note that reverse reads will automatically be clipped off at the reverse side with this (automatically reverses left and right for the reverse read).\n\n> Modifies bamUtil's trimBam parameter: `-L -R`" }, - "bamutils_clip_half_udg_right": { + "bamutils_clip_double_stranded_half_udg_right": { "type": "integer", "default": 0, "fa_icon": "fas fa-ruler", - "description": "Specify the number of bases to clip off reads from 'right' end of read for half-UDG libraries.", - "help_text": "Default set to `1` and clips off one base of the left or right side of reads from libraries whose UDG treatment is set to `half`. Note that reverse reads will automatically be clipped off at the reverse side with this (automatically reverses left and right for the reverse read).\n\n> Modifies bamUtil's trimBam parameter: `-L -R`" + "description": "Specify the number of bases to clip off reads from 'right' end of read for double-stranded half-UDG libraries.", + "help_text": "Default set to `0` and clips off no bases on the left or right side of reads from double_stranded libraries whose UDG treatment is set to `half`. Note that reverse reads will automatically be clipped off at the reverse side with this (automatically reverses left and right for the reverse read).\n\n> Modifies bamUtil's trimBam parameter: `-L -R`" }, - "bamutils_clip_none_udg_left": { + "bamutils_clip_double_stranded_none_udg_left": { "type": "integer", "default": 0, "fa_icon": "fas fa-ruler-combined", - "description": "Specify the number of bases to clip off reads from 'left' end of read for non-UDG libraries.", - "help_text": "Default set to `1` and clips off one base of the left or right side of reads from libraries whose UDG treatment is set to `none`. Note that reverse reads will automatically be clipped off at the reverse side with this (automatically reverses left and right for the reverse read).\n\n> Modifies bamUtil's trimBam parameter: `-L -R`" + "description": "Specify the number of bases to clip off reads from 'left' end of read for double-stranded non-UDG libraries.", + "help_text": "Default set to `0` and clips off no bases on the left or right side of reads from double_stranded libraries whose UDG treatment is set to `none`. Note that reverse reads will automatically be clipped off at the reverse side with this (automatically reverses left and right for the reverse read).\n\n> Modifies bamUtil's trimBam parameter: `-L -R`" }, - "bamutils_clip_none_udg_right": { + "bamutils_clip_double_stranded_none_udg_right": { "type": "integer", "default": 0, "fa_icon": "fas fa-ruler", - "description": "Specify the number of bases to clip off reads from 'right' end of read for non-UDG libraries.", - "help_text": "Default set to `1` and clips off one base of the left or right side of reads from libraries whose UDG treatment is set to `none`. Note that reverse reads will automatically be clipped off at the reverse side with this (automatically reverses left and right for the reverse read).\n\n> Modifies bamUtil's trimBam parameter: `-L -R`" + "description": "Specify the number of bases to clip off reads from 'right' end of read for double-stranded non-UDG libraries.", + "help_text": "Default set to `0` and clips off no bases on the left or right side of reads from double_stranded libraries whose UDG treatment is set to `none`. Note that reverse reads will automatically be clipped off at the reverse side with this (automatically reverses left and right for the reverse read).\n\n> Modifies bamUtil's trimBam parameter: `-L -R`" + }, + "bamutils_clip_single_stranded_half_udg_left": { + "type": "integer", + "default": 0, + "fa_icon": "fas fa-ruler-combined", + "description": "Specify the number of bases to clip off reads from 'left' end of read for single-stranded half-UDG libraries.", + "help_text": "Default set to `0` and clips off no bases on the left or right side of reads from single-stranded libraries whose UDG treatment is set to `half`. Note that reverse reads will automatically be clipped off at the reverse side with this (automatically reverses left and right for the reverse read).\n\n> Modifies bamUtil's trimBam parameter: `-L -R`" + }, + "bamutils_clip_single_stranded_half_udg_right": { + "type": "integer", + "default": 0, + "fa_icon": "fas fa-ruler", + "description": "Specify the number of bases to clip off reads from 'right' end of read for single-stranded half-UDG libraries.", + "help_text": "Default set to `0` and clips off no bases on the left or right side of reads from single-stranded libraries whose UDG treatment is set to `half`. Note that reverse reads will automatically be clipped off at the reverse side with this (automatically reverses left and right for the reverse read).\n\n> Modifies bamUtil's trimBam parameter: `-L -R`" + }, + "bamutils_clip_single_stranded_none_udg_left": { + "type": "integer", + "default": 0, + "fa_icon": "fas fa-ruler-combined", + "description": "Specify the number of bases to clip off reads from 'left' end of read for single-stranded non-UDG libraries.", + "help_text": "Default set to `0` and clips off no bases on the left or right side of reads from single-stranded libraries whose UDG treatment is set to `none`. Note that reverse reads will automatically be clipped off at the reverse side with this (automatically reverses left and right for the reverse read).\n\n> Modifies bamUtil's trimBam parameter: `-L -R`" + }, + "bamutils_clip_single_stranded_none_udg_right": { + "type": "integer", + "default": 0, + "fa_icon": "fas fa-ruler", + "description": "Specify the number of bases to clip off reads from 'right' end of read for single-stranded non-UDG libraries.", + "help_text": "Default set to `0` and clips off no bases on the left or right side of reads from single-stranded libraries whose UDG treatment is set to `none`. Note that reverse reads will automatically be clipped off at the reverse side with this (automatically reverses left and right for the reverse read).\n\n> Modifies bamUtil's trimBam parameter: `-L -R`" }, "bamutils_softclip": { "type": "boolean", From d50d214e2037d9e357fdbcdce31882a5f73ca8ff Mon Sep 17 00:00:00 2001 From: "Thiseas C. Lamnidis" Date: Thu, 18 Nov 2021 10:17:14 +0100 Subject: [PATCH 2/6] Flexible trimming by library strandedness --- main.nf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.nf b/main.nf index b76f3da16..75b9031f5 100644 --- a/main.nf +++ b/main.nf @@ -2204,8 +2204,11 @@ process bam_trim { script: def softclip = params.bamutils_softclip ? '-c' : '' def size = params.large_ref ? '-c' : '' - def left_clipping = udg == "half" ? "${params.bamutils_clip_half_udg_left}" : "${params.bamutils_clip_none_udg_left}" - def right_clipping = udg == "half" ? "${params.bamutils_clip_half_udg_right}" : "${params.bamutils_clip_none_udg_right}" + def left_clipping = strandedness == "double" ? (udg == "half" ? "${params.bamutils_clip_double_stranded_half_udg_left}" : "${params.bamutils_clip_double_stranded_none_udg_left}") : (udg == "half" ? "${params.bamutils_clip_single_stranded_half_udg_left}" : "${params.bamutils_clip_single_stranded_none_udg_left}") + def right_clipping = strandedness == "double" ? (udg == "half" ? "${params.bamutils_clip_double_stranded_half_udg_right}" : "${params.bamutils_clip_double_stranded_none_udg_right}") : (udg == "half" ? "${params.bamutils_clip_single_stranded_half_udg_right}" : "${params.bamutils_clip_single_stranded_none_udg_right}") + + // def left_clipping = udg == "half" ? "${params.bamutils_clip_half_udg_left}" : "${params.bamutils_clip_none_udg_left}" + // def right_clipping = udg == "half" ? "${params.bamutils_clip_half_udg_right}" : "${params.bamutils_clip_none_udg_right}" """ bam trimBam $bam tmp.bam -L ${left_clipping} -R ${right_clipping} ${softclip} samtools sort -@ ${task.cpus} tmp.bam -o ${libraryid}.trimmed.bam From eddc97e5fa9fcd38524674215debb03c269c1134 Mon Sep 17 00:00:00 2001 From: "Thiseas C. Lamnidis" Date: Thu, 18 Nov 2021 10:36:02 +0100 Subject: [PATCH 3/6] Added new params for bam_trim --- nextflow.config | 12 ++++++++---- nextflow_schema.json | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/nextflow.config b/nextflow.config index a1952c731..44a0d0e72 100644 --- a/nextflow.config +++ b/nextflow.config @@ -144,10 +144,14 @@ params { //bamUtils trimbam settings run_trim_bam = false - bamutils_clip_half_udg_left = 0 - bamutils_clip_half_udg_right = 0 - bamutils_clip_none_udg_left = 0 - bamutils_clip_none_udg_right = 0 + bamutils_clip_double_stranded_half_udg_left = 0 + bamutils_clip_double_stranded_half_udg_right = 0 + bamutils_clip_double_stranded_none_udg_left = 0 + bamutils_clip_double_stranded_none_udg_right = 0 + bamutils_clip_single_stranded_half_udg_left = 0 + bamutils_clip_single_stranded_half_udg_right = 0 + bamutils_clip_single_stranded_none_udg_left = 0 + bamutils_clip_single_stranded_none_udg_right = 0 bamutils_softclip = false //Genotyping options diff --git a/nextflow_schema.json b/nextflow_schema.json index 31e542802..c140dbe79 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -1764,4 +1764,4 @@ "$ref": "#/definitions/metagenomic_authentication" } ] -} +} \ No newline at end of file From 47cb4152b040bb82918e02e86126419e5ad89494 Mon Sep 17 00:00:00 2001 From: "Thiseas C. Lamnidis" Date: Thu, 18 Nov 2021 10:50:59 +0100 Subject: [PATCH 4/6] Update CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf8c396b0..dc2f6653c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [2.4.1] - 2021-11-18 + +### `Added` + +- [#805](https://github.com/nf-core/eager/issues/805) Changes to bam_trim options to allow flexible trimming by library strandedness (in addition to UDG treatment). + ## [2.4.0] - 20201-09-14 ### `Added` From 13523eebe9161ad261174bdb2ce59ee0c7d9169f Mon Sep 17 00:00:00 2001 From: "Thiseas C. Lamnidis" Date: Thu, 18 Nov 2021 10:51:17 +0100 Subject: [PATCH 5/6] Cerrected release data of 2.4.0 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc2f6653c..5e1e27db7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [#805](https://github.com/nf-core/eager/issues/805) Changes to bam_trim options to allow flexible trimming by library strandedness (in addition to UDG treatment). -## [2.4.0] - 20201-09-14 +## [2.4.0] - 2021-09-14 ### `Added` From ef024b5d4b0d0a7183b455253f377dbc43025785 Mon Sep 17 00:00:00 2001 From: Thiseas Christos Lamnidis Date: Thu, 18 Nov 2021 11:01:06 +0100 Subject: [PATCH 6/6] lint --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 74faa52a5..a8de0aa86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -180,7 +180,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### `Deprecated` -## [2.3.0] - Aalen - 2021-01-11 +## [2.3.0] - Aalen - 2021-01-11 ### `Added`