Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Points class metadata #17

Closed
giovp opened this issue Aug 16, 2022 · 1 comment
Closed

Points class metadata #17

giovp opened this issue Aug 16, 2022 · 1 comment

Comments

@giovp
Copy link
Member

giovp commented Aug 16, 2022

Following #12 and #16 we should find a consensus on how to store points "metadata".

Visium points

  • centroid coordinates as array in adata.obsm["spatial"]
  • radius/diameter as attribute in Points class and stored in .zattr following closely how current metadata is store ome-ngff
  • radius/diameter transform (one scalar value for scaling), following closely ome-zarr metadata (see
    def _write_metadata(
    group: zarr.Group,
    group_type: str,
    shape: Tuple[int, ...],
    attr: Optional[Mapping[str, Optional[str]]] = MappingProxyType({"attr": "X", "key": None}),
    fmt: Format = SpatialDataFormat(),
    axes: Optional[Union[str, List[str], List[Dict[str, str]]]] = None,
    coordinate_transformations: Optional[List[List[Dict[str, Any]]]] = None,
    **metadata: Union[str, JSONDict, List[JSONDict]],
    ) -> None:
    """Write metdata to a group."""
    dims = len(shape)
    axes = _get_valid_axes(dims, axes, fmt)
    datasets: List[Dict[str, Any]] = []
    datasets.append({"path": attr})
    if coordinate_transformations is None:
    shape = [shape] # type: ignore[assignment]
    coordinate_transformations = fmt.generate_coordinate_transformations(shape)
    fmt.validate_coordinate_transformations(dims, 1, coordinate_transformations)
    if coordinate_transformations is not None:
    for dataset, transform in zip(datasets, coordinate_transformations):
    dataset["coordinateTransformations"] = transform
    if axes is not None:
    axes = _get_valid_axes(axes=axes, fmt=fmt)
    if axes is not None:
    ndim = len(axes)
    multiscales = [
    dict(
    version=fmt.version,
    datasets=_validate_datasets(datasets, ndim, fmt),
    **metadata,
    )
    ]
    if axes is not None:
    multiscales[0]["axes"] = axes
    group.attrs["@type"] = group_type
    group.attrs["multiscales"] = multiscales
    )

Transcript points

  • would start by just pickling the kdtree (possibly within anndata) and store path in .zattr
@LucaMarconato
Copy link
Member

As I explained here #12 (comment) at the moment I am storing the points metadata in a slightly different way due to practical coding convenience since I want to finish implementing a fully functional io and interactive viz. Then we should explore the alternatives, set a convention a refactor the code (will be quick).

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

No branches or pull requests

2 participants