Skip to content
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

Add automatic shell detection if not provided in image/powderaverage #50

Merged
merged 3 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/nf-neuro/image/powderaverage/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ process IMAGE_POWDERAVERAGE {
def prefix = task.ext.prefix ?: "${meta.id}"

def b0_thr = task.ext.b0_thr ? "--b0_thr ${task.ext.b0_thr}" : ''
def shells = task.ext.shells ? "--shells ${task.ext.shells}" : ''
def shells = task.ext.shells ? "--shells ${task.ext.shells}" : "--shells \$(cut -d ' ' --output-delimiter=\$'\\n' -f 1- $bval | awk -F' ' '{v=int(\$1)}{print v}' | uniq)"
Copy link
Collaborator

@AlexVCaron AlexVCaron Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scilpy script is doing this job itself, when no shell argument is supplied. It also controls for uneven bvalues, that is really hard to do in bash. Why do we need this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't remember exactly why (I should have noted it somewhere), but this fix worked. I'll try to reproduce the error and see what happens. Let's wait for merging in the meantime!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I've tried to reproduce the error again, but it seems to run fine now. I reverted the change @AlexVCaron !

def shell_thr = task.ext.shell_thr ? "--shell_thr ${task.ext.shell_thr}" : ''

if ( mask ) args += "--mask ${mask}"
Expand Down
8 changes: 5 additions & 3 deletions modules/nf-neuro/image/powderaverage/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ nextflow_process {
}
}

test("powderaverage - no mask") {
test("powderaverage - no mask and no shell") {

config "./nextflow_noshells.config"

when {
process {
Expand All @@ -49,9 +51,9 @@ nextflow_process {
}
}

test("powderaverage - with mask") {
test("powderaverage - with mask and shells") {

config "./nextflow.config"
config "./nextflow_shells.config"

when {
process {
Expand Down
20 changes: 10 additions & 10 deletions modules/nf-neuro/image/powderaverage/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"powderaverage - with mask": {
"powderaverage - with mask and shells": {
"content": [
{
"0": [
Expand Down Expand Up @@ -29,12 +29,12 @@
}
],
"meta": {
"nf-test": "0.9.0-rc1",
"nextflow": "24.04.3"
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-07-26T12:43:21.971071"
"timestamp": "2024-11-22T17:09:05.483883967"
},
"powderaverage - no mask": {
"powderaverage - no mask and no shell": {
"content": [
{
"0": [
Expand All @@ -43,7 +43,7 @@
"id": "test",
"single_end": false
},
"test_pwd_avg.nii.gz:md5,168d711e7b84fad327966ca3d49ede0f"
"test_pwd_avg.nii.gz:md5,274a0826747914aa457c5a5363abffe5"
]
],
"1": [
Expand All @@ -55,7 +55,7 @@
"id": "test",
"single_end": false
},
"test_pwd_avg.nii.gz:md5,168d711e7b84fad327966ca3d49ede0f"
"test_pwd_avg.nii.gz:md5,274a0826747914aa457c5a5363abffe5"
]
],
"versions": [
Expand All @@ -64,9 +64,9 @@
}
],
"meta": {
"nf-test": "0.9.0-rc1",
"nextflow": "24.04.3"
"nf-test": "0.9.0",
"nextflow": "24.04.4"
},
"timestamp": "2024-07-25T14:32:47.643306"
"timestamp": "2024-11-22T17:09:00.254000809"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
process {
withName: "IMAGE_POWDERAVERAGE" {
ext.b0_thr = 50
ext.shell_thr = 50
}
}