Changelog
Source:NEWS.md
anndata.claude 0.1.0
First public release, on GitHub, covering every sub-project of the roadmap except the experimental Python features.
- A sparse matrix with out-of-range
indices(such as the 1-based indices Illumina DRAGEN 4.5.4 writes) raises an error saying so, with a hint when they look 1-based, and is listed invignette("deviations")(Python reads it into an invalid matrix). - The package is on GitHub (https://github.com/lazappi/R-anndata-claude) with GitHub Actions for
R CMD checkon Ubuntu and macOS (with the Python comparison tests), lint, coverage and the pkgdown site at https://lazappi.github.io/R-anndata-claude/. - The README describes the features, installation (including OpenSSL on macOS for Rhdf5lib) and the directory structure.
Known limitations
- Reading is slower than Python on large files (about 5x for
read_h5ad()and 8x forread_zarr()). - Loom is not supported (deprecated in Python), and complex Matrix Market files raise an error (Python silently drops the imaginary part).
- Files from anndata before 0.6 and 0.6.x zarr stores are not supported.
- Writing zarr v2 and zip stores (
.zarr.zip) are not supported. - The experimental Python features (
AnnCollection,concat_on_disk, awkward arrays and accessors) are not supported. - Unsorted sparse indices are sorted on read (ADR 0006).
- A lazily read int32 array holding -2^31 cannot be realised lazily, read it with
read_h5ad()orread_zarr()instead.
anndata.claude 0.0.6
Sixth milestone: hardening (performance, documentation and deviations).
-
vignette("deviations")lists every documented difference from Python anndata 0.13.4 with its reason, and help pages with a deviation link to it. - Every exported help page has runnable examples, including
read_excel(). - Large files are faster to write and to read from zarr: on an 800 MB h5ad (84k cells, 4 GB after rewriting),
write_h5ad()is about 3x faster andread_zarr()about 2x faster. - A pkgdown site config (
_pkgdown.yml) groups the reference by area and lists both vignettes as articles, the site URL is a placeholder.
Known limitations
- Reading is slower than Python on large files (about 5x for
read_h5ad()and 8x forread_zarr()), see.scratch/hardening/benchmarks.md. - Loom is not supported (deprecated in Python), and complex Matrix Market files raise an error (Python silently drops the imaginary part).
- Files from anndata before 0.6 and 0.6.x zarr stores are not supported.
- Writing zarr v2 and zip stores (
.zarr.zip) are not supported. - Unsorted sparse indices are sorted on read (ADR 0006).
- A lazily read int32 array holding -2^31 cannot be realised lazily, read it with
read_h5ad()orread_zarr()instead.
anndata.claude 0.0.5
Fifth milestone: other formats.
-
read_text()andread_csv()read delimited text into anAnnDatalike Python, from a path (plain,.gzor.bz2), a connection or a character vector of lines, with numpydtypestrings (default"float32"). -
read_mtx()reads Matrix Market files (coordinate or array, integer, real or pattern,.gzor.bz2) into anAnnDatawith a CSR X like Python, with numpydtypestrings (default"float32"). Complex fields are not supported. -
read_umi_tools()reads a umi_tools count table (plain or.gz) into anAnnDatawith a CSR X and sortedobsandvarnames like Python. -
read_hdf()reads a dataset of an HDF5 file into the X of anAnnDatalike Python, using therow_namesandcol_namesdatasets asobsandvarnames when present. -
read_excel()reads an.xlsxsheet into anAnnDatalike Python (first columnobsnames, first rowvarnames) using readxl (a suggested package).dtypeis ignored as in Python and names are always strings. -
write_csvs()andadata$write_csvs()writeobs,var,obsm,varm,uns(and X withskip_data = FALSE) as csv files that pandas reads the same as Python’s, with Python’sanndata_write_warningfor sparse and unwritableunsvalues. A dict inunsis written as Python’srepr, which supports strings, scalars, nested dicts and 1-d arrays that fit on one line.
Known limitations
- Loom is not supported (deprecated in Python), and complex Matrix Market files raise an error (Python silently drops the imaginary part).
- Files from anndata before 0.6 and 0.6.x zarr stores are not supported.
- Writing zarr v2 and zip stores (
.zarr.zip) are not supported. - Unsorted sparse indices are sorted on read (ADR 0006).
- A lazily read int32 array holding -2^31 cannot be realised lazily, read it with
read_h5ad()orread_zarr()instead.
anndata.claude 0.0.4
Fourth milestone: files from old anndata releases and full rec-array fidelity.
- Files from old anndata releases read their
obsandvaras Python does: compound datasets (anndata before 0.7),dataframeversion 0.1.0 groups and categories kept inuns(<col>_categories), each with Python’sanndata_old_format_warning. - Old files with
raw.X,raw.varandraw.varmas root members read intoraw, andconnectivitiesanddistanceskept inuns$neighborsmove toobspwith ananndata_future_warning. - Old files with
obsmandvarmstored as compound datasets (such as the PBMC 3k example of cellxgene) read as a matrix per field. - Numeric fields of legacy compound datasets (
obs,var,uns,obsm) keep their on-disk dtype, such as float32. - Old files read in backed mode (
read_h5ad(backed = "r")) with their unencoded dense or h5sparseXleft on disk.read_lazy()reads only current encodings like Python and no longer movesuns$neighborsmatrices toobsp. - rec-arrays in h5ad keep their field dtypes (integer widths and signedness, float32, bool, fixed-length and variable-length strings) on read and write, text is written as variable-length UTF-8 like h5py, and rec-arrays with no rows or
compression = "gzip"can be written ("lzf"writes them uncompressed). - The package now has compiled code, a small C helper linked to Rhdf5lib for compound types (ADR 0008), so installing from source needs a C compiler.
Known limitations
- Other formats (csv, mtx, text, excel, umi_tools and hdf) are not yet supported, and loom will not be (deprecated in Python).
- Files from anndata before 0.6 and 0.6.x zarr stores are not supported.
- Writing zarr v2 and zip stores (
.zarr.zip) are not supported. - Unsorted sparse indices are sorted on read (ADR 0006).
- A lazily read int32 array holding -2^31 cannot be realised lazily, read it with
read_h5ad()orread_zarr()instead.
anndata.claude 0.0.3
Third milestone: backed mode, lazy reading and concatenation.
concat()combinesAnnDataobjects alongaxiswith an inner or outerjoin, stacking X and the layers like Python (numpy dtype promotion, CSR for any sparse input,fill_valuefor outer joins). Theobsandvarannotations are combined (categoricals, nullable boolean promotion), withmergeanduns_mergestrategies or functions,label,keys(or a named list) andindex_unique. The aligned mappings (obsm,varm,obsp,varp),pairwiseandraware combined like Python (rawis dropped with a warning when only some objects have one). Views and backed objects can be concatenated (backedXis read into memory, as Python does). Lazily read objects (read_lazy()) give a lazyX,layersandobsm(theirobsandvarare read into memory).The vignette has a section on lazy reading.
read_lazy()(experimental) reads an h5ad file or zarr store as anAnnDatawith lazy X, layers, obsm, varm, obsp, raw, obs and var.to_memory()reads everything into memory,copy()keeps it lazy, and writing a lazy object (or a View of one) raises Python’s not-implemented error untilto_memory()is used.read_elem_lazy()(experimental) reads an Element of an h5ad file or zarr store lazily: arrays areDelayedArrays (sparse ones stay sparse), and categorical, nullable anddataframeElements have lazy columns.adata$chunked_X(chunk_size)returns the rows of X in chunks (a list ofchunk, 1-basedstartandend) andadata$chunk_X(select, replace)returns random rows (a single number) or chosen rows (an index, withI()for one row), for backed and in-memory objects and Views.A backed
rawcannot be replaced,filename <- NULLloads a backedraw$Xinto memory and settingrawon a backed object raises Python’s error.A backed object can be written with
write()andwrite_h5ad()(to a new file or in place), copied withcopy(filename)and loaded withto_memory().Writing a backed dense
Xto a new h5ad file copies it in blocks of at leastanndata_settings$min_rows_for_chunked_h5_copyrows (default 1000) instead of reading it whole.In backed mode
adata$X[i, j] <- valuewrites into a dense X in"r+"mode, assigning X ends backed mode (isbackedisFALSE, the file is untouched) and changing a View of a backed object fails as in Python.sparse_dataset()handles have$append()to add rows (CSR) or columns (CSC) to a sparse matrix on disk, and sparse matrices written to HDF5 are now resizable like Python’s, so the files can be appended to.A backed sparse
X(CSR or CSC) supportsdim(),[with every matrix index form (reading only the needed parts ofdataandindices),as.matrix(),$to_memory()and views, andsparse_dataset()makes the same handle for an open rhdf5 group.A backed dense
Xsupportsdim(),[with every matrix index form (reading only the selected part of the file),as.matrix()and views that read only their subset.read_h5ad(backed = "r")(or"r+") keepsXandraw$Xon disk, withadata$isbacked,adata$filename, the file manageradata$file(open(),close(),is_open) andbacked at '<file>'inprint().rec-arrays in zarr now honour the
compressorsdataset argument (zstd, gzip, blosc or none) and read stores Python compressed with any of them.
Known limitations
- Legacy formats (files from older anndata versions) and other formats (csv, mtx, loom and others) are not yet supported.
- Writing zarr v2 and zip stores (
.zarr.zip) are not supported. - rec-array field dtypes are still not preserved in h5ad (ADR 0005), and unsorted sparse indices are sorted on read (ADR 0006).
- A lazily read int32 array holding -2^31 cannot be realised lazily, read it with
read_h5ad()orread_zarr()instead.
anndata.claude 0.0.2
Second milestone: zarr I/O and Views.
-
read_zarr()andwrite_zarr()(alsoadata$write_zarr()) read and write zarr v3 stores that round trip with Python. Dataset argumentscompressors(zstd, gzip, blosc or none) andchunksare supported. The settingszarr_write_formatandauto_shard_zarr_v3are added (writing v2 is not yet supported). Arrays are sharded like Python’s by default, and theshardsdataset argument sets the shard shape orNULLfor none. - rec-arrays in zarr keep their field dtypes (integer widths, float32, bool, fixed-length strings), may have no rows or hold non-ASCII text, and are sharded when
shardsis given. -
read_zarr()andread_elem()also read zarr v2 stores, including consolidated metadata, blosc compression and rec-arrays. -
adata[i, j]returns a View that shares X, layers and the aligned mappings with its parent (as in Python), hasis_viewTRUEand prints with aView ofprefix. Views of Views refer to the original parent, and modifying a View makes it an independent object and leaves the parent unchanged, with Python’sanndata_implicit_modification_warningmessages (R cannot tellview$obs$col <- xfromview$obs <- x, so these always warn). Values extracted from a View are plain R objects, sox <- view$X; x[1, 1] <- 0does not change the View as it does in Python. -
adata$write()is a shortcut forwrite_h5ad(), as in Python.
Known limitations
- Writing zarr v2 and zip stores (
.zarr.zip) are not supported. - rec-arrays in zarr are always compressed with zstd, ignoring
compressors. - rec-array field dtypes are still not preserved in h5ad (ADR 0005), and unsorted sparse indices are sorted on read (ADR 0006).
- Legacy formats, backed mode, concatenation and lazy arrays are not yet supported.
anndata.claude 0.0.1
First milestone: the MVP of an R port of Python anndata 0.13.4, with h5ad files that round trip between R and Python.
Core object
-
AnnData()creates an R6 object with reference semantics holdingX,obs,var,obsm,varm,obsp,varp,layers,unsandraw.obsandvarareS4Vectors::DataFrames, andXis stored as theNAlayer. - Assignment validates and aligns values as Python does, including names, categoricals and the
rawslot. - Subsetting with R indexing,
copy(),transpose()/t(),obs_names_make_unique(),var_names_make_unique(),to_df(),strings_to_categoricals()andrename_categories(). -
print()matches Python’srepr. - Methods that Python deprecates (
obs_vector(),var_vector()and the*_keys()methods) warn. -
anndata_settings(),local_anndata_settings()andwith_anndata_settings()mirror Python’s settings.
h5ad I/O
-
read_h5ad()andwrite_h5ad()support every current encoding: dense and sparse arrays, strings, scalars, nullable and categorical arrays, dataframes, dicts, rec-arrays,AnnDataandRaw. - On-disk dtypes (such as float32, the integer widths and unsigned integers) are recorded on read and restored on write.
- Compression,
as_denseandas_sparseoptions.