diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d39ec09d..282a5e715 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,10 +3,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unpublished Version / DEV] +## [[3.10.1](https://github.com/nf-core/rnaseq/releases/tag/3.10.1)] - 2023-01-05 ### Enhancements & fixes +- [[#919](https://github.com/nf-core/rnaseq/issues/919)] - Salmon quant not run after FastQ subsampling if index not provided +- [[#922](https://github.com/nf-core/rnaseq/issues/922)] - Passing TrimGalore `--hardtrim3` / `--hardtrim5` via custom config raises missing output filename error + ## [[3.10](https://github.com/nf-core/rnaseq/releases/tag/3.10)] - 2022-12-21 ### Enhancements & fixes diff --git a/main.nf b/main.nf index 19eca553f..19f53b245 100755 --- a/main.nf +++ b/main.nf @@ -17,15 +17,17 @@ nextflow.enable.dsl = 2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -params.fasta = WorkflowMain.getGenomeAttribute(params, 'fasta') -params.gtf = WorkflowMain.getGenomeAttribute(params, 'gtf') -params.gff = WorkflowMain.getGenomeAttribute(params, 'gff') -params.gene_bed = WorkflowMain.getGenomeAttribute(params, 'bed12') -params.bbsplit_index = WorkflowMain.getGenomeAttribute(params, 'bbsplit') -params.star_index = WorkflowMain.getGenomeAttribute(params, 'star') -params.hisat2_index = WorkflowMain.getGenomeAttribute(params, 'hisat2') -params.rsem_index = WorkflowMain.getGenomeAttribute(params, 'rsem') -params.salmon_index = WorkflowMain.getGenomeAttribute(params, 'salmon') +params.fasta = WorkflowMain.getGenomeAttribute(params, 'fasta') +params.transcript_fasta = WorkflowMain.getGenomeAttribute(params, 'transcript_fasta') +params.additional_fasta = WorkflowMain.getGenomeAttribute(params, 'additional_fasta') +params.gtf = WorkflowMain.getGenomeAttribute(params, 'gtf') +params.gff = WorkflowMain.getGenomeAttribute(params, 'gff') +params.gene_bed = WorkflowMain.getGenomeAttribute(params, 'bed12') +params.bbsplit_index = WorkflowMain.getGenomeAttribute(params, 'bbsplit') +params.star_index = WorkflowMain.getGenomeAttribute(params, 'star') +params.hisat2_index = WorkflowMain.getGenomeAttribute(params, 'hisat2') +params.rsem_index = WorkflowMain.getGenomeAttribute(params, 'rsem') +params.salmon_index = WorkflowMain.getGenomeAttribute(params, 'salmon') /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/modules.json b/modules.json index 46ad7eb1f..0403e1f6a 100644 --- a/modules.json +++ b/modules.json @@ -129,7 +129,7 @@ "salmon/index": { "branch": "master", "git_sha": "94b06f1683ddf893cf06525f6e7f0573ad8fbf83", - "installed_by": ["modules"] + "installed_by": ["fastq_subsample_fq_salmon"] }, "salmon/quant": { "branch": "master", @@ -192,7 +192,7 @@ }, "trimgalore": { "branch": "master", - "git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c", + "git_sha": "72ffbd7128015a1d4b65b95ff8d37be8fee2f981", "installed_by": ["fastq_fastqc_umitools_trimgalore"] }, "ucsc/bedclip": { @@ -265,12 +265,12 @@ }, "fastq_fastqc_umitools_trimgalore": { "branch": "master", - "git_sha": "b51a69e30973c71950225c817ad07a3337d22c40", + "git_sha": "72ffbd7128015a1d4b65b95ff8d37be8fee2f981", "installed_by": ["subworkflows"] }, "fastq_subsample_fq_salmon": { "branch": "master", - "git_sha": "0098bc93f6219c6194f443f0feb089ba83717384", + "git_sha": "82d60046b4519e9dbef4a934371a53fa7666eabc", "installed_by": ["subworkflows"] } } diff --git a/modules/nf-core/trimgalore/main.nf b/modules/nf-core/trimgalore/main.nf index ab8bb14ec..37e88f586 100644 --- a/modules/nf-core/trimgalore/main.nf +++ b/modules/nf-core/trimgalore/main.nf @@ -11,13 +11,12 @@ process TRIMGALORE { tuple val(meta), path(reads) output: - tuple val(meta), path("*{trimmed,val}*.fq.gz"), emit: reads - tuple val(meta), path("*report.txt") , emit: log - path "versions.yml" , emit: versions - - tuple val(meta), path("*unpaired*.fq.gz") , emit: unpaired, optional: true - tuple val(meta), path("*.html") , emit: html , optional: true - tuple val(meta), path("*.zip") , emit: zip , optional: true + tuple val(meta), path("*{3prime,5prime,trimmed,val}*.fq.gz"), emit: reads + tuple val(meta), path("*report.txt") , emit: log , optional: true + tuple val(meta), path("*unpaired*.fq.gz") , emit: unpaired, optional: true + tuple val(meta), path("*.html") , emit: html , optional: true + tuple val(meta), path("*.zip") , emit: zip , optional: true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/trimgalore/meta.yml b/modules/nf-core/trimgalore/meta.yml index 439f566df..f84c4d771 100644 --- a/modules/nf-core/trimgalore/meta.yml +++ b/modules/nf-core/trimgalore/meta.yml @@ -36,7 +36,7 @@ output: description: | List of input adapter trimmed FastQ files of size 1 and 2 for single-end and paired-end data, respectively. - pattern: "*.{fq.gz}" + pattern: "*{3prime,5prime,trimmed,val}*.fq.gz" - unpaired: type: file description: | diff --git a/nextflow.config b/nextflow.config index 91700816d..f94f87baf 100644 --- a/nextflow.config +++ b/nextflow.config @@ -14,8 +14,6 @@ params { // References genome = null - transcript_fasta = null - additional_fasta = null splicesites = null gtf_extra_attributes = 'gene_name' gtf_group_features = 'gene_id' @@ -256,7 +254,7 @@ manifest { description = """RNA sequencing analysis pipeline for gene/isoform quantification and extensive quality control.""" mainScript = 'main.nf' nextflowVersion = '!>=22.10.1' - version = '3.11dev' + version = '3.10.1' doi = 'https://doi.org/10.5281/zenodo.1400710' } diff --git a/subworkflows/local/prepare_genome.nf b/subworkflows/local/prepare_genome.nf index f459cd7c6..1b99df670 100644 --- a/subworkflows/local/prepare_genome.nf +++ b/subworkflows/local/prepare_genome.nf @@ -230,15 +230,15 @@ workflow PREPARE_GENOME { // Uncompress Salmon index or generate from scratch if required // ch_salmon_index = Channel.empty() - if ('salmon' in prepare_tool_indices) { - if (params.salmon_index) { - if (params.salmon_index.endsWith('.tar.gz')) { - ch_salmon_index = UNTAR_SALMON_INDEX ( [ [:], params.salmon_index ] ).untar.map { it[1] } - ch_versions = ch_versions.mix(UNTAR_SALMON_INDEX.out.versions) - } else { - ch_salmon_index = file(params.salmon_index) - } + if (params.salmon_index) { + if (params.salmon_index.endsWith('.tar.gz')) { + ch_salmon_index = UNTAR_SALMON_INDEX ( [ [:], params.salmon_index ] ).untar.map { it[1] } + ch_versions = ch_versions.mix(UNTAR_SALMON_INDEX.out.versions) } else { + ch_salmon_index = file(params.salmon_index) + } + } else { + if ('salmon' in prepare_tool_indices) { ch_salmon_index = SALMON_INDEX ( ch_fasta, ch_transcript_fasta ).index ch_versions = ch_versions.mix(SALMON_INDEX.out.versions) } diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/main.nf b/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/main.nf index f3313256a..36295a167 100644 --- a/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/main.nf +++ b/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/main.nf @@ -82,13 +82,17 @@ workflow FASTQ_FASTQC_UMITOOLS_TRIMGALORE { // Filter empty FastQ files after adapter trimming // trim_reads - .join(trim_log) + .join(trim_log, remainder: true) .map { meta, reads, trim_log -> - if (!meta.single_end) { - trim_log = trim_log[-1] - } - if (getTrimGaloreReadsAfterFiltering(trim_log) > 0) { + if (trim_log) { + if (!meta.single_end) { + trim_log = trim_log[-1] + } + if (getTrimGaloreReadsAfterFiltering(trim_log) > 0) { + [ meta, reads ] + } + } else { [ meta, reads ] } } diff --git a/subworkflows/nf-core/fastq_subsample_fq_salmon/main.nf b/subworkflows/nf-core/fastq_subsample_fq_salmon/main.nf index 66868e182..0ac3e53a3 100644 --- a/subworkflows/nf-core/fastq_subsample_fq_salmon/main.nf +++ b/subworkflows/nf-core/fastq_subsample_fq_salmon/main.nf @@ -3,20 +3,31 @@ // can be used to infer strandedness of library // +include { SALMON_INDEX } from '../../../modules/nf-core/salmon/index/main' include { FQ_SUBSAMPLE } from '../../../modules/nf-core/fq/subsample/main' include { SALMON_QUANT } from '../../../modules/nf-core/salmon/quant/main' workflow FASTQ_SUBSAMPLE_FQ_SALMON { take: ch_reads // channel: [ val(meta), [ reads ] ] - ch_index // channel: /path/to/salmon/index/ + ch_genome_fasta // channel: /path/to/genome.fasta ch_transcript_fasta // channel: /path/to/transcript.fasta ch_gtf // channel: /path/to/genome.gtf + ch_index // channel: /path/to/salmon/index/ + make_index // boolean: Whether to create salmon index before running salmon quant main: ch_versions = Channel.empty() + // + // Create Salmon index if required + // + if (make_index) { + ch_index = SALMON_INDEX ( ch_genome_fasta, ch_transcript_fasta ).index + ch_versions = ch_versions.mix(SALMON_INDEX.out.versions) + } + // // Sub-sample FastQ files with fq // @@ -32,6 +43,8 @@ workflow FASTQ_SUBSAMPLE_FQ_SALMON { ch_versions = ch_versions.mix(SALMON_QUANT.out.versions.first()) emit: + index = ch_index // channel: [ index ] + reads = FQ_SUBSAMPLE.out.fastq // channel: [ val(meta), fastq ] results = SALMON_QUANT.out.results // channel: [ val(meta), results_dir ] diff --git a/subworkflows/nf-core/fastq_subsample_fq_salmon/meta.yml b/subworkflows/nf-core/fastq_subsample_fq_salmon/meta.yml index 904337fb0..fd13a3748 100644 --- a/subworkflows/nf-core/fastq_subsample_fq_salmon/meta.yml +++ b/subworkflows/nf-core/fastq_subsample_fq_salmon/meta.yml @@ -13,15 +13,15 @@ input: description: | Groovy Map containing sample information e.g. [ id:'test' ] - - reads: + - ch_reads: type: file description: | List of input FastQ files of size 1 and 2 for single-end and paired-end data, respectively. - - ch_index: + - ch_genome_fasta: type: file - description: Salmon index files - pattern: "Directory containing Salmon index" + description: Genome fasta file + pattern: "Path to genome sequence in fasta format" - ch_transcript_fasta: type: file description: Transcript fasta file @@ -30,8 +30,19 @@ input: type: file description: GTF features file pattern: "Path features in GTF format" + - ch_index: + type: file + description: Salmon index files + pattern: "Directory containing Salmon index" + - make_index: + type: boolean + description: Whether to create salmon index before running salmon quant output: + - index: + type: directory + description: Directory containing salmon index + pattern: "salmon" - reads: type: file description: Subsampled fastq reads. diff --git a/workflows/rnaseq.nf b/workflows/rnaseq.nf index e0854d716..c22c8688c 100755 --- a/workflows/rnaseq.nf +++ b/workflows/rnaseq.nf @@ -232,9 +232,11 @@ workflow RNASEQ { // FASTQ_SUBSAMPLE_FQ_SALMON ( ch_strand_fastq.auto_strand, + PREPARE_GENOME.out.fasta, + PREPARE_GENOME.out.transcript_fasta, + PREPARE_GENOME.out.gtf, PREPARE_GENOME.out.salmon_index, - ch_dummy_file, - PREPARE_GENOME.out.gtf + !params.salmon_index && !('salmon' in prepareToolIndices) ) ch_versions = ch_versions.mix(FASTQ_SUBSAMPLE_FQ_SALMON.out.versions) @@ -268,16 +270,20 @@ workflow RNASEQ { ch_filtered_reads = FASTQ_FASTQC_UMITOOLS_TRIMGALORE.out.reads if (!params.skip_trimming) { ch_filtered_reads - .join(FASTQ_FASTQC_UMITOOLS_TRIMGALORE.out.trim_log) + .join(FASTQ_FASTQC_UMITOOLS_TRIMGALORE.out.trim_log, remainder: true) .map { meta, reads, trim_log -> - if (!meta.single_end) { - trim_log = trim_log[-1] + if (trim_log) { + if (!meta.single_end) { + trim_log = trim_log[-1] + } + num_reads = WorkflowRnaseq.getTrimGaloreReadsAfterFiltering(trim_log) + [ meta, reads, num_reads ] + } else { + [ meta, reads, params.min_trimmed_reads + 1 ] } - num_reads = WorkflowRnaseq.getTrimGaloreReadsAfterFiltering(trim_log) - [ meta, reads, num_reads ] } - .set { ch_num_trimmed_reads } + .set { ch_num_trimmed_reads } ch_num_trimmed_reads .map { meta, reads, num_reads -> if (num_reads > params.min_trimmed_reads) [ meta, reads ] }