Skip to content

Comments

add plate compression and validation notebook, helper module, and unit tests#364

Merged
AmandaBirmingham merged 8 commits intobiocore:masterfrom
AmandaBirmingham:plate_compression_notebook
Feb 23, 2026
Merged

add plate compression and validation notebook, helper module, and unit tests#364
AmandaBirmingham merged 8 commits intobiocore:masterfrom
AmandaBirmingham:plate_compression_notebook

Conversation

@AmandaBirmingham
Copy link
Collaborator

@AmandaBirmingham AmandaBirmingham commented Feb 7, 2026

This PR:

  1. adds a new sample_validation_and_plate_compression.ipynb notebook and associated unit tests
    • This centralizes the first step of most notebook workflows
    • It also addresses a longstanding request from the wet lab for a notebook they can use to validate that all the samples they have received have Qiita information without having to start prepping them first, since it can be run with an empty compression layout
  2. creates a new metapool/notebook_utils.py module that houses some helper functions used in notebooks and adds unit tests
    • NOTE that this PR doesn't remove the in-line definitions of those same functions in the matrix tube notebook. That's coming, but not yet.
  3. extends the notebook unit test helper functionality to allow it to handle input files that are expected to be nested under the test's temporary directory
    • This supports the case where autogenerated outputs from one notebook are chained into inputs of another
    • This functionality isn't in use in by anything in this PR; it is to support the next refactor ;)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “plate compression and validation” notebook plus shared helper utilities and tests to support running/validating notebook-driven workflows and comparing their generated outputs against committed fixtures.

Changes:

  • Added plate_compression_and_validation.ipynb and a corresponding notebook execution test.
  • Introduced metapool/notebook_utils.py (and unit tests) to share notebook helper functions.
  • Added new expected output fixtures for the notebook (plate_df + expt_info).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
notebooks/plate_compression_and_validation.ipynb New notebook implementing compression + controls + validation and writing outputs.
notebooks/tests/test_plate_compression_and_validation.py Executes the new notebook via the shared test harness and verifies expected outputs.
notebooks/tests/notebook_test_helpers.py Extends notebook test harness to better support auto-constructed paths and directory creation.
metapool/notebook_utils.py New shared helpers for notebooks (attribute extraction + delimiter inference).
metapool/tests/test_notebook_utils.py Unit tests for the new notebook utility helpers.
notebooks/test_output/QC/ShotgunMetag_plate_df_compvalid.txt Fixture output for plate dataframe produced by the new notebook.
notebooks/test_output/QC/ShotgunMetag_expt_info.yml Fixture output for experiment metadata produced by the new notebook.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coveralls
Copy link

coveralls commented Feb 7, 2026

Pull Request Test Coverage Report for Build 21840935318

Details

  • 222 of 237 (93.67%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 92.934%

Changes Missing Coverage Covered Lines Changed/Added Lines %
metapool/tests/test_notebook_utils.py 69 70 98.57%
notebooks/tests/test_sample_validation_and_plate_compression.py 20 21 95.24%
metapool/metapool.py 37 39 94.87%
notebooks/tests/notebook_test_helpers.py 47 58 81.03%
Totals Coverage Status
Change from base Build 21409204059: 0.2%
Covered Lines: 6997
Relevant Lines: 7529

💛 - Coveralls

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@antgonza antgonza left a comment

Choose a reason for hiding this comment

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

Looks good, thank you @AmandaBirmingham - just a few questions.

- Email: r@gmail.com
HumanFiltering: 'False'
Project Abbreviation: ADAPT
Project Name: Celeste_Adaptation_12986
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these values OK to add to a repo?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fair; as test values, these aren't exactly naughty but they also aren't exactly nice. I can't clean these values out of the whole repo, but I can stop propagating them into new test files like these.

_OUT_PARAM_VARIABLE_KEY = "param_variable"
_FILE_PATH_KEY = "is_filepath" # key for file path parameters
_AUTOCONSTRUCTED_KEY = "is_autoconstructed" # if param not set explicitly
_AUTOCONSTRUCTED_FPS_KEY = "__TestNotebook_autoconstructed_fps"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wonder if the double underscore is needed or would it be fine to only have one?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I used the double underscore to try to differentiate this even more from "real" variable names that anyone might put into a notebook (since those are essentially unconstrained and might be anything).


'studies_info': [
{
'Project Name': 'Celeste_Adaptation_12986',
Copy link
Collaborator

Choose a reason for hiding this comment

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

FWIW, as it's show in this list, in the past we used TestProjA or TestProjB and fake study ids to minimize overlap with values in qiita.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TestProjB is used here too, for one of the studies. Sadly, the two Celeste studies are completely entwined with our test data; I can change the names by which they are called in the notebook (which I have done), but to change their study ids would require modifying quite lot of known-good files. I don't think I can take that on yet ;)

@AmandaBirmingham AmandaBirmingham merged commit ca01387 into biocore:master Feb 23, 2026
2 checks passed
@AmandaBirmingham AmandaBirmingham deleted the plate_compression_notebook branch February 23, 2026 22:24
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.

3 participants