single-cell-data / TileDB-SOMA

Python and R SOMA APIs using TileDB’s cloud-native format. Ideal for single-cell data at any scale.
https://tiledbsoma.readthedocs.io
MIT License
90 stars 25 forks source link

[c++] Resize for variant-indexed `DataFrame` #2917

Closed johnkerl closed 1 month ago

johnkerl commented 2 months ago

Issue and/or context: This follows on #2917 for issue #2407 / [sc-51048]. Here we implement resize.

Note that the intended Python and R API changes are all agreed on and finalized as described in #2407.

Changes:

While SOMASparseNDArray and SOMADenseNDArray must always and only have int64 dims within the SOMA data model, SOMADataFrame is different. The default behavior -- which almost everyone uses -- has a single soma_joinid dim which is indeed of type int64. (Also note that exp.obs.shape does exist within TileDB-SOMA-Py, and people do call it.) However, the spec only requires that soma_joinid exist as a dim or an attr: it can be a dim along with others, or it can not be a dim at all. Here we do the right thing, without and with current-domain support, to allow people to resize the soma_joinid dim, and only that, whether it's the sole dimension, a dimension but not the sole one, or not a dim at all.

Notes for Reviewer:

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 90.02%. Comparing base (f5ae258) to head (0c863d9). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2917 +/- ## ========================================== + Coverage 89.87% 90.02% +0.15% ========================================== Files 38 38 Lines 3999 3999 ========================================== + Hits 3594 3600 +6 + Misses 405 399 -6 ``` | [Flag](https://app.codecov.io/gh/single-cell-data/TileDB-SOMA/pull/2917/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=single-cell-data) | Coverage Δ | | |---|---|---| | [python](https://app.codecov.io/gh/single-cell-data/TileDB-SOMA/pull/2917/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=single-cell-data) | `90.02% <ø> (+0.15%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=single-cell-data#carryforward-flags-in-the-pull-request-comment) to find out more. | [Components](https://app.codecov.io/gh/single-cell-data/TileDB-SOMA/pull/2917/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=single-cell-data) | Coverage Δ | | |---|---|---| | [python_api](https://app.codecov.io/gh/single-cell-data/TileDB-SOMA/pull/2917/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=single-cell-data) | `90.02% <ø> (+0.15%)` | :arrow_up: | | [libtiledbsoma](https://app.codecov.io/gh/single-cell-data/TileDB-SOMA/pull/2917/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=single-cell-data) | `∅ <ø> (∅)` | |