Skip to content

Reading structured data types #81

@Artur-man

Description

@Artur-man

Here is a case, from zarr-python which we do not read in Rarr at the moment.

>>> import zarr
>>> zarr.__version__
'2.18.7'
>>> z = zarr.open("example2.zarr")
>>> za = z["uns/rank_genes_groups/logfoldchanges"]
>>> za.attrs.asdict()
{'encoding-type': 'rec-array', 'encoding-version': '0.2.0'}
>>> za.info
Type               : Array
Zarr format        : 2
Data type          : [('0', '<f4'), ('1', '<f4'), ('2', '<f4'), ('3', '<f4'), ('4', '<f4'), ('5', '<f4')]
Shape              : (100,)
Chunk shape        : (100,)
Order              : C
Read-only          : False
Store type         : LocalStore
Filters            : ()
Compressors        : (Blosc(cname='lz4', clevel=5, shuffle=SHUFFLE, blocksize=0),)
No. bytes          : 2400 (2.3K)
>>> za[:]
array([( 1.2091126 ,  1.3671894 ,  1.03600216e+00,  1.25505447e+00,  1.21497381e+00,  0.8379856 ),
       ( 1.0016283 ,  1.520212  ,  8.02816689e-01,  8.07398200e-01,  1.11363661e+00,  1.2618493 ),
       ( 1.2513808 ,  0.9569721 ,  1.06660414e+00,  7.27090359e-01,  7.70881355e-01,  0.6068869 ),
       ( 0.8667367 ,  0.8978347 ,  7.36395359e-01,  6.78247988e-01,  7.51340449e-01,  1.3400772 ),
       ( 0.8735813 ,  0.76945794,  9.31681454e-01,  7.42217124e-01,  1.22592008e+00,  0.8190094 ),
       ( 0.8352304 ,  0.57019335,  6.17068052e-01,  8.51450741e-01,  1.17840135e+00,  0.58131063),

in Rarr

> library(Rarr)
> za <- read_zarr_array("example2.zarr/uns/rank_genes_groups/logfoldchanges")
Error in strsplit(typestr, "", fixed = TRUE) : non-character argument
> read_zarr_attributes("example2.zarr/uns/rank_genes_groups/logfoldchanges/")
$`encoding-type`
[1] "rec-array"

$`encoding-version`
[1] "0.2.0"

https://github.com/keller-mark/anndataR/blob/keller-mark/zarr/inst/extdata/example2.zarr.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions