Skip to main content

BiocFrame class to support complex types in Genomics. The goal is to not compete with `Pandas` but be inter-operable at some point.

Project description

Project generated with PyScaffold

BiocFrame

BiocFrame provides a base BiocFrame 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 BiocFrame from a dictionary

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.columnNames)

Setters

Using the Pythonic way to set properties

# set new column names
bframe.columnNames = [... new colnames ...]
print(bframe.columnNames)

# 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.3. For details and usage information on PyScaffold see https://pyscaffold.org/.

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

BiocFrame-0.2.2.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

BiocFrame-0.2.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file BiocFrame-0.2.2.tar.gz.

File metadata

  • Download URL: BiocFrame-0.2.2.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for BiocFrame-0.2.2.tar.gz
Algorithm Hash digest
SHA256 a02f36294ff58d538710e7a16cec90189b7e4e91fd29a470a5bb30ac7b48aea6
MD5 1110d5587432c5d4d0bab1450df39d6c
BLAKE2b-256 d70f4dd33bb4c2ada094b00f8260f89348f24efa6185c3ad38de7ca612a53411

See more details on using hashes here.

File details

Details for the file BiocFrame-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: BiocFrame-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for BiocFrame-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9946751fc81c6b0d7c98c535dadcb003e8543410d3d67ab6bed4c13cf765fa28
MD5 4ffd00cd69a5159b9aaee8f58c59ba8a
BLAKE2b-256 bb3563a39a1c40f19a713ae79e44f077ba525aecea5e1fc2d2dfc5ddb74b8595

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page