-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #236 from atrigila/add_samplesheet_generation
- Loading branch information
Showing
19 changed files
with
224 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
process FASTQ_TO_SAMPLESHEET { | ||
tag "$meta.id" | ||
|
||
executor 'local' | ||
memory 100.MB | ||
|
||
input: | ||
val meta | ||
val pipeline | ||
val strandedness | ||
|
||
output: | ||
tuple val(meta), path("*samplesheet.csv"), emit: samplesheet | ||
|
||
exec: | ||
|
||
// Add relevant fields to the map | ||
def pipeline_map = [ | ||
sample : meta.samplename, | ||
fastq_1 : meta.fastq_1 | ||
] | ||
|
||
// Add fastq_2 if it's a paired-end sample | ||
if (!meta.single_end) { | ||
pipeline_map.fastq_2 = meta.fastq_2 | ||
} | ||
|
||
// Add pipeline-specific entries | ||
if (pipeline == 'rnaseq') { | ||
pipeline_map << [ strandedness: strandedness ] | ||
} else if (pipeline == 'atacseq') { | ||
pipeline_map << [ replicate: 1 ] | ||
} else if (pipeline == 'taxprofiler') { | ||
pipeline_map << [ fasta: '' ] | ||
} | ||
|
||
// Create the samplesheet content | ||
def samplesheet = pipeline_map.keySet().collect { '"' + it + '"' }.join(",") + '\n' | ||
samplesheet += pipeline_map.values().collect { '"' + it + '"' }.join(",") | ||
|
||
// Write samplesheet to file | ||
def samplesheet_file = task.workDir.resolve("${meta.id}.samplesheet.csv") | ||
samplesheet_file.text = samplesheet | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
nextflow_process { | ||
|
||
name "Test Process FASTQ_TO_SAMPLESHEET" | ||
script "../main.nf" | ||
process "FASTQ_TO_SAMPLESHEET" | ||
|
||
tag "modules" | ||
tag "modules_local" | ||
tag "fastq_to_samplesheet" | ||
|
||
test("Should run without failures") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = Channel.of([[id:'Sample1_S1_L001', samplename:'Sample1', fcid:'220422_M11111_0222_000000000-K9H97', lane:'1', empty:false, single_end:true, fastq_1:'Sample1_S1_L001_R1_001.fastq.gz']]) | ||
input[1] = 'rnaseq' | ||
input[2] = 'auto' | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
modules/local/fastq_to_samplesheet/tests/main.nf.test.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"Should run without failures": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
[ | ||
{ | ||
"id": "Sample1_S1_L001", | ||
"samplename": "Sample1", | ||
"fcid": "220422_M11111_0222_000000000-K9H97", | ||
"lane": "1", | ||
"empty": false, | ||
"single_end": true, | ||
"fastq_1": "Sample1_S1_L001_R1_001.fastq.gz" | ||
} | ||
], | ||
"[Sample1_S1_L001].samplesheet.csv:md5,bc779a8b2302a093cbb04a118bb5c90f" | ||
] | ||
], | ||
"samplesheet": [ | ||
[ | ||
[ | ||
{ | ||
"id": "Sample1_S1_L001", | ||
"samplename": "Sample1", | ||
"fcid": "220422_M11111_0222_000000000-K9H97", | ||
"lane": "1", | ||
"empty": false, | ||
"single_end": true, | ||
"fastq_1": "Sample1_S1_L001_R1_001.fastq.gz" | ||
} | ||
], | ||
"[Sample1_S1_L001].samplesheet.csv:md5,bc779a8b2302a093cbb04a118bb5c90f" | ||
] | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.8.4", | ||
"nextflow": "24.04.4" | ||
}, | ||
"timestamp": "2024-08-09T22:00:18.282617632" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.