Skip to content

Make rownames part of obs and var - #171

Merged
rcannood merged 13 commits into
mainfrom
rework_rownames
Jul 8, 2024
Merged

rcannood merged 13 commits into
mainfrom
rework_rownames

Conversation

@rcannood

@rcannood rcannood commented Jul 4, 2024

Copy link
Copy Markdown
Member

These changes have been ported from #166 and #169.

Rownames have been moved from a separate obs_names and var_names to being the rownames of obs and var, since it simplifies the way the data is read to and from an hdf5 file.

@rcannood
rcannood requested a review from LouiseDck July 4, 2024 22:05

@LouiseDck LouiseDck left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I have no issues with the way you refactored obs_names and var_names.

If I recall correctly though, the reason for not doing it this way in the first place was the following:
rownames in R can only be character vectors, which is an assumption that does not (or will not) apply to the Python anndata version. I believe that the impact of this is relatively minor, however I do feel it is necessary to be documented somewhere?
(This is in general: we need to have some documentation delineating the differences and what is and isn't supported)

@rcannood

rcannood commented Jul 8, 2024

Copy link
Copy Markdown
Member Author

Good idea! I was going to add it to the roxygen docs, but found it a bit weird to document differences between R and Python while the Python AnnData also only allows string obs_names and var_names for now. I'll create a separate issue.

@lazappi

lazappi commented Jul 8, 2024

Copy link
Copy Markdown
Collaborator

I have no issues with the way you refactored obs_names and var_names.

If I recall correctly though, the reason for not doing it this way in the first place was the following: rownames in R can only be character vectors, which is an assumption that does not (or will not) apply to the Python anndata version. I believe that the impact of this is relatively minor, however I do feel it is necessary to be documented somewhere? (This is in general: we need to have some documentation delineating the differences and what is and isn't supported)

You are right. I had forgotten but this was (at least partly) why we changed it before. I would probably make a special man page and/or vignette for things we know are different from Python.

@rcannood

rcannood commented Jul 8, 2024 •

Copy link
Copy Markdown
Member Author

I would probably make a special man page and/or vignette for things we know are different from Python.

Good point! I added it to #172 ☺️

@rcannood
rcannood merged commit 220f977 into main Jul 8, 2024
@rcannood
rcannood deleted the rework_rownames branch July 8, 2024 06:23
LouiseDck pushed a commit that referenced this pull request Oct 3, 2024
* port rownames-related changes from #166 and #169

* run styler

* fix test

* style

* style

* fix docs

* fix documentation

* simplify helper functions

* simplify test

* add more documentation to AnnData

* fix docs
Artur-man added a commit to Artur-man/anndataR that referenced this pull request Nov 1, 2024
rcannood added a commit that referenced this pull request Apr 24, 2026
* WIP

* More tests passing

* Fix df read bug

* More tests passing after fixing zero-dimensional get bug in pizzarr

* WIP: writing

* Fix more tests

* Zarr df writing

* WIP: ZarrAnnData class

* Tests passing

* Tests that compare h5ad to zarr

* Use Rarr to read full numeric arrays

* Fix bugs. Add test for from_SingleCellExperiment with Zarr

* Add a to_dense param to ZarrAnnData constructor. Add overwrite params internally.

* Update

* Backwards dense/sparse

* Simplify how obs and var names handled in ZarrAnnData (similar to #171)

* update extdata and documentation

* fix set/get zarr _index, update text example.zarr and update tests similar to HDF5AnnData

* Fix test

* Revert unnecessary changes

* Formatting

* Add comments

* remove unnecessary example zarr store

* lintr and R check for zarr related utilities and functions, updated some documentation

* add pizzarr to Suggests and README

* proj

* add keller-mark/pizzarr to Remotes

* zip example.zarr

* adapt read_zarr to Rarr

* adapt write_zarr to Rarr

* remove old scripts

* update write_zarr

* initial update to ZarrAnnData

* update ZarrAnnData, documentation, and implement read_zarr_rec_array

* review read zarr helpers, and update tests

* update read_zarr, read tests pass

* some updates for writing zarr

* update write_empty_zarr

* remove pizzarr, update documentation

* remove pizzarr from tests

* fix test-ZarrAnnData

* update ZarrAnnData to imitate HDF5AnnData

* check redundant files, correct lines

* update example_h5ad.py, add zarr and change to example_files.py

* add new test example

* some linting changes

* remove read/write_zattrs since implemented in Rarr

* access read/write_zarr_attr

* add some missing tests

* update readers, update tests

* correct nullable string zarr array write/read, introduce ordering in categorical zarr array

* do some linting, fix commented out code

* update some zarr writers and classes

* fix documentation

* fix compression interface for zarr

* full lint check

* fix examples

* check, biocheck and lintr

* fix development status

* air format

* air format test

* update example.zarr.zip, skip some test (waiting for Rarr)

* update example.zarr, fix some read_zarr_

* fix examples

* remove overwrite

* R code styling

* fixes from @lazappi

* air format

* update some documentation

* fix some tests

* more fixes on anndata-zarr integration

* update ZarrAnnData$initialize

* update zarr compression

* fix column-order here, C based ordering for arrays

* implement roundtrip tests for anndata-zarr

* add zarr to vignettes

* update README and software_design.rmd

* update AnnData-usage

* update write_zarr documentation

* update write_zarr_null

* fix rec_array, update tests and example datasets

* fix duplicate chunks in Rmd

* add write_zarr_null

* update write string array (zarr), air and lint

* implement writing empty zarr elements

* update tests for rec_array conformance of h5ad and zarr

* update mapping conformance test for h5ad and zarr

* implement H5_ITER like ordering and fix h5ad vs zarr testing

* air and lint

* fix test bug

* do not call expect_equal outside of test

* implement examples, test and datasets for zarr v3

* fix issues, lint and update example datasets to new anndata version

* lint and merge

* revert some lines

* small changes

* revert small changes

* air format some tests

* Set v2 in write_zarr_* helpers

* Fix stop message in write_zarr_element()

* Fix roxygen comment in write_zarr_element()

* Expand compression list in as_ZarrAnnData()

* Fix H5_ITER_INC_ORDERING docs

* Fix as_ZarrAnnData() compression docs

* Fix Zarr varm roundtrip test

* Review duplicate entry in README

* Fix typo in AnnData-usage docs

* Fix comma in software design vignette

* Adjust class descriptions in software design vignette

* Roxygenise

* Minor text fixes

* Document .get_compressor

* Minor fixes to function docs

* Comment logic in create_zarr_group()

* Fix indentation in read_zarr_sparse_array()

* Add construct sparse matrix helper

* Add ZARR_METADATA_FILES vector

* Eval Zarr chunks in vignettes

* Merge test-Zarrv3-read.R into test-Zarr-read.R

* Combine roundtrip tests

* Add roundtrip test helpers

* Refactor test-h5ad-zarr.R to use helper

* Refactor example files script

- Use uv comments for dependencies
- Update dependencies to latest stable versions
- Add progress messages
- Use Ruff for formatting

* Remove H5_ITER_INC_ORDERING()

* Remove Zarr compression comment

* Fix factor creation in read_zarr_categorical()

* Pin Rarr version

* Delete existing Zarr path before writing

* Add helper functions for accessing Zarr keys

* Update read_zarr_element() error message

* Add dimname warnings to ZarrAnnData

* Add Zarr writeability checks/tests

* Roxygenise, lint, style

* Use setup-bioc for all GHA

* Update WORDLIST

* Add .venv to .Rbuildignore

* Clean up test output

* Style

* add Artur as ctb

* fix linting issues

* Add Bisaloo as contributor

Co-authored-by: Hugo Gruson <[email protected]>

---------

Co-authored-by: Artur-man <[email protected]>
Co-authored-by: Luke Zappia <[email protected]>
Co-authored-by: Robrecht Cannoodt <[email protected]>
Co-authored-by: Luke Zappia <[email protected]>
Co-authored-by: Hugo Gruson <[email protected]>
rcannood added a commit that referenced this pull request May 12, 2026
* WIP

* More tests passing

* Fix df read bug

* More tests passing after fixing zero-dimensional get bug in pizzarr

* WIP: writing

* Fix more tests

* Zarr df writing

* WIP: ZarrAnnData class

* Tests passing

* Tests that compare h5ad to zarr

* Use Rarr to read full numeric arrays

* Fix bugs. Add test for from_SingleCellExperiment with Zarr

* Add a to_dense param to ZarrAnnData constructor. Add overwrite params internally.

* Update

* Backwards dense/sparse

* Simplify how obs and var names handled in ZarrAnnData (similar to #171)

* update extdata and documentation

* fix set/get zarr _index, update text example.zarr and update tests similar to HDF5AnnData

* Fix test

* Revert unnecessary changes

* Formatting

* Add comments

* remove unnecessary example zarr store

* lintr and R check for zarr related utilities and functions, updated some documentation

* add pizzarr to Suggests and README

* proj

* add keller-mark/pizzarr to Remotes

* zip example.zarr

* adapt read_zarr to Rarr

* adapt write_zarr to Rarr

* remove old scripts

* update write_zarr

* initial update to ZarrAnnData

* update ZarrAnnData, documentation, and implement read_zarr_rec_array

* review read zarr helpers, and update tests

* update read_zarr, read tests pass

* some updates for writing zarr

* update write_empty_zarr

* remove pizzarr, update documentation

* remove pizzarr from tests

* fix test-ZarrAnnData

* update ZarrAnnData to imitate HDF5AnnData

* check redundant files, correct lines

* update example_h5ad.py, add zarr and change to example_files.py

* add new test example

* some linting changes

* remove read/write_zattrs since implemented in Rarr

* access read/write_zarr_attr

* add some missing tests

* update readers, update tests

* correct nullable string zarr array write/read, introduce ordering in categorical zarr array

* do some linting, fix commented out code

* update some zarr writers and classes

* fix documentation

* fix compression interface for zarr

* full lint check

* fix examples

* check, biocheck and lintr

* fix development status

* air format

* air format test

* update example.zarr.zip, skip some test (waiting for Rarr)

* update example.zarr, fix some read_zarr_

* fix examples

* remove overwrite

* R code styling

* fixes from @lazappi

* air format

* update some documentation

* fix some tests

* more fixes on anndata-zarr integration

* update ZarrAnnData$initialize

* update zarr compression

* fix column-order here, C based ordering for arrays

* implement roundtrip tests for anndata-zarr

* add zarr to vignettes

* update README and software_design.rmd

* update AnnData-usage

* update write_zarr documentation

* update write_zarr_null

* fix rec_array, update tests and example datasets

* fix duplicate chunks in Rmd

* add write_zarr_null

* update write string array (zarr), air and lint

* implement writing empty zarr elements

* update tests for rec_array conformance of h5ad and zarr

* update mapping conformance test for h5ad and zarr

* implement H5_ITER like ordering and fix h5ad vs zarr testing

* air and lint

* fix test bug

* do not call expect_equal outside of test

* implement examples, test and datasets for zarr v3

* fix issues, lint and update example datasets to new anndata version

* lint and merge

* revert some lines

* small changes

* revert small changes

* air format some tests

* Set v2 in write_zarr_* helpers

* Fix stop message in write_zarr_element()

* Fix roxygen comment in write_zarr_element()

* Expand compression list in as_ZarrAnnData()

* Fix H5_ITER_INC_ORDERING docs

* Fix as_ZarrAnnData() compression docs

* Fix Zarr varm roundtrip test

* Review duplicate entry in README

* Fix typo in AnnData-usage docs

* Fix comma in software design vignette

* Adjust class descriptions in software design vignette

* Roxygenise

* Minor text fixes

* Document .get_compressor

* Minor fixes to function docs

* Comment logic in create_zarr_group()

* Fix indentation in read_zarr_sparse_array()

* Add construct sparse matrix helper

* Add ZARR_METADATA_FILES vector

* Eval Zarr chunks in vignettes

* Merge test-Zarrv3-read.R into test-Zarr-read.R

* Combine roundtrip tests

* Add roundtrip test helpers

* Refactor test-h5ad-zarr.R to use helper

* Refactor example files script

- Use uv comments for dependencies
- Update dependencies to latest stable versions
- Add progress messages
- Use Ruff for formatting

* Remove H5_ITER_INC_ORDERING()

* Remove Zarr compression comment

* Fix factor creation in read_zarr_categorical()

* Pin Rarr version

* Delete existing Zarr path before writing

* Add helper functions for accessing Zarr keys

* Update read_zarr_element() error message

* Add dimname warnings to ZarrAnnData

* Add Zarr writeability checks/tests

* Roxygenise, lint, style

* Use setup-bioc for all GHA

* Update WORDLIST

* Add .venv to .Rbuildignore

* Clean up test output

* Add Zarr to benchmarks

* run air format

---------

Co-authored-by: Mark Keller <[email protected]>
Co-authored-by: Artur-man <[email protected]>
Co-authored-by: Robrecht Cannoodt <[email protected]>
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