Give a hand-built object a public way onto the API surface - #101
Merged
Merged
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #101 +/- ##
==========================================
+ Coverage 89.05% 89.50% +0.44%
==========================================
Files 80 81 +1
Lines 5884 6267 +383
==========================================
+ Hits 5240 5609 +369
- Misses 644 658 +14
🚀 New features to boost your workflow:
|
io.stamp records the schema version and the resolution on an AnnData that did not come from a reader here: a published h5ad, another pipeline's output, or a matrix of learned embeddings with its metadata. io.validate reported whether an object satisfied the contract, but nothing public established it, so tutorial 10 reached into mantispy._core.schema to do it. It refuses a resolution whose required obs columns are absent, rather than stamping and pushing the failure into whichever tool ran next, and it fills the feature-annotation columns var does not already have by parsing the feature names. Names that are not CellProfiler feature names parse as empty, which is what a learned embedding is: without those columns a stamped embedding failed validation on ten counts and io.write, which validates first, could not write it at all. Closes #37.
The feature-name parser does not leave a name it cannot read alone. It reads openphenom_nahualX_17, the name JUMP-Lite ships, as the nahualX group of an openphenom object, so stamping an embedding gave it feature families named after the model's own tensors, which is what tl.feature_signature and pl.effect_sizes group by. _core.features.empty_annotation supplies the schema's annotation columns with nothing in them, for features that are not CellProfiler measurements. The test now uses the names JUMP-Lite actually ships; it passed before only because it used emb_0, whose object happens to parse as missing while its feature group does not. A second test pins that a parsed annotation survives being stamped again.
Sphinx resolves the role against the public module, so the reference had nowhere to point and the docs build, which treats warnings as errors, failed. Three words are also less work for the reader than following a link.
timtreis
force-pushed
the
feat/public-stamp
branch
from
September 20, 2026 22:45
701d8a9 to
8b612a0
Compare
The well default silently demoted a re-stamped cell-resolution subset, and tl.aggregate then takes the non-cell branch, fills Metadata_CellCount with NaN and so disables its own min_cells filter. Passing no resolution now keeps what is recorded. The obs check moved above the copy, so a rejected call no longer duplicates the matrix first, and the note says who checks X's dtype.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
io.stamprecords the schema version and the resolution on anAnnDatathat did not come from a reader here: a published h5ad, another pipeline's output, a subset assembled in a notebook, or a matrix of learned embeddings with its metadata alongside.io.validatereported whether an object satisfied the contract; nothing public established it, sodocs/tutorials/10_differential_features.ipynbimportedmantispy._core.schema.stampto do it.It refuses a resolution whose required
obscolumns are absent, instead of stamping and pushing the failure into whichever tool runs next.It also fills the feature-annotation columns
vardoes not already have, by parsing the feature names; columns already present are untouched. This matters for embeddings: a name that is not a CellProfiler feature name parses as empty, and without those columns a stamped embedding failed validation on ten counts, soio.write— which validates first — could not write it at all. The test covers that round trip, and it caught a second failure, where the annotation has to stay categorical or h5py rejects an object array of NaN.The private
_core.schema.stampis unchanged and still used internally, where several callers legitimately record the version beforeobsis complete.Closes #37, and removes one of the six private imports listed in #38.
Verified: 800 tests pass, mypy, ruff and the formatters clean.