https://github.com/biocpy/spatialfeatureexperiment
https://github.com/biocpy/spatialfeatureexperiment
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/biocpy/spatialfeatureexperiment
- Owner: BiocPy
- License: mit
- Created: 2025-03-01T01:04:32.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-03-01T01:07:41.000Z (11 months ago)
- Last Synced: 2025-03-01T02:19:53.160Z (11 months ago)
- Language: Python
- Size: 29.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Authors: AUTHORS.md
Awesome Lists containing this project
README
[](https://pypi.org/project/SpatialFeatureExperiment/)

# SpatialFeatureExperiment
A Python package for storing and analyzing spatial-omics experimental data. This package provide the `SpatialFeatureExperiment` class, based on the [R package and class](https://github.com/pachterlab/SpatialFeatureExperiment).
## Install
To get started, install the package from [PyPI](https://pypi.org/project/SpatialFeatureExperiment/)
```bash
pip install spatialfeatureexperiment
```
## Quick Usage
This package uses shapely and geopandas to support the `*_geometries` slots.
```python
from spatialexperiment import SpatialFeatureExperiment
import numpy as np
import geopandas as gpd
from shapely.geometry import Polygon
nrows = 200
ncols = 500
counts = np.random.rand(nrows, ncols)
polys = gpd.GeoSeries(
[
Polygon([(1, -1), (1, 0), (0, 0)]),
Polygon([(3, -1), (4, 0), (3, 1)]),
]
)
colgeoms = {"polygons" : gpd.GeoDataFrame({"geometry": polys})}
tspe = SpatialFeatureExperiment(assays={"spots": counts}, col_geometries=colgeoms)
```
## Note
This project has been set up using [BiocSetup](https://github.com/biocpy/biocsetup)
and [PyScaffold](https://pyscaffold.org/).