cellannotation / cas-tools

Cell Annotation Schema Tools
1 stars 0 forks source link

Alignment of flattening with latest CAP schema #64

Closed dosumis closed 3 months ago

dosumis commented 3 months ago

Flattening to obs is working except that there should be no

cellannotation_setname-cell-label key

it should just be

e.g.

cluster2: HBC2

NOT

cluster2--cell_label: HBC2

https://github.com/cellannotation/cell-annotation-schema/blob/main/docs/cap_anndata_schema.md#cellannotation_setname

Flattening to uns needs some work.

For labelsets:

The CAP anndata spec has:

https://github.com/cellannotation/cell-annotation-schema/blob/main/docs/cap_anndata_schema.md#cellannotation_metadata

image

i.e., each labelset gets its own uns key

Cluster2-metadata: dict with key-value pairs in labelset objects (minus the name - which gets merged into the key. Note that this appears to work with the Python AnnData library, but is not legal according to the AnnData spec, which only allows literals as values. We may need to convert to JSON in future.

Also note, the implementation in example files from CAP is different. All metadata is dumped into one object, keyed on labelset(cellannotation_set) name.

image

For now - follow spec precisely, not example.