Pai Soma Data
Description
This package provides a class, SomaData, for handling data from a Soma experiment produced by Phenomic using TileDBSOMA. It allows users to interact with cached observation data as a Pandas DataFrame and retrieve subsets of data as AnnData objects, with features to query raw or normalized counts.
Features
- Load and cache observation (
obs) and variable (var) data from a SOMA experiment. - Retrieve subsets of data based on specified rows and columns.
- Automatically chooses the appropriate layer (
rawornorm) based on the number of genes requested. - Converts queried data into
AnnDataformat for compatibility with downstream analysis tools.
Installation
To use this package, you'll need Python 3.8 or later.
pip install pai-soma-data
Usage
Initializing the SomaData Class
To start using the SomaData class, initialize it with the URI of your SOMA experiment. You can choose the data layer (raw or norm) based on your needs:
from pai_soma_data import SomaData
# Instantiate SomaData with normalized counts
sdata = SomaData(
corpus_uri="...",
layer="norm" # Change to "raw" for raw counts
)
Accessing Metadata
The observation and gene metadata are stored in the .obs and .var attributes of the SomaData object, respectively. These are accessible as Pandas DataFrames:
# View the first few rows of observation metadata
print(sdata.obs.head())
# View the first few rows of variable (gene) metadata
print(sdata.var.head())
Slicing X Data
The SomaData class allows for Pandas-style slicing of data using the format (row_filter, col_filter). The data is fetched in the layer specified during instantiation (default is "norm" for normalized data).
- Row filter: Can be a pd.Series, list of integers, or slices.
- Column filter: Can be a gene name (string) or a list of gene names.
Contributing
Contributions are welcome! Please fork the repository and submit a pull request for any improvements or bug fixes.
License
This project is licensed under the MIT License.
Metadata
Release files for pai-soma-data 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pai_soma_data-1.0.3.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pai_soma_data-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 kB
Release files / pai_soma_data-1.0.3.tar.gz
| Download URL | pai_soma_data-1.0.3.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3db1f54187e96613a4bf1e102fc7dbfb1a13b8f63ca04872f60713ecd95c9337
|
|
BLAKE2b-256 checksum How to use checksums |
72c6ebea20e276cfeb58a527cd908a758c1e36f7dc90d6dc29f4e0c3e79fde54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.10
|
Release files / pai_soma_data-1.0.3-py3-none-any.whl
| Download URL | pai_soma_data-1.0.3-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de3fb53a910cbce193e0c0cf2f30d0c7653f1654c5e968cbade8e79549dc9793
|
|
BLAKE2b-256 checksum How to use checksums |
7f5bd40c0a9539d72a9d438b47071875c717122d9c40043f81b8dfb54e1c457d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.10
|