BiocFrame
This package provides BiocFrame class, a dataframe-like representation similar to a pandas, with support for flexible and nested objects.
BiocFrame makes no assumption on the types of the columns, the minimum requirement is each column implements length: __len__ and slice: __getitem__ operations.
To get started, install the package from PyPI
pip install biocframe
Usage
Lets create a BiocFrame from a dictionary
from random import random
from biocframe import BiocFrame
bframe = BiocFrame(
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
Accessor methods/properties are available to access column names, row names and dims.
# find the dimensions
print(bframe.dims)
# get the column names
print(bframe.column_names)
Setters
Using the Pythonic way to set properties
# set new column names
bframe.column_names = [..., new_column_names, ...]
print(bframe.column_names)
# add or reassign columns
bframe["score"] = range(200, 400)
Slice the BiocFrame
Currently slicing is only supported by indices or names (column names or row names). A future version may implement pandas query-like operations.
sliced_bframe = bframe[3:7, 2:5]
For more use cases including subset, checkout the documentation
Note
This project has been set up using PyScaffold 4.5. For details and usage information on PyScaffold see https://pyscaffold.org/.
Release files for biocframe 0.3.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| BiocFrame-0.3.12.tar.gz | 31.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| BiocFrame-0.3.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.8 kB
Release files / BiocFrame-0.3.12.tar.gz
| Download URL | BiocFrame-0.3.12.tar.gz |
|---|---|
| Size | 31.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
814771120e1b77b762bc8b8569ffcf15d6eb2a4ec662197a0a1f01738012aac7
|
|
BLAKE2b-256 checksum How to use checksums |
4bccdc22e6f6cf3359fc4e3dfed6af700506ef74a23136fbad545b3c65dcb6e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / BiocFrame-0.3.12-py3-none-any.whl
| Download URL | BiocFrame-0.3.12-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5133dd97e610d6a854b8fd44cbb3ef4c78ccecdc1d8110754fee020c79acdbff
|
|
BLAKE2b-256 checksum How to use checksums |
7797b8d0026c51f65dbae5efa8b5d64052f128499474f754878de9726eba7c42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|