Skip to content

Commit

Permalink
Merge pull request #632 from drpatelh/attributes
Browse files Browse the repository at this point in the history
Strip out samplesheet validation for now
  • Loading branch information
drpatelh authored May 13, 2021
2 parents 5964998 + be072e4 commit d23c30f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 38 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Enhancements & fixes

* Updated pipeline template to nf-core/tools `1.14`
* Initial implementation of a standardised samplesheet JSON schema to use with user interfaces and for validation
* Only FastQ files that require to be concatenated will be passed to `CAT_FASTQ` process
* [[#449](https://github.com/nf-core/modules/pull/449)] - `--genomeSAindexNbases` will now be auto-calculated before building STAR indices
* [[#460](https://github.com/nf-core/rnaseq/issues/460)] - Auto-detect and bypass featureCounts execution if biotype doesn't exist in GTF
Expand All @@ -34,7 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* [[#604](https://github.com/nf-core/rnaseq/issues/604)] - Additional fasta with GENCODE annotation results in biotype error
* [[#610](https://github.com/nf-core/rnaseq/issues/610)] - save R objects as RDS
* [[#619](https://github.com/nf-core/rnaseq/issues/619)] - implicit declaration of the workflow in main
* [[#629](https://github.com/nf-core/modules/pull/629)] - Add and fix EditorConfig linting in entire pipeline
* [[#629](https://github.com/nf-core/rnaseq/pull/629)] - Add and fix EditorConfig linting in entire pipeline
* [[nf-core/modules#423](https://github.com/nf-core/modules/pull/423)] - Replace `publish_by_id` module option to `publish_by_meta`
* [[nextflow#2060](https://github.com/nextflow-io/nextflow/issues/2060)] - Pipeline execution hang when native task fail to be submitted

Expand Down
10 changes: 7 additions & 3 deletions assets/schema_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
"properties": {
"sample": {
"type": "string",
"pattern": "^\\S+$"
"pattern": "^\\S+$",
"errorMessage": "Sample name must be provided and cannot contain spaces"
},
"fastq_1": {
"type": "string",
"pattern": "^\\S+\\.fa?s?t?q\\.gz$"
"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'",
"anyOf": [
{
"type": "string",
"pattern": "^\\S+\\.fa?s?t?q\\.gz$"
"pattern": "^\\S+\\.f(ast)?q\\.gz$"
},
{
"type": "string",
Expand All @@ -29,6 +32,7 @@
},
"strandedness": {
"type": "string",
"errorMessage": "Strandedness must be provided and be one of 'forward', 'reverse' or 'unstranded'",
"enum": [
"forward",
"reverse",
Expand Down
3 changes: 2 additions & 1 deletion assets/schema_public_data_ids.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"type": "array",
"items": {
"type": "string",
"pattern": "^[SEPG][RAS][RXSMPAJXE][EN]?[AB]?\\d{5,9}$"
"pattern": "^[SEPG][RAS][RXSMPAJXE][EN]?[AB]?\\d{4,9}$",
"errorMessage": "Please provide a valid SRA, GEO or ENA identifier"
}
}
}
31 changes: 0 additions & 31 deletions lib/NfcoreSchema.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -177,37 +177,6 @@ class NfcoreSchema {
}
}

//
// Function to validate a file by its schema, eg. sample sheets
//
/* groovylint-disable-next-line UnusedPrivateMethodParameter */
public static void validateFile(workflow, log, params, param_name, obj, schema_filename) {
// Load the schema
InputStream inputStream = new File(getSchemaPath(workflow, schema_filename)).newInputStream()
JSONObject rawSchema = new JSONObject(new JSONTokener(inputStream))
Schema schema = SchemaLoader.load(rawSchema)

// Convert the groovy object to a JSONArray
def jsonObj = new JsonBuilder(obj)
JSONArray objJSON = new JSONArray(jsonObj.toString())

// Validate
try {
schema.validate(objJSON)
} catch (ValidationException e) {
Map colors = NfcoreTemplate.logColours(params.monochrome_logs)
println ""
println "=${colors.red}==== ERROR: Validation of '$param_name' file failed! ============================="
JSONObject exceptionJSON = e.toJSON()
println e.getMessage()
e.getCausingExceptions().stream().map(ValidationException::getMessage).forEach(System.out::println)
println "===================================================================================${colors.reset}"
println ""
System.exit(1)
}
log.debug "Validation passed: '$param_name' with '$schema_filename'"
}

//
// Beautify parameters for --help
//
Expand Down
1 change: 0 additions & 1 deletion workflows/rnaseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true

// Check mandatory parameters
if (params.input) { ch_input = file(params.input) } else { exit 1, 'Input samplesheet not specified!' }
NfcoreSchema.validateFile(workflow, log, params, '--input', file(params.input).splitCsv( header:true, sep:','), 'assets/schema_input.json')

// Check rRNA databases for sortmerna
ch_ribo_db = file(params.ribo_database_manifest)
Expand Down
1 change: 0 additions & 1 deletion workflows/sra_download.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ if (params.public_data_ids) {
} else {
exit 1, 'Input file with public database ids not specified!'
}
NfcoreSchema.validateFile(workflow, log, params, '--public_data_ids', file(params.public_data_ids).splitCsv(header:false, sep:'', strip:true), 'assets/schema_public_data_ids.json')

/*
========================================================================================
Expand Down

0 comments on commit d23c30f

Please sign in to comment.