Skip to content

Commit 2ebe9e4

Browse files
authored
Add more detail to docstring for to_anndata() (#11)
1 parent 994f1d1 commit 2ebe9e4

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changelog
22

3-
## Version 0.0.4
3+
## Version 0.0.4-0.0.5
44

55
- Implement `to_anndata()` to convert from spatial feature experiment to AnnData
66

src/spatialfeatureexperiment/sfe.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Optional, Union
1+
from typing import Any, Dict, List, Optional, Union, Tuple
22
from warnings import warn
33

44
import biocutils as ut
@@ -790,15 +790,26 @@ def set_column_data(
790790
######>> AnnData interop <<#####
791791
################################
792792

793-
def to_anndata(self, include_alternative_experiments: bool = False) -> "anndata.AnnData":
793+
def to_anndata(
794+
self, include_alternative_experiments: bool = False
795+
) -> Tuple["anndata.AnnData", Dict[str, "anndata.AnnData"]]:
794796
"""Transform :py:class:`~SpatialFeatureExperiment`-like into a :py:class:`~anndata.AnnData` representation.
795797
798+
This method extends the :py:meth:`~SpatialExperiment.to_anndata` method from the parent class
799+
by adding SpatialFeatureExperiment-specific elements to the AnnData object's `uns["spatial"]`
800+
dictionary. The additional elements include:
801+
- `col_geometries`
802+
- `row_geometries`
803+
- `annot_geometries`
804+
- `spatial_graphs`
805+
- `unit`
806+
796807
Args:
797808
include_alternative_experiments:
798809
Whether to transform alternative experiments.
799810
800811
Returns:
801-
An ``AnnData`` representation of the experiment.
812+
A tuple containing an ``AnnData`` object with spatial information and a list of alternative experiments.
802813
"""
803814
obj, alt_exps = super().to_anndata(include_alternative_experiments=include_alternative_experiments)
804815

0 commit comments

Comments
 (0)