-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b0e8e00
commit 43e0721
Showing
7 changed files
with
221 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json | ||
name: "bundle_coloring" | ||
channels: | ||
- Docker | ||
- Apptainer | ||
dependencies: | ||
- "scilpy" |
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,53 @@ | ||
import groovy.json.JsonOutput | ||
|
||
process BUNDLE_COLORING { | ||
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:2.0.2' }" | ||
|
||
input: | ||
tuple val(meta), path(bundles) | ||
|
||
output: | ||
tuple val(meta), path("*_colored.trk") , emit: bundles | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
def json_str = JsonOutput.toJson(task.ext.colors) | ||
String bundles_list = bundles.join(", ").replace(',', '') | ||
|
||
""" | ||
echo '$json_str' >> colors.json | ||
scil_tractogram_assign_uniform_color.py --dict_colors colors.json \ | ||
--out_suffix "_colored" $bundles_list | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
scilpy: \$(pip list --disable-pip-version-check --no-python-version-warning | grep scilpy | tr -s ' ' | cut -d' ' -f2) | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
|
||
""" | ||
for bundle in $bundles_list; do | ||
bname=\$(basename \$bundle .\${ext}) | ||
touch \${bname}_colored.trk | ||
done | ||
scil_tractogram_assign_uniform_color.py -h | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
scilpy: \$(pip list --disable-pip-version-check --no-python-version-warning | grep scilpy | tr -s ' ' | cut -d' ' -f2) | ||
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,45 @@ | ||
--- | ||
name: "bundle_coloring" | ||
description: Assign color to bundles. | ||
keywords: | ||
- Bundles | ||
- Coloring | ||
- Tractometry | ||
tools: | ||
- "scilpy": | ||
description: "The Sherbrooke Connectivity Imaging Lab (SCIL) Python dMRI processing toolbox." | ||
homepage: "https://github.com/scilus/scilpy.git" | ||
|
||
input: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- bundles: | ||
type: file | ||
description: Flatten list of trk files containing bundles to be colored. | ||
pattern: "*.trk" | ||
|
||
output: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. `[ id:'sample1', single_end:false ]` | ||
- bundles: | ||
type: file | ||
description: Colored bundles file. | ||
pattern: "*_colored.trk" | ||
|
||
- versions: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
|
||
authors: | ||
- "@gagnonanthony" | ||
maintainers: | ||
- "@gagnonanthony" |
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,46 @@ | ||
nextflow_process { | ||
|
||
name "Test Process BUNDLE_COLORING" | ||
script "../main.nf" | ||
process "BUNDLE_COLORING" | ||
config "./nextflow.config" | ||
|
||
tag "modules" | ||
tag "modules_nfcore" | ||
tag "bundle" | ||
tag "bundle/coloring" | ||
|
||
tag "subworkflows/load_test_data" | ||
|
||
test("bundle - coloring") { | ||
setup { | ||
run("LOAD_TEST_DATA", alias: "LOAD_DATA") { | ||
script "../../../../../subworkflows/nf-scil/load_test_data/main.nf" | ||
process { | ||
""" | ||
input[0] = Channel.from( [ "bundles.zip" ] ) | ||
input[1] = "test.load-test-data" | ||
""" | ||
} | ||
} | ||
} | ||
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}/fibercup_atlas/subj_1/*.trk", 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,53 @@ | ||
{ | ||
"bundle - coloring": { | ||
"content": [ | ||
{ | ||
"0": [ | ||
[ | ||
{ | ||
"id": "test", | ||
"single_end": false | ||
}, | ||
[ | ||
"bundle_0_colored.trk:md5,28654c91d0f6c5e3f3a7f101f7fd482d", | ||
"bundle_1_colored.trk:md5,3b58a00009f2bb24c4051dd88d53aeee", | ||
"bundle_2_colored.trk:md5,21d955afc36acfd8b214e562b199f929", | ||
"bundle_3_colored.trk:md5,5ce663fb79ad52f1b30fe462d5b48afe", | ||
"bundle_4_colored.trk:md5,da36a33cbaa5e38801480b51ee2943b4", | ||
"bundle_5_colored.trk:md5,0c2cd57e4372c2b71274cafc03d82490", | ||
"bundle_6_colored.trk:md5,0614ea97e6f1fa44e40cef2c2c67a4b1" | ||
] | ||
] | ||
], | ||
"1": [ | ||
"versions.yml:md5,99caf95a695ad5ae4c7e8e879af86b5a" | ||
], | ||
"bundles": [ | ||
[ | ||
{ | ||
"id": "test", | ||
"single_end": false | ||
}, | ||
[ | ||
"bundle_0_colored.trk:md5,28654c91d0f6c5e3f3a7f101f7fd482d", | ||
"bundle_1_colored.trk:md5,3b58a00009f2bb24c4051dd88d53aeee", | ||
"bundle_2_colored.trk:md5,21d955afc36acfd8b214e562b199f929", | ||
"bundle_3_colored.trk:md5,5ce663fb79ad52f1b30fe462d5b48afe", | ||
"bundle_4_colored.trk:md5,da36a33cbaa5e38801480b51ee2943b4", | ||
"bundle_5_colored.trk:md5,0c2cd57e4372c2b71274cafc03d82490", | ||
"bundle_6_colored.trk:md5,0614ea97e6f1fa44e40cef2c2c67a4b1" | ||
] | ||
] | ||
], | ||
"versions": [ | ||
"versions.yml:md5,99caf95a695ad5ae4c7e8e879af86b5a" | ||
] | ||
} | ||
], | ||
"meta": { | ||
"nf-test": "0.9.0-rc1", | ||
"nextflow": "24.04.3" | ||
}, | ||
"timestamp": "2024-09-10T15:52:32.023077" | ||
} | ||
} |
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,14 @@ | ||
process { | ||
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } | ||
withName: "BUNDLE_COLORING" { | ||
ext.colors = [ | ||
"bundle_0":"0xd9bd09", | ||
"bundle_1":"0xcc0000", | ||
"bundle_2":"0xffdf0f", | ||
"bundle_3":"0x0d6cbf", | ||
"bundle_4":"0xbf0099", | ||
"bundle_5":"0xf20505", | ||
"bundle_6":"0x9ad909" | ||
] | ||
} | ||
} |
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,2 @@ | ||
bundle/coloring: | ||
- "modules/nf-scil/bundle/coloring/**" |