A wrapper for managing DataFrames backed by TileDB
Project description
cellarr-frame
cellarr-frame provides a high-level, Pandas-like interface for interacting with TileDB DataFrames.
Installation
pip install cellarr-frame
Quick Start
1. Creating a Frame
You can create a new persistent CellArrayFrame directly from a Pandas DataFrame.
import pandas as pd
import shutil
from cellarr_frame import CellArrayFrame
# Prepare some data
df = pd.DataFrame({
"name": ["GeneA", "GeneB", "GeneC", "GeneD"],
"expression": [12.5, 0.0, 5.2, 8.1],
"category": ["coding", "non-coding", "coding", "coding"]
})
df.index.name = "row_id"
# Create the TileDB array at the specified URI
uri = "./my_cellarr_frame"
# clean up if exists
shutil.rmtree(uri, ignore_errors=True)
# Create with sparse=True to allow flexible appending and querying
CellArrayFrame.create(uri, df, sparse=True, full_domain=True)
2. Basic Slicing
Open the frame and slice rows using standard Python syntax.
cf = CellArrayFrame(uri=uri)
# Slice the first 2 rows
# Returns a Pandas DataFrame
print(cf[0:2])
# name expression category
# row_id
# 0 GeneA 12.5 coding
# 1 GeneB 0.0 non-coding
3. Column Selection
Optimize performance by selecting only specific columns.
# Select only 'name' and 'expression' for the first row
print(cf[0:1, ["name", "expression"]])
4. Querying
Filter data using string conditions. The filtering happens at the storage layer, making it highly efficient for large datasets.
# Select all rows where expression is greater than 5.0
high_expr = cf["expression > 5.0"]
print(high_expr)
# Combine queries with column selection
# Get names of all 'coding' genes
coding_genes = cf["category == 'coding'", ["name"]]
print(coding_genes)
5. Appending Data
Append new batches of data to the existing array.
new_data = pd.DataFrame({
"name": ["GeneE"],
"expression": [99.9],
"category": ["coding"]
})
# Ensure the index continues correctly
new_data.index = [4]
new_data.index.name = "row_id"
# Append to the array
cf.write_batch(new_data)
# Verify the new total count
print(f"Total rows: {cf.shape[0]}")
Note
This project has been set up using BiocSetup and PyScaffold.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cellarr_frame-0.0.5.tar.gz.
File metadata
- Download URL: cellarr_frame-0.0.5.tar.gz
- Upload date:
- Size: 25.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
411e4c4f79db2db7ebb3f0e79b88cb72aa317fc8b18f63c80d17a12cd5639f67
|
|
| MD5 |
eedbf52fa15b99218142a9941c4e2eb1
|
|
| BLAKE2b-256 |
1b1dac09873c7cbf03ea4fb9a9ab18fd48ef9da22d1ba5325bb4e828789d66aa
|
Provenance
The following attestation bundles were made for cellarr_frame-0.0.5.tar.gz:
Publisher:
publish-pypi.yml on CellArr/cellarr-frame
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cellarr_frame-0.0.5.tar.gz -
Subject digest:
411e4c4f79db2db7ebb3f0e79b88cb72aa317fc8b18f63c80d17a12cd5639f67 - Sigstore transparency entry: 913396325
- Sigstore integration time:
-
Permalink:
CellArr/cellarr-frame@de3e556c1ed56f0495125063f8cffe685a6c56b1 -
Branch / Tag:
refs/tags/0.0.5 - Owner: https://github.com/CellArr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@de3e556c1ed56f0495125063f8cffe685a6c56b1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file cellarr_frame-0.0.5-py3-none-any.whl.
File metadata
- Download URL: cellarr_frame-0.0.5-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48653f45eecee37b6e8d3c3d3b9ff215330e028291c66635bbb17dbc4e971f73
|
|
| MD5 |
ab0619a3e7995468412699e6b293e1e7
|
|
| BLAKE2b-256 |
05b4afee48c666a7a6903ff2ea2b6d63c334ada858ebf35765d6879ae267e1e4
|
Provenance
The following attestation bundles were made for cellarr_frame-0.0.5-py3-none-any.whl:
Publisher:
publish-pypi.yml on CellArr/cellarr-frame
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cellarr_frame-0.0.5-py3-none-any.whl -
Subject digest:
48653f45eecee37b6e8d3c3d3b9ff215330e028291c66635bbb17dbc4e971f73 - Sigstore transparency entry: 913396383
- Sigstore integration time:
-
Permalink:
CellArr/cellarr-frame@de3e556c1ed56f0495125063f8cffe685a6c56b1 -
Branch / Tag:
refs/tags/0.0.5 - Owner: https://github.com/CellArr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@de3e556c1ed56f0495125063f8cffe685a6c56b1 -
Trigger Event:
push
-
Statement type: