-
Notifications
You must be signed in to change notification settings - Fork 18
[WIP]: add module tensor #119
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json | ||
| name: "tensor_ratio" | ||
| channels: [] | ||
| dependencies: [] | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| process TENSOR_RATIO { | ||
| tag "$meta.id" | ||
| label 'process_single' | ||
|
|
||
| container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
| 'https://scil.usherbrooke.ca/containers/scilus_2.0.2.sif': | ||
| 'scilus/scilus:latest' }" | ||
|
|
||
| input: | ||
| tuple val(meta), path(image) | ||
|
|
||
| output: | ||
| tuple val(meta), path("*_Dxx_to_Dyy.nii.gz") , emit: tensor_x_to_y | ||
| tuple val(meta), path("*_Dxx_to_Dzz.nii.gz") , emit: tensor_x_to_z | ||
|
Comment on lines
+13
to
+14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel the names |
||
| path "versions.yml" , emit: versions | ||
|
|
||
| when: | ||
| task.ext.when == null || task.ext.when | ||
|
|
||
| script: | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
|
||
| """ | ||
| fslsplit $image | ||
| fslmaths ${image}_0000.nii.gz -div ${image}_0003.nii.gz ${prefix}_Dxx_to_Dyy.nii.gz | ||
| fslmaths ${image}_0000.nii.gz -div ${image}_0005.nii.gz ${prefix}_Dxx_to_Dzz.nii.gz | ||
|
|
||
| cat <<-END_VERSIONS > versions.yml | ||
| "${task.process}": | ||
| fsl: \$(fslsplit -version 2>&1 | sed -n 's/FSLSPLIT version \\([0-9.]\\+\\)/\\1/p') | ||
| END_VERSIONS | ||
| """ | ||
|
|
||
| stub: | ||
| def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
|
||
| """ | ||
| touch ${prefix}_Dxx_to_Dyy.nii.gz | ||
| touch ${prefix}_Dxx_to_Dzz.nii.gz | ||
| fslsplit | ||
| fslmaths | ||
|
|
||
| cat <<-END_VERSIONS > versions.yml | ||
| "${task.process}": | ||
| fsl: \$(fslsplit -version 2>&1 | sed -n 's/FSLSPLIT version \\([0-9.]\\+\\)/\\1/p') | ||
| END_VERSIONS | ||
| """ | ||
| } | ||
| 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/modules/meta-schema.json | ||
| name: "tensor_ratio" | ||
| description: Split the tensor image and compute the ratio of Dxx to Dyy and Dxx to Dzz for ALPS. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specify to which convention the tensor image must abide to (I assume it's FSL). Something like : The tensor elements must be ordered following convention, that is : Dxx, Dxy, Dxz, Dyy, Dyz, Dzz. |
||
| keywords: | ||
| - DWI | ||
| - tensor | ||
| - DTI-ALPS | ||
| tools: | ||
| - "FSL": | ||
| description: "FSL Toolbox" | ||
| homepage: "https://fsl.fmrib.ox.ac.uk/fsl/fslwiki" | ||
|
|
||
| input: | ||
| - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'test', single_end:false ]` | ||
|
|
||
| - image: | ||
| type: file | ||
| description: Nifti tensor image volume to extract Dx to Dy and Dx to Dz. | ||
| pattern: "*.{nii,nii.gz}" | ||
|
|
||
| output: | ||
| - meta: | ||
| type: map | ||
| description: | | ||
| Groovy Map containing sample information | ||
| e.g. `[ id:'test', single_end:false ]` | ||
|
|
||
| - tensor_x_to_y: | ||
| type: file | ||
| description: Nifti volume ratio of Dxx to Dyy. | ||
| pattern: "*_Dxx_to_Dyy.{nii,nii.gz}" | ||
|
|
||
| - tensor_x_to_z: | ||
| type: file | ||
| description: Nifti volume ratio of Dxx to Dzz. | ||
| pattern: "*_Dxx_to_Dzz.{nii,nii.gz}" | ||
|
|
||
| - versions: | ||
| type: file | ||
| description: File containing software versions | ||
| pattern: "versions.yml" | ||
|
|
||
| authors: | ||
| - "@atsuch" | ||
| maintainers: | ||
| - "@atsuch" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove the |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| // TODO nf-core: Once you have added the required tests, please run the following command to build this file: | ||
| // nf-core modules test tensor/ratio | ||
| nextflow_process { | ||
|
|
||
| name "Test Process TENSOR_RATIO" | ||
| script "../main.nf" | ||
| process "TENSOR_RATIO" | ||
|
|
||
| tag "modules" | ||
| tag "modules_nfcore" | ||
| tag "tensor" | ||
| tag "tensor/ratio" | ||
|
|
||
| tag "subworkflows" | ||
| tag "subworkflows/load_test_data" | ||
|
|
||
| setup { | ||
| run("LOAD_TEST_DATA", alias: "LOAD_DATA") { | ||
| script "../../../../../subworkflows/nf-neuro/load_test_data/main.nf" | ||
| process { | ||
| """ | ||
| input[0] = Channel.from( [ "dti.zip" ] ) | ||
| input[1] = "test.load-test-data" | ||
| """ | ||
| } | ||
| } | ||
| } | ||
| test("tensorratio - classic") { | ||
| when { | ||
| process { | ||
| """ | ||
| input[0] = LOAD_DATA.out.test_data_directory.map{ | ||
| test_data_directory -> [ | ||
| [ id:'test', single_end:false ], // meta map | ||
| file("\${test_data_directory}/dti/tensor.nii.gz") | ||
| ] | ||
| } | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert process.success }, | ||
| { assert snapshot(process.out).match() } | ||
| ) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. | ||
| test("tensorratio - stub") { | ||
|
|
||
| options "-stub" | ||
|
|
||
| when { | ||
| process { | ||
| """ | ||
| input[0] = LOAD_DATA.out.test_data_directory.map{ | ||
| test_data_directory -> [ | ||
| [ id:'test', single_end:false ], // meta map | ||
| file("\${test_data_directory}/dti/tensor.nii.gz") | ||
| ] | ||
| } | ||
| """ | ||
| } | ||
| } | ||
|
|
||
| then { | ||
| assertAll( | ||
| { assert process.success }, | ||
| { assert snapshot(process.out).match() } | ||
| ) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This snapshot will have to be updated |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| { | ||
| "tensorratio - classic": { | ||
| "content": [ | ||
| { | ||
| "0": [ | ||
|
|
||
| ], | ||
| "1": [ | ||
|
|
||
| ], | ||
| "2": [ | ||
|
|
||
| ], | ||
| "tensor_x_to_y": [ | ||
|
|
||
| ], | ||
| "tensor_x_to_z": [ | ||
|
|
||
| ], | ||
| "versions": [ | ||
|
|
||
| ] | ||
| } | ||
| ], | ||
| "meta": { | ||
| "nf-test": "0.9.0", | ||
| "nextflow": "24.10.4" | ||
| }, | ||
| "timestamp": "2025-02-27T14:05:10.553221131" | ||
| }, | ||
| "tensorratio - stub": { | ||
| "content": [ | ||
| { | ||
| "0": [ | ||
|
|
||
| ], | ||
| "1": [ | ||
|
|
||
| ], | ||
| "2": [ | ||
|
|
||
| ], | ||
| "tensor_x_to_y": [ | ||
|
|
||
| ], | ||
| "tensor_x_to_z": [ | ||
|
|
||
| ], | ||
| "versions": [ | ||
|
|
||
| ] | ||
| } | ||
| ], | ||
| "meta": { | ||
| "nf-test": "0.9.0", | ||
| "nextflow": "24.10.4" | ||
| }, | ||
| "timestamp": "2025-02-27T14:05:28.311339916" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| tensor/ratio: | ||
| - "modules/nf-neuro/tensor/ratio/**" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think the ratio of
yonzcould be interesting for someone ? If so, please add it to the module.