8000 Improve backsub input validation and testing by jmuhlich · Pull Request #83 · nf-core/mcmicro · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

jmuhlich
Copy link
Member

Rework of #82. Original features retained:

  • Make remove column non-required.
  • Don't allow backsub to run if no channels are linked to their respective background channels in the markersheet.
  • Im 8000 plement correct validation behavior for backsub-related markersheet columns. Error messages include marker_name or other identifying information to help the user find the problem more easily.
  • Drop rows marked with remove from markersheet before generating input markersheet for quantification so that markersheet rows match up with image channels.
  • Add tests for backsub input validation checks.
  • Fix backsub test case in workflow test so it actually triggers backsub properly.

Updates relative to the original PR:

  • Simplify markersheet handling by marking all fields in the schema as meta with a default value of null. Update all relevant places in the code and tests to use these maps instead of the old lists.
  • Streamline error checking code branching structure in backsub input validation.
  • Harmonize error messages with common nf-core practice and improved internal consistency.
  • Port markersheet validation tests from workflow to function tests for easier input management (inputs can then be defined inline in the test script rather than requiring a discrete csv file).

PR checklist

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • Make sure your code lints (nf-core pipelines lint).
  • Ensure the test suite passes (nextflow run . -profile test,docker --outdir <OUTDIR>).
  • Check for unexpected warnings in debug mode (nextflow run . -profile debug,test,docker --outdir <OUTDIR>).

jmuhlich and others added 5 commits April 22, 2025 18:57
Co-authored-by: Krešimir Beštak <kbestak@gmail.com>
Co-authored-by: Krešimir Beštak <kbestak@gmail.com>
Co-authored-by: Krešimir Beštak <kbestak@gmail.com>
Co-authored-by: Krešimir Beštak <kbestak@gmail.com>
@jmuhlich jmuhlich requested a review from kbestak April 22, 2025 23:18
Copy link
Contributor
@kbestak kbestak left a comment

Choose a reason for hiding this comment

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

Hey @jmuhlich, thank you for making time to add the changes. This is a very nice and elegant approach that allows the markersheet to be expanded in the future in a very straightforward and logical manner.

I've only noticed that if remove values are given and backsub is set to false, a warning is given, but the pipeline fails on MCQUANT due to the remove marker logic on the nextflow side. My suggestion would be to throw an error for this case as you can see above.

Looks good to me! 🚀

Comment on lines +216 to +217
def backsub_columns = ['exposure', 'background', 'remove']
if (markersheet_data*.subMap(backsub_columns)*.collect{ c, v -> v != null }.flatten().any()) {
Copy link
Contributor
@kbestak kbestak May 2, 2025

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

Suggested change
def backsub_columns = ['exposure', 'background', 'remove']
if (markersheet_data*.subMap(backsub_columns)*.collect{ c, v -> v != null }.flatten().any()) {
def backsub_columns = ['exposure', 'background']
if (markersheet_data*.subMap('remove')*.collect{ c, v -> v != null }.flatten().any()) {
error("The remove column is present in the marker sheet, but params.backsub is set to false. Please set params.backsub to true or remove TRUE values from the remove column.")
}
else if (markersheet_data*.subMap(backsub_columns)*.collect{ c, v -> v != null }.flatten().any()) {

//assert function.stdout*.contains("Subtraction will NOT be performed").any()
}
}

Copy link
Contributor
@kbestak kbestak May 2, 2025

Choose a reason for hiding this comment

The 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 if backsub false but remove is provided") {
function "validateInputMarkersheet"
when {
params {
backsub = true
}
function {
"""
input[0] = [
[marker_name:"M1", cycle_number:1, channel_number:1, remove: true],
]
"""
}
}
then {
assert function.failed
assert function.stdout*.contains("The remove column is present in the marker sheet").any()
}
}

"""
input[0] = [
[marker_name:"M1", cycle_number 96F8 :1, channel_number:1, exposure: 100],
[marker_name:"M2", cycle_number:1, channel_number:2, remove: true],
Copy link
Contributor

Choose a reason for hiding this comment

The 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
[marker_name:"M2", cycle_number:1, channel_number:2, remove: true],
[marker_name:"M2", cycle_number:1, channel_number:2, background:"M1"],

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0