Skip to content

Commit

Permalink
Added logic to check if grouping variable matches what is in the inpu…
Browse files Browse the repository at this point in the history
…t csv file, and added a test samplesheet with grouping
  • Loading branch information
harmonbhasin committed Nov 25, 2024
1 parent 52d0fbd commit 1605620
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test-data/grouping-samplesheet.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sample,fastq_1,fastq_2,group
gold_standard,s3://nao-testing/gold-standard-test/raw/gold_standard_R1.fastq.gz,s3://nao-testing/gold-standard-test/raw/gold_standard_R2.fastq.gz,gold_standard
10 changes: 10 additions & 0 deletions workflows/run.nf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ workflow RUN {
kraken_db_path = "${params.ref_dir}/results/kraken_db"
blast_db_path = "${params.ref_dir}/results/${params.blast_db_prefix}"

// Check if grouping column exists in samplesheet
check_grouping = new File(params.sample_sheet).text.readLines()[0].contains('group') ? true : false
if (params.grouping != check_grouping) {
if (params.grouping && !check_grouping) {
throw new Exception("Grouping column not found in samplesheet")
} else if (!params.grouping && check_grouping) {
throw new Exception("Grouping column found in samplesheet but not requested")
}
}

// Prepare samplesheet
if ( params.grouping ) {
samplesheet = Channel
Expand Down

0 comments on commit 1605620

Please sign in to comment.