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

Issue 950: samplesheet validation - no spaces in sample or patient names #978

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions .github/workflows/pytest-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ jobs:
tags: concatenate_vcfs
- profile: "singularity"
tags: merge
- profile: "singularity"
tags: validation_checks
- profile: "conda"
tags: validation_checks
env:
NXF_ANSI_LOG: false
TEST_DATA_BASE: "${{ github.workspace }}/test-datasets"
Expand Down
1 change: 1 addition & 0 deletions 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
- [#954](https://github.com/nf-core/sarek/pull/954) - Adding keys for annotation with snpeff and ensemblvep for `hg19`, `hg38` and `mm10`
- [#967](https://github.com/nf-core/sarek/pull/967) - Adding new `outdir_cache` params
- [#971](https://github.com/nf-core/sarek/pull/971) - Subtle bugfix to correct mutation of FASTP output channel objects.
- [#978](https://github.com/nf-core/sarek/pull/978) - Validate that patient/sample does not contain spaces.

### Changed

Expand Down
10 changes: 10 additions & 0 deletions tests/config/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ skip_markduplicates:
- tests/test_skip_markduplicates.yml
- workflows/**

validation_checks:
- conf/modules/**
- main.nf
- modules/**
- nextflow.config
- nextflow_schema.json
- subworkflows/**
- tests/test_skip_markduplicates.yml
- workflows/**

# preprocessing

## alignment_to_fastq
Expand Down
3 changes: 3 additions & 0 deletions tests/csv/3.0/sample_with_space.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
patient,sex,status,sample,lane,fastq_1,fastq_2
test,XX,0,test,test_L1,https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/fastq/test_1.fastq.gz,https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/fastq/test_2.fastq.gz
test,XX,1,test 2,test_L1,https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/fastq/test2_1.fastq.gz,https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/illumina/fastq/test2_2.fastq.gz
9 changes: 9 additions & 0 deletions tests/test_samplesheet_validation_spaces.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- name: Test that pipeline fail when sample/patient name contain space
command: nextflow run main.nf -profile test --input ./tests/csv/3.0/sample_with_space.csv --outdir results
tags:
- sample_with_space
matrulda marked this conversation as resolved.
Show resolved Hide resolved
- validation_checks
exit_code: 1
stdout:
contains:
- "Invalid value in csv file. Values for 'patient' and 'sample' can not contain space"
4 changes: 4 additions & 0 deletions workflows/sarek.nf
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,10 @@ def extract_csv(csv_file) {
log.error "Missing field in csv file header. The csv file must have fields named 'patient' and 'sample'."
System.exit(1)
}
else if (row.patient.contains(" ") || row.sample.contains(" ")) {
log.error "Invalid value in csv file. Values for 'patient' and 'sample' can not contain space."
System.exit(1)
}
[ [ row.patient.toString(), row.sample.toString() ], row ]
}.groupTuple()
.map{ meta, rows ->
Expand Down