Dataframe class to support complex types in Genomics. The goal is to not compete with Pandas but will be inter-operable at some point.
Project description
BiocFrame
BiocFrame provides a base Dataframe
class, intended to be a flexible data structure compared to Pandas DataFrame
This would be interoperable with pandas but will support usecases in genomics.
Install
Package is published to PyPI
pip install biocframe
Usage
Lets create a DataFrame
from a dictionary
from biocframe import DataFrame
df = DataFrame(
data = {
"seqnames": [
"chr1",
"chr2",
"chr2",
"chr2",
"chr1",
"chr1",
"chr3",
"chr3",
"chr3",
"chr3",
]
* 20,
"starts": range(100, 300),
"ends": range(110, 310),
"strand": ["-", "+", "+", "*", "*", "+", "+", "+", "-", "-"] * 20,
"score": range(0, 200),
"GC": [random() for _ in range(10)] * 20,
}
)
Access Properties
A couple of accessor methods/properties are available to access column names and dims
# find the dimensions
print(df.dims)
# get the column names
print(df.colnames)
Setters
Using the Pythonic way to set values
# set new column names
df.colnames = [... new colnames ...]
print(df.colnames)
# add or reassign columns
df["score"] = range(200, 400)
Slice the DataFrame
Currently slicing is only supported by indices. A future version may implement pandas query like operations.
sliced_df = df[3:7, 2:5]
For more use cases including subset, checkout the documentation
Note
This project has been set up using PyScaffold 4.3. For details and usage information on PyScaffold see https://pyscaffold.org/.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file BiocFrame-0.1.tar.gz
.
File metadata
- Download URL: BiocFrame-0.1.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fbf514acf0bb676f3ee6b9b102bc376c7f2b57ad94fe7d0e6defd89f415b08b |
|
MD5 | 198401a7261f0b4683f2132588b8ee9c |
|
BLAKE2b-256 | 89b0acb26a1b7d9ccd6815e666be0590770ef61bce53f83ce61bd1df630d940d |
File details
Details for the file BiocFrame-0.1-py3-none-any.whl
.
File metadata
- Download URL: BiocFrame-0.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57f5080530bce81d066e8f4480bb5b24a3a3c88a1b5c665233bd51cd1a07e8b5 |
|
MD5 | 28a4bb4d3512f0106aede54ecf22bbc6 |
|
BLAKE2b-256 | fc811c27093247ba7e2ded43eba0c47f19e171a9694de2cdf1613f1ba66d32e9 |