Skip to content

Commit

Permalink
Merge pull request #978 from drpatelh/fixes
Browse files Browse the repository at this point in the history
Fix #975 and replace System.exit(1) calls in template
  • Loading branch information
drpatelh authored Mar 28, 2023
2 parents 1b1714d + 7fd78ca commit 8e68c07
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 40 deletions.
1 change: 1 addition & 0 deletions .nf-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ lint:
files_unchanged:
- assets/email_template.html
- assets/email_template.txt
- lib/NfcoreSchema.groovy
- lib/NfcoreTemplate.groovy
17 changes: 9 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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).

## [[3.11.0](https://github.com/nf-core/rnaseq/releases/tag/3.11.0)] - 2023-03-27
## [[3.11.0](https://github.com/nf-core/rnaseq/releases/tag/3.11.0)] - 2023-03-29

### Credits

Expand All @@ -24,16 +24,17 @@ Thank you to everyone else that has contributed by reporting bugs, enhancements
- Users can now select between `--trimmer trimgalore` (default) and `--trimmer fastp`.
- Trim Galore! specific pipeline parameters have been deprecated: `--clip_r1`, `--clip_r2`, `--three_prime_clip_r1`, `--three_prime_clip_r2` and `--trim_nextseq`
- Any additional options can now be specified via the `--extra_trimgalore_args` and `--extra_fastp_args` parameters, respectively.
- [[#663](https://github.com/nf-core/rnaseq/pull/663)] - Alternative trimming step for polyA/T removal
- [[#781](https://github.com/nf-core/rnaseq/pull/781)] - Add Warning for poly(A) libraries
- [[#878](https://github.com/nf-core/rnaseq/pull/878)] - Allow tabs in fasta header when creating decoys for salmon index
- [[#931](https://github.com/nf-core/rnaseq/pull/931)] - Save transcriptome BAM files when using `--save_umi_intermeds` / `--save_align_intermeds`
- [[#663](https://github.com/nf-core/rnaseq/issues/663)] - Alternative trimming step for polyA/T removal
- [[#781](https://github.com/nf-core/rnaseq/issues/781)] - Add Warning for poly(A) libraries
- [[#878](https://github.com/nf-core/rnaseq/issues/878)] - Allow tabs in fasta header when creating decoys for salmon index
- [[#931](https://github.com/nf-core/rnaseq/issues/931)] - Save transcriptome BAM files when using `--save_umi_intermeds` / `--save_align_intermeds`
- [[#934](https://github.com/nf-core/rnaseq/pull/934)] - Union of `ext.args` and `params.extra_star_align_args` prevents parameter clashes in the STAR module
- [[#940](https://github.com/nf-core/rnaseq/issues/940)] - Bugfix in `salmon_summarizedexperiment.r` to ensure `rbind` doesn't fail when `rowdata` has no `tx` column. See ([[#941](https://github.com/nf-core/rnaseq/pull/941)]) for details.
- [[#940](https://github.com/nf-core/rnaseq/issues/940)] - Bugfix in `salmon_summarizedexperiment.r` to ensure `rbind` doesn't fail when `rowdata` has no `tx` column.
- [[#944](https://github.com/nf-core/rnaseq/issues/944)] - Read clipping using clip_r1, clip_r2, three_prime_clip_r1, three_prime_clip_r2 disabled in 3.10
- [[#956](https://github.com/nf-core/rnaseq/pull/956)] - Implement 'auto' as default strandedness argument in `fastq_dir_to_samplesheet.py` script
- [[#960](https://github.com/nf-core/rnaseq/pull/960)] - Failure with awsbatch when running processes that are using `executor: local`
- [[#961](https://github.com/nf-core/rnaseq/pull/961)] - Add warnings to STDOUT for all skipped and failed strandedness check samples
- [[#960](https://github.com/nf-core/rnaseq/issues/960)] - Failure with awsbatch when running processes that are using `executor: local`
- [[#961](https://github.com/nf-core/rnaseq/issues/961)] - Add warnings to STDOUT for all skipped and failed strandedness check samples
- [[#975](https://github.com/nf-core/rnaseq/issues/975)] - `SALMON_INDEX` runs when using `--aligner star_rsem` even if samples have explicit strandedness
- Remove HISAT2 from automated AWS full-sized tests

### Parameters
Expand Down
3 changes: 2 additions & 1 deletion lib/NfcoreSchema.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This file holds several functions used to perform JSON parameter validation, help and summary rendering for the nf-core pipeline template.
//

import nextflow.Nextflow
import org.everit.json.schema.Schema
import org.everit.json.schema.loader.SchemaLoader
import org.everit.json.schema.ValidationException
Expand Down Expand Up @@ -177,7 +178,7 @@ class NfcoreSchema {
}

if (has_error) {
System.exit(1)
Nextflow.error('Exiting!')
}
}

Expand Down
5 changes: 3 additions & 2 deletions lib/WorkflowMain.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// This file holds several functions specific to the main.nf workflow in the nf-core/rnaseq pipeline
//

import nextflow.Nextflow

class WorkflowMain {

//
Expand Down Expand Up @@ -83,8 +85,7 @@ class WorkflowMain {

// Check input has been provided
if (!params.input) {
log.error "Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'"
System.exit(1)
Nextflow.error("Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'")
}
}
//
Expand Down
46 changes: 18 additions & 28 deletions lib/WorkflowRnaseq.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// This file holds several functions specific to the workflow/rnaseq.nf in the nf-core/rnaseq pipeline
//

import nextflow.Nextflow
import groovy.json.JsonSlurper
import groovy.text.SimpleTemplateEngine

Expand All @@ -15,13 +16,11 @@ class WorkflowRnaseq {


if (!params.fasta) {
log.error "Genome fasta file not specified with e.g. '--fasta genome.fa' or via a detectable config file."
System.exit(1)
Nextflow.error("Genome fasta file not specified with e.g. '--fasta genome.fa' or via a detectable config file.")
}

if (!params.gtf && !params.gff) {
log.error "No GTF or GFF3 annotation specified! The pipeline requires at least one of these files."
System.exit(1)
Nextflow.error("No GTF or GFF3 annotation specified! The pipeline requires at least one of these files.")
}

if (params.gtf) {
Expand All @@ -41,51 +40,43 @@ class WorkflowRnaseq {
}

if (!params.skip_bbsplit && !params.bbsplit_index && !params.bbsplit_fasta_list) {
log.error "Please provide either --bbsplit_fasta_list / --bbsplit_index to run BBSplit."
System.exit(1)
Nextflow.error("Please provide either --bbsplit_fasta_list / --bbsplit_index to run BBSplit.")
}

if (params.remove_ribo_rna && !params.ribo_database_manifest) {
log.error "Please provide --ribo_database_manifest to remove ribosomal RNA with SortMeRNA."
System.exit(1)
Nextflow.error("Please provide --ribo_database_manifest to remove ribosomal RNA with SortMeRNA.")
}


if (params.with_umi && !params.skip_umi_extract) {
if (!params.umitools_bc_pattern && !params.umitools_bc_pattern2) {
log.error "UMI-tools requires a barcode pattern to extract barcodes from the reads."
System.exit(1)
Nextflow.error("UMI-tools requires a barcode pattern to extract barcodes from the reads.")
}
}

if (!params.skip_trimming) {
if (!valid_params['trimmers'].contains(params.trimmer)) {
log.error "Invalid option: '${params.trimmer}'. Valid options for '--trimmer': ${valid_params['trimmers'].join(', ')}."
System.exit(1)
Nextflow.error("Invalid option: '${params.trimmer}'. Valid options for '--trimmer': ${valid_params['trimmers'].join(', ')}.")
}
}

if (!params.skip_alignment) {
if (!valid_params['aligners'].contains(params.aligner)) {
log.error "Invalid option: '${params.aligner}'. Valid options for '--aligner': ${valid_params['aligners'].join(', ')}."
System.exit(1)
Nextflow.error("Invalid option: '${params.aligner}'. Valid options for '--aligner': ${valid_params['aligners'].join(', ')}.")
}
} else {
if (!params.pseudo_aligner) {
log.error "--skip_alignment specified without --pseudo_aligner...please specify e.g. --pseudo_aligner ${valid_params['pseudoaligners'][0]}."
System.exit(1)
Nextflow.error("--skip_alignment specified without --pseudo_aligner...please specify e.g. --pseudo_aligner ${valid_params['pseudoaligners'][0]}.")
}
skipAlignmentWarn(log)
}

if (params.pseudo_aligner) {
if (!valid_params['pseudoaligners'].contains(params.pseudo_aligner)) {
log.error "Invalid option: '${params.pseudo_aligner}'. Valid options for '--pseudo_aligner': ${valid_params['pseudoaligners'].join(', ')}."
System.exit(1)
Nextflow.error("Invalid option: '${params.pseudo_aligner}'. Valid options for '--pseudo_aligner': ${valid_params['pseudoaligners'].join(', ')}.")
} else {
if (!(params.salmon_index || params.transcript_fasta || (params.fasta && (params.gtf || params.gff)))) {
log.error "To use `--pseudo_aligner 'salmon'`, you must provide either --salmon_index or --transcript_fasta or both --fasta and --gtf / --gff."
System.exit(1)
Nextflow.error("To use `--pseudo_aligner 'salmon'`, you must provide either --salmon_index or --transcript_fasta or both --fasta and --gtf / --gff.")
}
}
}
Expand Down Expand Up @@ -120,8 +111,7 @@ class WorkflowRnaseq {
// Check which RSeQC modules we are running
def rseqc_modules = params.rseqc_modules ? params.rseqc_modules.split(',').collect{ it.trim().toLowerCase() } : []
if ((valid_params['rseqc_modules'] + rseqc_modules).unique().size() != valid_params['rseqc_modules'].size()) {
log.error "Invalid option: ${params.rseqc_modules}. Valid options for '--rseqc_modules': ${valid_params['rseqc_modules'].join(', ')}"
System.exit(1)
Nextflow.error("Invalid option: ${params.rseqc_modules}. Valid options for '--rseqc_modules': ${valid_params['rseqc_modules'].join(', ')}")
}
}

Expand Down Expand Up @@ -159,14 +149,14 @@ class WorkflowRnaseq {
def chrom = lspl[0]
def size = lspl[1]
if (size.toInteger() > max_size) {
log.error "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
def error_string = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
" Contig longer than ${max_size}bp found in reference genome!\n\n" +
" ${chrom}: ${size}\n\n" +
" Provide the '--bam_csi_index' parameter to use a CSI instead of BAI index.\n\n" +
" Please see:\n" +
" https://github.com/nf-core/rnaseq/issues/744\n" +
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
System.exit(1)
Nextflow.error(error_string)
}
}
}
Expand Down Expand Up @@ -313,12 +303,12 @@ class WorkflowRnaseq {
//
private static void genomeExistsError(params, log) {
if (params.genomes && params.genome && !params.genomes.containsKey(params.genome)) {
log.error "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
def error_string = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
" Genome '${params.genome}' not found in any config files provided to the pipeline.\n" +
" Currently, the available genome keys are:\n" +
" ${params.genomes.keySet().join(", ")}\n" +
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
System.exit(1)
Nextflow.error(error_string)
}
}

Expand Down Expand Up @@ -384,13 +374,13 @@ class WorkflowRnaseq {
// Print a warning if using '--aligner star_rsem' and '--with_umi'
//
private static void rsemUmiError(log) {
log.error "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
def error_string = "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" +
" When using '--aligner star_rsem', STAR is run by RSEM itself and so it is\n" +
" not possible to remove UMIs before the quantification.\n\n" +
" If you would like to remove UMI barcodes using the '--with_umi' option\n" +
" please use either '--aligner star_salmon' or '--aligner hisat2'.\n" +
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
System.exit(1)
Nextflow.error(error_string)
}

//
Expand Down
8 changes: 7 additions & 1 deletion workflows/rnaseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,15 @@ workflow RNASEQ {
//
// SUBWORKFLOW: Sub-sample FastQ files and pseudo-align with Salmon to auto-infer strandedness
//
// Return empty channel if ch_strand_fastq.auto_strand is empty so salmon index isn't created
PREPARE_GENOME.out.fasta
.combine(ch_strand_fastq.auto_strand)
.map { it.first() }
.set { ch_genome_fasta }

FASTQ_SUBSAMPLE_FQ_SALMON (
ch_strand_fastq.auto_strand,
PREPARE_GENOME.out.fasta,
ch_genome_fasta,
PREPARE_GENOME.out.transcript_fasta,
PREPARE_GENOME.out.gtf,
PREPARE_GENOME.out.salmon_index,
Expand Down

0 comments on commit 8e68c07

Please sign in to comment.