Skip to content

Commit 7d0d94f

Browse files
authored
Merge pull request #235 from nf-core/skipqc-fix
Skipqc fix and group samples by adapter for mirtrace
2 parents f776c73 + 5c2b354 commit 7d0d94f

File tree

8 files changed

+35
-55
lines changed

8 files changed

+35
-55
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
44
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6-
## [v2.2.0](https://github.com/nf-core/smrnaseq/releases/tag/2.2.0) - 2023-04-25
6+
## [v2.2.0](https://github.com/nf-core/smrnaseq/releases/tag/2.2.0) - 2023-04-26
77

88
- [[#220](https://github.com/nf-core/smrnaseq/issues/220)] - Fixed an issue where miRTrace reports fastq basename instead of sample ID
99
- [[#208](https://github.com/nf-core/smrnaseq/issues/208)] - Fixed usability of `--skip_qc` parameter
1010
- Updated FASTP module to allow direct addition of adapter_fasta file to it
1111
- [[#205](https://github.com/nf-core/smrnaseq/issues/205)] - Fix mirTrace Report to be a single report again instead of per sample reports
1212
- [[#206](https://github.com/nf-core/smrnaseq/issues/206)] - Use % as separator in sed commands to enable conda working properly on OSX and Linux
1313
- [[#207](https://github.com/nf-core/smrnaseq/issues/224)] - Fix Samplesheet print error
14+
- Group samples by adapter sequence before running mirtrace
15+
- Remove `--skip_qc` parameter
1416

1517
## [v2.1.0](https://github.com/nf-core/smrnaseq/releases/tag/2.1.0) - 2022-10-20 Maroon Tin Dalmatian
1618

conf/modules.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ process {
8787
}
8888
}
8989

90-
if (!(params.skip_fastqc || params.skip_qc)) {
90+
if (!(params.skip_fastqc)) {
9191
process {
9292
withName: '.*:FASTQC_FASTP:FASTQC_.*' {
9393
ext.args = '--quiet'

modules/local/mirtrace.nf

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ process MIRTRACE_RUN {
77
'quay.io/biocontainers/mirtrace:1.0.1--hdfd78af_1' }"
88

99
input:
10-
tuple val(meta), path(reads)
10+
tuple val(adapter), val(ids), path(reads)
1111

1212
output:
1313
path "mirtrace/*" , emit: mirtrace
@@ -18,22 +18,20 @@ process MIRTRACE_RUN {
1818

1919
script:
2020
// mirtrace protocol defaults to 'params.protocol' if not set
21-
def primer = meta.adapter ? "--adapter ${meta.adapter}" : ""
21+
def primer = adapter ? "--adapter ${adapter}" : ""
2222
def protocol = params.protocol == 'custom' ? '' : "--protocol $params.protocol"
2323
def java_mem = ''
24-
def prefix = "${meta.id}"
2524
if(task.memory){
2625
tmem = task.memory.toBytes()
2726
java_mem = "-Xms${tmem} -Xmx${tmem}"
2827
}
28+
def config_lines = [ids,reads]
29+
.transpose()
30+
.collect({ id, path -> "echo '${path},${id}' >> mirtrace_config" })
2931
"""
3032
export mirtracejar=\$(dirname \$(which mirtrace))
31-
for i in $reads
32-
do
33-
path=\$(realpath \${i})
34-
prefix=$prefix
35-
echo \$path","\$prefix
36-
done > mirtrace_config
33+
34+
${config_lines.join("\n ")}
3735
3836
java $java_mem -jar \$mirtracejar/mirtrace.jar --mirtrace-wrapper-name mirtrace qc \\
3937
--species $params.mirtrace_species \\

nextflow.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ params {
3636
fastp_min_length = 17
3737
fastp_known_mirna_adapters = "$projectDir/assets/known_adapters.fa"
3838
save_trimmed_fail = false
39-
skip_qc = false
4039
skip_fastqc = false
4140
skip_multiqc = false
4241
skip_mirdeep = false

nextflow_schema.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,6 @@
249249
"description": "Switches to skip specific pipeline steps, if desired.",
250250
"fa_icon": "fas fa-fast-forward",
251251
"properties": {
252-
"skip_qc": {
253-
"type": "boolean",
254-
"fa_icon": "fas fa-fast-forward",
255-
"description": "Skip all QC steps"
256-
},
257252
"skip_fastqc": {
258253
"type": "boolean",
259254
"fa_icon": "fas fa-fast-forward",

subworkflows/nf-core/fastqc_fastp.nf renamed to subworkflows/local/fastqc_fastp.nf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ workflow FASTQC_FASTP {
3535

3636
main:
3737

38-
ch_versions = Channel.empty()
39-
38+
ch_versions = Channel.empty()
4039
fastqc_raw_html = Channel.empty()
4140
fastqc_raw_zip = Channel.empty()
41+
adapterseq = reads.map { meta, _ -> [meta, null] }
4242
if (!params.skip_fastqc) {
4343
FASTQC_RAW (
4444
reads

subworkflows/local/mirtrace.nf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ include { MIRTRACE_RUN } from '../../modules/local/mirtrace'
66

77
workflow MIRTRACE {
88
take:
9-
reads // channel: [ val(meta), [ reads ] ]
9+
reads // channel: [ val(adapterseq), [ val(ids) ], [ path(reads) ] ]
1010

1111
main:
1212
reads
13+
| map { adapterseq, ids, read_collection -> [adapterseq, ids, read_collection*.first()]}
1314
| MIRTRACE_RUN
1415

1516
emit:

workflows/smrnaseq.nf

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ if (!params.mirgenedb) {
5959
}
6060

6161
include { INPUT_CHECK } from '../subworkflows/local/input_check'
62-
include { FASTQC_FASTP } from '../subworkflows/nf-core/fastqc_fastp'
62+
include { FASTQC_FASTP } from '../subworkflows/local/fastqc_fastp'
6363
include { CONTAMINANT_FILTER } from '../subworkflows/local/contaminant_filter'
6464
include { MIRNA_QUANT } from '../subworkflows/local/mirna_quant'
6565
include { GENOME_QUANT } from '../subworkflows/local/genome_quant'
@@ -125,36 +125,26 @@ workflow SMRNASEQ {
125125
// SUBWORKFLOW: Read QC and trim adapters
126126
//
127127

128-
if(!params.skip_qc){
129128
FASTQC_FASTP (
130129
ch_cat_fastq,
131130
ch_fastp_adapters,
132131
false,
133132
false
134133
)
135134
ch_versions = ch_versions.mix(FASTQC_FASTP.out.versions)
136-
reads_for_mirna = FASTQC_FASTP.out.reads
137-
138135

139136
//
140137
// SUBWORKFLOW: mirtrace QC
141138
//
142-
ch_outputs_for_mirtrace = FASTQC_FASTP.out.adapterseq
139+
FASTQC_FASTP.out.adapterseq
143140
.join( ch_cat_fastq )
144-
.map { meta, adapterseq, fastq -> [meta + [adapter:adapterseq], fastq] }
145-
.collect()
146-
147-
MIRTRACE(ch_outputs_for_mirtrace)
141+
.map { meta, adapterseq, fastq -> [adapterseq, meta.id, fastq] }
142+
.groupTuple()
143+
.set { ch_mitrace_inputs }
148144

145+
MIRTRACE(ch_mitrace_inputs)
149146
ch_versions = ch_versions.mix(MIRTRACE.out.versions.ifEmpty(null))
150147

151-
} else{
152-
//TODO - rob? :-)
153-
154-
}
155-
156-
157-
158148

159149
//
160150
// SUBWORKFLOW: remove contaminants from reads
@@ -172,18 +162,16 @@ workflow SMRNASEQ {
172162
FASTQC_FASTP.out.reads
173163
)
174164

175-
reads_for_mirna = CONTAMINANT_FILTER.out.filtered_reads
165+
contamination_stats = CONTAMINANT_FILTER.out.filter_stats
176166
ch_versions = ch_versions.mix(CONTAMINANT_FILTER.out.versions)
177-
CONTAMINANT_FILTER.out.filter_stats
178-
.set { contamination_stats }
179167

180168
}
181169

182170
MIRNA_QUANT (
183171
reference_mature,
184172
reference_hairpin,
185173
mirna_gtf,
186-
reads_for_mirna
174+
contamination_stats
187175
)
188176
ch_versions = ch_versions.mix(MIRNA_QUANT.out.versions.ifEmpty(null))
189177

@@ -192,10 +180,8 @@ workflow SMRNASEQ {
192180
//
193181
genome_stats = Channel.empty()
194182
if (params.fasta){
195-
ch_fasta = file(params.fasta)
196-
GENOME_QUANT ( ch_fasta, params.bowtie_index, MIRNA_QUANT.out.unmapped )
197-
GENOME_QUANT.out.stats
198-
.set { genome_stats }
183+
GENOME_QUANT ( file(params.fasta), params.bowtie_index, MIRNA_QUANT.out.unmapped )
184+
genome_stats = GENOME_QUANT.out.stats
199185
ch_versions = ch_versions.mix(GENOME_QUANT.out.versions)
200186

201187
if (!params.skip_mirdeep) {
@@ -229,23 +215,22 @@ workflow SMRNASEQ {
229215
ch_multiqc_files = Channel.empty()
230216
ch_multiqc_files = ch_multiqc_files.mix(CUSTOM_DUMPSOFTWAREVERSIONS.out.mqc_yml.collect())
231217
ch_multiqc_files = ch_multiqc_files.mix(ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml'))
232-
233-
ch_multiqc_files = ch_multiqc_files.mix(FASTQC_FASTP.out.fastqc_raw_zip.collect{it[1]}.ifEmpty([])),
234-
ch_multiqc_files = ch_multiqc_files.mix(FASTQC_FASTP.out.trim_json.collect{it[1]}.ifEmpty([])),
218+
ch_multiqc_files = ch_multiqc_files.mix(FASTQC_FASTP.out.fastqc_raw_zip.collect{it[1]}.ifEmpty([]))
219+
ch_multiqc_files = ch_multiqc_files.mix(FASTQC_FASTP.out.trim_json.collect{it[1]}.ifEmpty([]))
235220
ch_multiqc_files = ch_multiqc_files.mix(contamination_stats.collect().ifEmpty([]))
221+
ch_multiqc_files = ch_multiqc_files.mix(genome_stats.collect({it[1]}).ifEmpty([]))
236222
ch_multiqc_files = ch_multiqc_files.mix(MIRNA_QUANT.out.mature_stats.collect({it[1]}).ifEmpty([]))
237223
ch_multiqc_files = ch_multiqc_files.mix(MIRNA_QUANT.out.hairpin_stats.collect({it[1]}).ifEmpty([]))
238-
ch_multiqc_files = ch_multiqc_files.mix(genome_stats.collect({it[1]}).ifEmpty([]))
239224
ch_multiqc_files = ch_multiqc_files.mix(MIRNA_QUANT.out.mirtop_logs.collect().ifEmpty([]))
240225
ch_multiqc_files = ch_multiqc_files.mix(MIRTRACE.out.results.collect().ifEmpty([]))
241226

242-
MULTIQC (
243-
ch_multiqc_files.collect(),
244-
ch_multiqc_config.toList(),
245-
ch_multiqc_custom_config.toList(),
246-
ch_multiqc_logo.toList()
247-
)
248-
multiqc_report = MULTIQC.out.report.toList()
227+
MULTIQC (
228+
ch_multiqc_files.collect(),
229+
ch_multiqc_config.toList(),
230+
ch_multiqc_custom_config.toList(),
231+
ch_multiqc_logo.toList()
232+
)
233+
multiqc_report = MULTIQC.out.report.toList()
249234
}
250235
}
251236

0 commit comments

Comments
 (0)