Skip to content

Commit 5f574e8

Browse files
authored
Merge pull request #674 from nf-core/rework_trimming
Rework trimming
2 parents e0c951b + 3bf196c commit 5f574e8

File tree

19 files changed

+329
-84
lines changed

19 files changed

+329
-84
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4545
- Added `--star_limit_bam_sort_ram` to set the maximum memory for sorting the BAM files in STAR. [#668](https://github.com/nf-core/rnafusion/pull/668)
4646
- Update STAR-Fusion to 1.15.0 and update nf-core modules [#664](https://github.com/nf-core/rnafusion/pull/664)
4747
- Update fusionreport 4.0.0 that replaces the score of a fusion with a Fusion Indication Index [#667](https://github.com/nf-core/rnafusion/pull/667)
48+
- Added a extra trimming step for fusioncatcher in case a different read-length is wished for this tool only [#674](https://github.com/nf-core/rnafusion/pull/674)
4849

4950
### Changed
5051

@@ -97,6 +98,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9798
- The `FUSIONINSPECTOR` process will no longer fail when no fusions have been found. [#651](https://github.com/nf-core/rnafusion/pull/651)
9899
- Fixed STAR-Fusion build would fail when downloading Pfam and Dfam resources behind SSL. [#653](https://github.com/nf-core/rnafusion/pull/653)
99100
- Fix bug in argument handling for FusionInspector [#669](https://github.com/nf-core/rnafusion/pull/669)
101+
- Fix missing memory unit for fusioncatcher [#674](https://github.com/nf-core/rnafusion/pull/674)
100102

101103
### Removed
102104

@@ -118,6 +120,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
118120
| `--stringtie` | `--tools stringtie` |
119121
| `--all` | `--tools all` |
120122
| | `--fusioncatcher_download_link` |
123+
| | `--trim_tail_fusioncatcher` |
121124

122125
## v3.0.2 - [2024-04-10]
123126

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,14 @@ For more details about the output files and reports, please refer to the
113113

114114
nf-core/rnafusion was written by Martin Proks ([@matq007](https://github.com/matq007)), Maxime Garcia ([@maxulysse](https://github.com/maxulysse)) and Annick Renevey ([@rannick](https://github.com/rannick))
115115

116-
We thank the following people for their help in the development of this pipeline:
116+
## We thank the following people for their help in the development of this pipeline
117117

118118
- [Phil Ewels](https://github.com/ewels)
119119
- [Rickard Hammarén](https://github.com/Hammarn)
120120
- [Alexander Peltzer](https://github.com/apeltzer)
121121
- [Praveen Raj](https://github.com/praveenraj2018)
122+
- [Anabella Trigila](https://github.com/atrigila)
123+
- [Nicolas Vannieuwkerke](https://github.com/nvnieuwk)
122124

123125
## Contributions and Support
124126

conf/modules.config

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,22 @@ process {
6565
}
6666

6767
withName: 'FASTP' {
68-
ext.args = { params.trim_tail ? "--trim_tail1 ${params.trim_tail} --trim_tail2 ${params.trim_tail} " : '' }
68+
ext.args = { params.trim_tail > 0 ? "--trim_tail1 ${params.trim_tail} --trim_tail2 ${params.trim_tail} " : '' }
69+
publishDir = [
70+
path: { "${params.outdir}/fastp" },
71+
mode: params.publish_dir_mode,
72+
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
73+
]
74+
}
75+
76+
withName: 'FASTP_FOR_FUSIONCATCHER' {
77+
ext.args = { params.trim_tail_fusioncatcher > 0 ? "--trim_tail1 ${params.trim_tail_fusioncatcher} --trim_tail2 ${params.trim_tail_fusioncatcher} " : '' }
78+
ext.prefix = { "${meta.id}_trimmed_for_fusioncatcher" }
79+
publishDir = [
80+
path: { "${params.outdir}/fastp_for_fusioncatcher" },
81+
mode: params.publish_dir_mode,
82+
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
83+
]
6984
}
7085

7186
withName: 'FASTQC' {

docs/output.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ If multiple libraries or runs have been provided for the same sample in the inpu
133133

134134
### Fastp
135135

136-
If `--trim_fastp` is selected, [fastp](https://github.com/OpenGene/fastp) will filter low quality reads as well as bases at the 5' and 3' ends, trim adapters (automatically detected, but input with parameter `--adapter_fasta` is possible). 3' trimming is also possible via parameter `--trim_tail`.
136+
If `--tools fastp` is present, [fastp](https://github.com/OpenGene/fastp) will filter low quality reads as well as bases at the 5' and 3' ends, trim adapters (automatically detected, but input with parameter `--adapter_fasta` is possible). 3' trimming is also possible via parameter `--trim_tail`.
137137

138138
<details markdown="1">
139139
<summary>Output files</summary>
@@ -147,6 +147,22 @@ If `--trim_fastp` is selected, [fastp](https://github.com/OpenGene/fastp) will f
147147

148148
</details>
149149

150+
### Fastp for fusioncatcher
151+
152+
If `trim_tail_fusioncatcher` has any value other than 0, [fastp](https://github.com/OpenGene/fastp) will be run again as above. This allows for additional trimming of read tails before running FusionCatcher. For example if reads are 150bp, using `--trim_tail_fusioncatcher 50` will shorten reads to 100 bp by 50 bases from the 3′ end. 100 bp is the recommended read length to feed into FusionCatcher. The default for `--trim_tail_fusioncatcher` is 0 (no trimming).
153+
154+
<details markdown="1">
155+
<summary>Output files</summary>
156+
157+
- `fastp/`
158+
- `<sample>_trimmed_for_fusioncatcher_1.fastp.fastq.gz`
159+
- `<sample>_trimmed_for_fusioncatcher_2.fastp.fastq.gz`
160+
- `<sample>_trimmed_for_fusioncatcher.fastp.html`
161+
- `<sample>_trimmed_for_fusioncatcher.fastp.json`
162+
- `<sample>_trimmed_for_fusioncatcher.fastp.log`
163+
164+
</details>
165+
150166
### FastQC
151167

152168
<details markdown="1">

docs/usage.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ nextflow run nf-core/rnafusion \
268268
--adapter_fastq <PATH/TO/ADAPTER/FASTQ> (optional)
269269
```
270270
271+
The additional `--trim_tail_fusioncatcher` flag will toggle an additional `fastp` process, especially useful is reads are above 100 bp, which is not handled well by FusionCatcher. The parameter `--trim_tail_fusioncatcher`need to be provided with the number of bases to remove from the tail end.
272+
271273
#### Filter fusions detected by 2 or more tools
272274
273275
```bash

modules.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
},
4343
"fusioncatcher/fusioncatcher": {
4444
"branch": "master",
45-
"git_sha": "2a227f75f33415f74a884ef8b33555b151e33de9",
45+
"git_sha": "1037205706929921360f57e8042eae6819825e31",
4646
"installed_by": ["modules"]
4747
},
4848
"gatk4/bedtointervallist": {

modules/nf-core/fusioncatcher/fusioncatcher/main.nf

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nextflow.config

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ params {
3939
tools_cutoff = 1
4040

4141
// Trimming
42-
trim_tail = null
42+
trim_tail = 0
43+
trim_tail_fusioncatcher = 0
4344
adapter_fasta = []
4445

4546
// Compression

nextflow_schema.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,13 @@
263263
"trim_tail": {
264264
"type": "integer",
265265
"description": "The amount of bases to trim at the tail of each read, none will be trimmed by default",
266-
"minimum": 1,
266+
"minimum": 0,
267+
"fa_icon": "fas fa-cut"
268+
},
269+
"trim_tail_fusioncatcher": {
270+
"type": "integer",
271+
"description": "The amount of bases to trim at the tail of each read for fusioncatcher, none will be trimmed by default",
272+
"minimum": 0,
267273
"fa_icon": "fas fa-cut"
268274
},
269275
"adapter_fasta": {

subworkflows/local/fusioncatcher_workflow/main.nf

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
include { FUSIONCATCHER_FUSIONCATCHER } from '../../../modules/nf-core/fusioncatcher/fusioncatcher/main'
1+
include { FASTP as FASTP_FOR_FUSIONCATCHER } from '../../../modules/nf-core/fastp/main'
2+
include { FUSIONCATCHER_FUSIONCATCHER } from '../../../modules/nf-core/fusioncatcher/fusioncatcher/main'
23

34
// TODO: Remove fusioncatcher_fusions as parameter.
45
// TODO: remove dummy file. Work with Channel.empty()
@@ -7,6 +8,8 @@ include { FUSIONCATCHER_FUSIONCATCHER } from '../../../modules/nf-core/fusioncat
78
workflow FUSIONCATCHER_WORKFLOW {
89
take:
910
reads // channel [ meta, [ fastqs ] ]
11+
fusioncatcher_trimming // boolean
12+
adapter_fasta // channel [ path ]
1013
fusioncatcher_ref // channel [ meta, path ]
1114
fusioncatcher_fusions // path, string
1215

@@ -18,6 +21,17 @@ workflow FUSIONCATCHER_WORKFLOW {
1821
ch_fusioncatcher_fusions = reads.combine(Channel.value(file(fusioncatcher_fusions, checkIfExists:true)))
1922
.map { meta, _reads, fusions -> [ meta, fusions ] }
2023
} else {
24+
if (fusioncatcher_trimming) {
25+
FASTP_FOR_FUSIONCATCHER(
26+
reads,
27+
adapter_fasta,
28+
false, // discard_trimmed_pass
29+
false, // save_trimmed_fail
30+
false // skip_qc
31+
)
32+
ch_versions = ch_versions.mix(FASTP_FOR_FUSIONCATCHER.out.versions)
33+
reads = FASTP_FOR_FUSIONCATCHER.out.reads
34+
}
2135

2236
FUSIONCATCHER_FUSIONCATCHER (
2337
reads,

0 commit comments

Comments
 (0)