Adding shape validation for add_matrix_to_collection#4258
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4258 +/- ##
===========================================
+ Coverage 76.12% 89.45% +13.32%
===========================================
Files 233 61 -172
Lines 32559 7176 -25383
Branches 1240 0 -1240
===========================================
- Hits 24786 6419 -18367
+ Misses 7349 757 -6592
+ Partials 424 0 -424
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
71f98e2 to
b37b395
Compare
bkmartinjr
left a comment
There was a problem hiding this comment.
target shape determination is based upon the axis dataframe, not X['data']
727dddb to
260630c
Compare
bkmartinjr
left a comment
There was a problem hiding this comment.
Two items that definitely need fix:
- obsp/varp checks are incorrect - see inline note
- need to test pre-1.15 (old-style shape)
There are other suggested fixes also noted inline
3d54161 to
6d6cb26
Compare
6d6cb26 to
08cb444
Compare
There was a problem hiding this comment.
Couple of requests:
- Need a test case that covers pre-1.15 experiment, schema validation on, and a "good" layer being added. Ie. a case that should succeed
- The handling of pre-1.15 data appears to get the wrong result for its shape, so schema validation on an old Experiment will always fail. See inline comments on this bug.
d4917cd to
6e4f91e
Compare
bkmartinjr
left a comment
There was a problem hiding this comment.
Two tiny nits in the tests. Would be great if you can fix as they are super easy.
Otherwise, it LGTM.
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release-2.2 release-2.2
# Navigate to the new working tree
cd .worktrees/backport-release-2.2
# Create a new branch
git switch --create backport-4258-to-release-2.2
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 2d91da66948febfcd128c6d27e90aa4227e27dc7
# Push it to GitHub
git push --set-upstream origin backport-4258-to-release-2.2
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release-2.2Then, create a pull request where the |
* Adding shape validation for add_matrix_to_collection * Adding test for add_X_layer * Add context to the validation function * Schema validation optional default False * PR fixes * PR fixes vol 2 * Adding all versions in tests * Adding full docstrings * Add entry in HISTORY.md * Minor fixes for PR * Opening internal var dataframe in read mode when writing & text fix * PR fixes - timestamp, closed property * Add unit tests for previous versions * PR comments * PR comments * Add warning instead of log msg * Rebase with main * Final misc * Match argument to all tests (cherry picked from commit 2d91da6)
* Adding shape validation for add_matrix_to_collection * Adding test for add_X_layer * Add context to the validation function * Schema validation optional default False * PR fixes * PR fixes vol 2 * Adding all versions in tests * Adding full docstrings * Add entry in HISTORY.md * Minor fixes for PR * Opening internal var dataframe in read mode when writing & text fix * PR fixes - timestamp, closed property * Add unit tests for previous versions * PR comments * PR comments * Add warning instead of log msg * Rebase with main * Final misc * Match argument to all tests (cherry picked from commit 2d91da6) Co-authored-by: Konstantinos Tsitsimpikos <[email protected]>
Issue and/or context:
The SOMA specification defines strict requirements for the shape of layers within pre-defined collections:
Where
Ois the domain ofobs.soma_joinid,Vis the domain ofvar.soma_joinidin the containingSOMAMeasurement, andMis user-defined.However, the
soma.io.add_matrix_to_collection()andsoma.io.add_X_layer()functions do not validate the shape of incoming matrices.Changes:
add_matrix_to_collectionandadd_X_layerNotes for Reviewer:
**DEFAULT BEHAVIOR: schema_validation = True **