-
Notifications
You must be signed in to change notification settings - Fork 1
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 #8 from CaroAMN/dev
new module and subworkflow test
- Loading branch information
Showing
10 changed files
with
384 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
dependencies: | ||
- "YOUR-TOOL-HERE" |
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,43 @@ | ||
|
||
process MAT2JSON { | ||
tag "$meta.id" | ||
label 'process_single' | ||
|
||
container 'carolinschwitalla/mat2json:latest' | ||
|
||
input: | ||
tuple val(meta), path(matfile) | ||
|
||
output: | ||
tuple val(meta), path("*.*"), emit: converted_file | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
||
""" | ||
/usr/bin/mlrtapp/mat2json $matfile | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
mat2json: 1.0 | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
||
""" | ||
touch ${prefix}.json | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
mat2json: 1.0 | ||
END_VERSIONS | ||
""" | ||
} |
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,55 @@ | ||
--- | ||
name: "mat2json" | ||
description: converst matlab .mat files into json or csv files. | ||
keywords: | ||
- file conversion | ||
- matlab | ||
- json | ||
- csv | ||
tools: | ||
- "mat2json": | ||
description: "converst matlab .mat files into json or csv files." | ||
homepage: "" | ||
documentation: "" | ||
tool_dev_url: "" | ||
doi: "" | ||
licence: | ||
identifier: | ||
|
||
input: | ||
# Only when we have meta | ||
- - meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1']` | ||
- mat_file: | ||
type: file | ||
description: matlab file | ||
pattern: "*.{mat}" | ||
|
||
output: | ||
- converted_file: | ||
#Only when we have meta | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- "*_conv.*": | ||
type: file | ||
description: JSON or CSV file containing the the data from the input .mat file | ||
pattern: "*.{json,csv}" | ||
|
||
- versions: | ||
- "versions.yml": | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
|
||
authors: | ||
- "@CaroAMN" | ||
maintainers: | ||
- "@CaroAMN" |
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,58 @@ | ||
nextflow_process { | ||
|
||
name "Test Process MAT2JSON" | ||
script "../main.nf" | ||
process "MAT2JSON" | ||
|
||
tag "modules" | ||
tag "modules_" | ||
tag "mat2json" | ||
|
||
test("matlab file conversion to json") { | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test'], // meta map | ||
file('/mnt/ssd/numorph_testdata_s/module_testrun/output_nextflow/intensity/results/variables/thresholds.mat', checkIfExists: true), | ||
] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
|
||
) | ||
} | ||
|
||
} | ||
|
||
test("matlab file conversion to json - stub") { | ||
|
||
options "-stub" | ||
|
||
when { | ||
process { | ||
""" | ||
input[0] = [ | ||
[ id:'test'], // meta map | ||
file('/mnt/ssd/numorph_testdata_s/module_testrun/output_nextflow/intensity/results/variables/thresholds.mat', checkIfExists: true), | ||
] | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert process.success }, | ||
{ assert snapshot(process.out).match() } | ||
) | ||
} | ||
|
||
} | ||
|
||
} |
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,80 @@ | ||
{ | ||
"matlab file conversion to json": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
[ | ||
"thresholds.json:md5,88adeb36bb657798c80085b6a58ac58b", | ||
"versions.yml:md5,d8fdb19b7f6440f3644b923cf0bf7eee" | ||
] | ||
] | ||
], | ||
"1": [ | ||
"versions.yml:md5,d8fdb19b7f6440f3644b923cf0bf7eee" | ||
], | ||
"converted_file": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
[ | ||
"thresholds.json:md5,88adeb36bb657798c80085b6a58ac58b", | ||
"versions.yml:md5,d8fdb19b7f6440f3644b923cf0bf7eee" | ||
] | ||
] | ||
], | ||
"versions": [ | ||
"versions.yml:md5,d8fdb19b7f6440f3644b923cf0bf7eee" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.9.2", | ||
"nextflow": "24.10.4" | ||
}, | ||
"timestamp": "2025-02-21T15:36:22.030027548" | ||
}, | ||
"matlab file conversion to json - stub": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
[ | ||
"test.json:md5,d41d8cd98f00b204e9800998ecf8427e", | ||
"versions.yml:md5,d8fdb19b7f6440f3644b923cf0bf7eee" | ||
] | ||
] | ||
], | ||
"1": [ | ||
"versions.yml:md5,d8fdb19b7f6440f3644b923cf0bf7eee" | ||
], | ||
"converted_file": [ | ||
[ | ||
{ | ||
"id": "test" | ||
}, | ||
[ | ||
"test.json:md5,d41d8cd98f00b204e9800998ecf8427e", | ||
"versions.yml:md5,d8fdb19b7f6440f3644b923cf0bf7eee" | ||
] | ||
] | ||
], | ||
"versions": [ | ||
"versions.yml:md5,d8fdb19b7f6440f3644b923cf0bf7eee" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.9.2", | ||
"nextflow": "24.10.4" | ||
}, | ||
"timestamp": "2025-02-21T15:36:26.450520824" | ||
} | ||
} |
8 changes: 3 additions & 5 deletions
8
subworkflows/local/numorph_preprocessing.nf → ...flows/local/numorph_preprocessing/main.nf
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,51 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json | ||
name: "numorph_preprocessing" | ||
## TODO nf-core: Add a description of the subworkflow and list keywords | ||
description: Sort SAM/BAM/CRAM file | ||
keywords: | ||
- sort | ||
- bam | ||
- sam | ||
- cram | ||
## TODO nf-core: Add a list of the modules and/or subworkflows used in the subworkflow | ||
components: | ||
- samtools/sort | ||
- samtools/index | ||
## TODO nf-core: List all of the channels used as input with a description and their structure | ||
input: | ||
- ch_bam: | ||
type: file | ||
description: | | ||
The input channel containing the BAM/CRAM/SAM files | ||
Structure: [ val(meta), path(bam) ] | ||
pattern: "*.{bam/cram/sam}" | ||
## TODO nf-core: List all of the channels used as output with a descriptions and their structure | ||
output: | ||
- bam: | ||
type: file | ||
description: | | ||
Channel containing BAM files | ||
Structure: [ val(meta), path(bam) ] | ||
pattern: "*.bam" | ||
- bai: | ||
type: file | ||
description: | | ||
Channel containing indexed BAM (BAI) files | ||
Structure: [ val(meta), path(bai) ] | ||
pattern: "*.bai" | ||
- csi: | ||
type: file | ||
description: | | ||
Channel containing CSI files | ||
Structure: [ val(meta), path(csi) ] | ||
pattern: "*.csi" | ||
- versions: | ||
type: file | ||
description: | | ||
File containing software versions | ||
Structure: [ path(versions.yml) ] | ||
pattern: "versions.yml" | ||
authors: | ||
- "@CaroAMN" | ||
maintainers: | ||
- "@CaroAMN" |
39 changes: 39 additions & 0 deletions
39
subworkflows/local/numorph_preprocessing/tests/main.nf.test
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,39 @@ | ||
nextflow_workflow { | ||
|
||
name "Test Subworkflow NUMORPH_PREPROCESSING" | ||
script "../main.nf" | ||
workflow "NUMORPH_PREPROCESSING" | ||
|
||
tag "subworkflows" | ||
tag "subworkflows_" | ||
tag "subworkflows/numorph_preprocessing" | ||
tag "numorph" | ||
tag "numorph preprocessing" | ||
tag "numorph intensity" | ||
tag "numorph align" | ||
tag "numorph stitch" | ||
|
||
|
||
test("Numorph Preprocessing") { | ||
options "-stub" | ||
|
||
when { | ||
workflow { | ||
""" | ||
input[0] = Channel.fromList([ | ||
tuple([ id:'TEST1'], | ||
file('/home/schwitalla/Documents/test-datasets/test_data/images'), | ||
file('test-datasets/test_data/parameterfiles/params_TEST1_lsmquant.csv')) | ||
]) | ||
""" | ||
} | ||
} | ||
|
||
then { | ||
assertAll( | ||
{ assert workflow.success}, | ||
{ assert snapshot(workflow.out).match()} | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.