-
Notifications
You must be signed in to change notification settings - Fork 19
Improve backsub input validation and testing #83
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: dev
Are you sure you want to change the base?
Changes from all commits
a0bd93c
3ac0972
9a30e19
7a35b97
c2d8313
1e2b7ec
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,111 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
nextflow_function { | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
name "Validation behavior for pipeline inputs" | ||||||||||||||||||||||||||||||||||||||||||||||
script "../main.nf" | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
test("Error on backsub if background column is empty") { | ||||||||||||||||||||||||||||||||||||||||||||||
function "validateInputMarkersheet" | ||||||||||||||||||||||||||||||||||||||||||||||
when { | ||||||||||||||||||||||||||||||||||||||||||||||
params { | ||||||||||||||||||||||||||||||||||||||||||||||
backsub = true | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
function { | ||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||
input[0] = [ | ||||||||||||||||||||||||||||||||||||||||||||||
[marker_name:"M1", cycle_number:1, channel_number:1, exposure: 100], | ||||||||||||||||||||||||||||||||||||||||||||||
[marker_name:"M2", cycle_number:1, channel_number:2, remove: true], | ||||||||||||||||||||||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
then { | ||||||||||||||||||||||||||||||||||||||||||||||
assert function.failed | ||||||||||||||||||||||||||||||||||||||||||||||
assert function.stdout*.contains("set params.backsub=false").any() | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
test("Warn if backsub false but columns are provided") { | ||||||||||||||||||||||||||||||||||||||||||||||
function "validateInputMarkersheet" | ||||||||||||||||||||||||||||||||||||||||||||||
when { | ||||||||||||||||||||||||||||||||||||||||||||||
params { | ||||||||||||||||||||||||||||||||||||||||||||||
backsub = false | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
function { | ||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||
input[0] = [ | ||||||||||||||||||||||||||||||||||||||||||||||
[marker_name:"M1", cycle_number:1, channel_number:1, exposure: 100], | ||||||||||||||||||||||||||||||||||||||||||||||
[marker_name:"M2", cycle_number:1, channel_number:2, remove: true], | ||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for 10000 hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If adding error for params.backsub = false and remove values added since this would now fail istead of warn
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
then { | ||||||||||||||||||||||||||||||||||||||||||||||
assert function.success | ||||||||||||||||||||||||||||||||||||||||||||||
// log.warn output can't be tested yet - https://github.com/askimed/nf-test/issues/271 | ||||||||||||||||||||||||||||||||||||||||||||||
//assert function.stdout*.contains("Subtraction will NOT be performed").any() | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
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. If adding error for params.backsub = false and remove values added
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||
test("Error on backsub if background value not in marker_name") { | ||||||||||||||||||||||||||||||||||||||||||||||
function "validateInputMarkersheet" | ||||||||||||||||||||||||||||||||||||||||||||||
when { | ||||||||||||||||||||||||||||||||||||||||||||||
params { | ||||||||||||||||||||||||||||||||||||||||||||||
backsub = true | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
function { | ||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||
input[0] = [ | ||||||||||||||||||||||||||||||||||||||||||||||
[marker_name:"M1", cycle_number:1, channel_number:1, exposure:1, background: "M3"], | ||||||||||||||||||||||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
then { | ||||||||||||||||||||||||||||||||||||||||||||||
assert function.failed | ||||||||||||||||||||||||||||||||||||||||||||||
assert function.stdout*.contains("Unknown background").any() | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
test("Error on backsub if exposure time missing for foreground channel") { | ||||||||||||||||||||||||||||||||||||||||||||||
function "validateInputMarkersheet" | ||||||||||||||||||||||||||||||||||||||||||||||
when { | ||||||||||||||||||||||||||||||||||||||||||||||
params { | ||||||||||||||||||||||||||||||||||||||||||||||
backsub = true | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
function { | ||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||
input[0] = [ | ||||||||||||||||||||||||||||||||||||||||||||||
[marker_name:"M1", cycle_number:1, channel_number:1, background:"M2"], | ||||||||||||||||||||||||||||||||||||||||||||||
[marker_name:"M2", cycle_number:1, channel_number:2, exposure:1], | ||||||||||||||||||||||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
then { | ||||||||||||||||||||||||||||||||||||||||||||||
assert function.failed | ||||||||||||||||||||||||||||||||||||||||||||||
assert function.stdout*.contains("Missing exposure value for marker:").any() | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
test("Error on backsub if exposure time missing for background channel") { | ||||||||||||||||||||||||||||||||||||||||||||||
function "validateInputMarkersheet" | ||||||||||||||||||||||||||||||||||||||||||||||
when { | ||||||||||||||||||||||||||||||||||||||||||||||
params { | ||||||||||||||||||||||||||||||||||||||||||||||
backsub = true | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
function { | ||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||
input[0] = [ | ||||||||||||||||||||||||||||||||||||||||||||||
[marker_name:"M1", cycle_number:1, channel_number:1, exposure:1, background:"M2"], | ||||||||||||||||||||||||||||||||||||||||||||||
[marker_name:"M2", cycle_number:1, channel_number:2], | ||||||||||||||||||||||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||||||||||||||||||||||
""" | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
then { | ||||||||||||||||||||||||||||||||||||||||||||||
assert function.failed | ||||||||||||||||||||||||||||||||||||||||||||||
assert function.stdout*.find("Missing exposure.*background:").any() | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||
} |
Uh oh!
There was an error while loading. Please reload this page.
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.
If the remove column is provided, params.backsub is false, if just a warning is passed, MCQUANT would fail due to channel removal logic. Adding an error targeting this case