Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use nf-validation plugin for parameter and samplesheet validation #1058

Merged
merged 8 commits into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## v3.13.0dev - [date]

### Credits

Special thanks to the following for their contributions to the release:

- [Adam Talbot](https://github.com/adamrtalbot)
- [Júlia Mir Pedrol](https://github.com/mirpedrol)
- [Matthias Zepper](https://github.com/MatthiasZepper)
- [Maxime Garcia](https://github.com/maxulysse)

Thank you to everyone else that has contributed by reporting bugs, enhancements or in any other way, shape or form.

### Enhancements & fixes

- [PR #1049](https://github.com/nf-core/rnaseq/pull/1049) - Display a warning when `--extra_star_align_args` are used with `--aligner star_rsem`
- [PR #1051](https://github.com/nf-core/rnaseq/pull/1051) - Remove `public_aws_ecr` profile
- [PR #1054](https://github.com/nf-core/rnaseq/pull/1054) - Template update to nf-core/tools v2.9
- [PR #1058](https://github.com/nf-core/rnaseq/pull/1058) - Use `nf-validation` plugin for parameter and samplesheet validation

## [[3.12.0](https://github.com/nf-core/rnaseq/releases/tag/3.12.0)] - 2023-06-02

Expand Down
15 changes: 10 additions & 5 deletions assets/schema_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,35 @@
"sample": {
"type": "string",
"pattern": "^\\S+$",
"errorMessage": "Sample name must be provided and cannot contain spaces"
"errorMessage": "Sample name must be provided and cannot contain spaces",
"meta": ["id"]
},
"fastq_1": {
"type": "string",
"format": "file-path",
"exists": true,
"pattern": "^\\S+\\.f(ast)?q\\.gz$",
"errorMessage": "FastQ file for reads 1 must be provided, cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'"
},
"fastq_2": {
"errorMessage": "FastQ file for reads 2 cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'",
"type": "string",
"format": "file-path",
"exists": true,
"anyOf": [
{
"type": "string",
"pattern": "^\\S+\\.f(ast)?q\\.gz$"
},
{
"type": "string",
"maxLength": 0
}
]
},
"strandedness": {
"type": "string",
"errorMessage": "Strandedness must be provided and be one of 'forward', 'reverse' or 'unstranded'",
"enum": ["forward", "reverse", "unstranded"]
"errorMessage": "Strandedness must be provided and be one of 'auto', 'forward', 'reverse' or 'unstranded'",
"enum": ["forward", "reverse", "unstranded", "auto"],
"meta": ["strandedness"]
}
},
"required": ["sample", "fastq_1", "strandedness"]
Expand Down
172 changes: 0 additions & 172 deletions bin/check_samplesheet.py

This file was deleted.

8 changes: 0 additions & 8 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@ process {
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]

withName: 'SAMPLESHEET_CHECK' {
publishDir = [
path: { "${params.outdir}/pipeline_info" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'CUSTOM_DUMPSOFTWAREVERSIONS' {
publishDir = [
path: { "${params.outdir}/pipeline_info" },
Expand Down
5 changes: 0 additions & 5 deletions lib/WorkflowMain.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ class WorkflowMain {

// Check AWS batch settings
NfcoreTemplate.awsBatch(workflow, params)

// Check input has been provided
if (!params.input) {
Nextflow.error("Please provide an input samplesheet to the pipeline e.g. '--input samplesheet.csv'")
}
}

//
Expand Down
53 changes: 28 additions & 25 deletions lib/WorkflowRnaseq.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,9 @@ class WorkflowRnaseq {
//
// Check and validate parameters
//
public static void initialise(params, log, valid_params) {
public static void initialise(params, log) {
genomeExistsError(params, log)


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

if (!params.gtf && !params.gff) {
Nextflow.error("No GTF or GFF3 annotation specified! The pipeline requires at least one of these files.")
}
Expand Down Expand Up @@ -54,27 +49,13 @@ class WorkflowRnaseq {
}
}

if (!params.skip_trimming) {
if (!valid_params['trimmers'].contains(params.trimmer)) {
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)) {
Nextflow.error("Invalid option: '${params.aligner}'. Valid options for '--aligner': ${valid_params['aligners'].join(', ')}.")
}
} else {
if (params.skip_alignment) {
skipAlignmentWarn(log)
}

if (!params.skip_pseudo_alignment && params.pseudo_aligner) {
if (!valid_params['pseudoaligners'].contains(params.pseudo_aligner)) {
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)))) {
Nextflow.error("To use `--pseudo_aligner 'salmon'`, you must provide either --salmon_index or --transcript_fasta or both --fasta and --gtf / --gff.")
}
if (!(params.salmon_index || params.transcript_fasta || (params.fasta && (params.gtf || params.gff)))) {
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 @@ -109,12 +90,34 @@ class WorkflowRnaseq {
}

// Check which RSeQC modules we are running
def valid_rseqc_modules = ['bam_stat', 'inner_distance', 'infer_experiment', 'junction_annotation', 'junction_saturation', 'read_distribution', 'read_duplication', 'tin']
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()) {
Nextflow.error("Invalid option: ${params.rseqc_modules}. Valid options for '--rseqc_modules': ${valid_params['rseqc_modules'].join(', ')}")
if ((valid_rseqc_modules + rseqc_modules).unique().size() != valid_rseqc_modules.size()) {
Nextflow.error("Invalid option: ${params.rseqc_modules}. Valid options for '--rseqc_modules': ${valid_rseqc_modules.join(', ')}")
}
}

//
// Function to validate channels from input samplesheet
//
public static ArrayList validateInput(input) {
def (metas, fastqs) = input[1..2]

// Check that multiple runs of the same sample are of the same strandedness
def strandedness_ok = metas.collect{ it.strandedness }.unique().size == 1
if (!strandedness_ok) {
Nextflow.error("Please check input samplesheet -> Multiple runs of a sample must have the same strandedness!: ${metas[0].id}")
}

// Check that multiple runs of the same sample are of the same datatype i.e. single-end / paired-end
def endedness_ok = metas.collect{ it.single_end }.unique().size == 1
if (!endedness_ok) {
Nextflow.error("Please check input samplesheet -> Multiple runs of a sample must be of the same datatype i.e. single-end or paired-end: ${metas[0].id}")
}

return [ metas[0], fastqs ]
}

//
// Function to check whether biotype field exists in GTF file
//
Expand Down
31 changes: 0 additions & 31 deletions modules/local/samplesheet_check.nf

This file was deleted.

Loading