anndata_settings mirrors Python's anndata.settings.
Each setting is a field that is read with anndata_settings$name and set
with anndata_settings$name <- value.
Values are stored as R options named anndata.claude.<setting>, so
options() and withr::local_options() work too, and an unset option means
the default.
Invalid values (and unknown setting names) raise an error of class
anndata_invalid_setting_error.
Usage
anndata_settings
local_anndata_settings(new, .local_envir = parent.frame())
with_anndata_settings(new, code)Value
with_anndata_settings() returns the value of code.
local_anndata_settings() returns the previous values invisibly.
Details
anndata_settings$reset() restores every default.
with_anndata_settings() and local_anndata_settings() override settings
temporarily, equivalent to settings.override in Python, and restore the
previous values on exit even when an error occurs.
Printing anndata_settings lists each setting, its value and a description.
Settings
remove_unused_categories(defaultTRUE): Whether or not to remove unused categories with factors.check_uniqueness(defaultTRUE): Whether or not to check uniqueness of theobsindices on creation of anAnnData.allow_write_nullable_strings(defaultNULL): Whether or not to allow writing of nullable string arrays. WhenNULLit behaves as Python with pandas 3 (infer_stringis true). WhenFALSEexplicitly, string arrays are written in the old, non-nullable format.disallow_forward_slash_in_h5ad(defaultTRUE): Whether or not to disallow the/character in keys for h5ad files.write_csr_csc_indices_with_min_possible_dtype(defaultFALSE): Write a csr or csc matrix with the minimum possible data type forindices, always unsigned integer.restrict_index_types(defaultTRUE): Whether to force coercion to a string index upon creation of anAnnDataor settingobs/var. Setting this toFALSEallows other index types, but integer indices are always converted to strings.zarr_write_format(default3): The zarr format version thatwrite_zarr()writes. Writing version 2 is not yet supported and raisesanndata_not_supported_error.auto_shard_zarr_v3(defaultTRUE): Whether zarr v3 arrays are sharded automatically, with a target of 1 GB uncompressed per shard. An explicitshardsdataset argument overrides it and it is ignored for version 2. Shard shapes can differ from Python's, and rec-arrays are not sharded.min_rows_for_chunked_h5_copy(default1000): The least number of rows read at once when a dense X on disk is copied to a new h5ad file (a chunked source dataset raises it to its chunk length). Writing to a compressed dataset copies it chunk by chunk instead.
Omitted settings
Python's copy_on_write_X is deprecated and always on upstream, so it is
omitted (copy-on-write is the only behaviour).
use_sparse_array_on_read is omitted because R has no distinction between
scipy sparse matrices and sparse arrays.
Examples
anndata_settings$check_uniqueness
#> [1] TRUE
with_anndata_settings(list(check_uniqueness = FALSE), {
anndata_settings$check_uniqueness
})
#> [1] FALSE
anndata_settings$check_uniqueness <- FALSE
anndata_settings$reset()
anndata_settings
#> <anndata_settings>
#> remove_unused_categories TRUE Remove unused categories from factors
#> check_uniqueness TRUE Check uniqueness of obs names on creation
#> allow_write_nullable_strings NULL Allow writing nullable string arrays (NULL infers it)
#> disallow_forward_slash_in_h5ad TRUE Disallow `/` in keys for h5ad files
#> write_csr_csc_indices_with_min_possible_dtype FALSE Write sparse indices with the minimum unsigned dtype
#> restrict_index_types TRUE Force string indices on creation and when setting obs/var
#> zarr_write_format 3 Zarr format version written (2 is not yet supported)
#> auto_shard_zarr_v3 TRUE Shard zarr v3 arrays automatically (not yet written)
#> min_rows_for_chunked_h5_copy 1000 Rows copied at once from a backed dense X