Generics for core data structures in biocpy
Project description
BiocGenerics
This package aims to provide common generics, much like R/Bioconductor. These generics allow users to operate on different objects is a consistent and reliable way.
Install
Install package from PyPI
pip install biocgenerics
Combine
Combine provide multiple functions to concatenate sequences and array-like objects.
combine_seqs
: Combine 1-dimensional sequences or vector-like objects.combine_rows
: Combine n-dimensional or DataFrame like objects along the first dimension.combine_cols
: Combine n-dimensional or DataFrame like objects along the second dimension.
from biocgenerics import combine_seqs, combine_rows
# example to combine multiple sequences
x = [1, 2, 3]
y = [0.1, 0.2]
print(combine_seqs(x, y))
# Works across types as well,
# e.g. sparse and dense matrices
num_cols = 20
x = np.ones(shape=(10, num_cols))
y = sp.identity(num_cols)
print(combine_rows(x, y))
Additionally, the combine
generic, automatically dispatches to either combine_seqs
or combine_cols
methods depending on the inputs.
Set and Access names
Reliably access row and column names of Dataframe-like objects.
rownames
: Access row names of the object.set_rownames
: Set new row names.colnames
: Access column names.set_colnames
: Set new column names.
import pandas as pd
from biocgenerics import rownames
df1 = pd.DataFrame([["a", 1], ["b", 2]], columns=["letter", "number"])
rownames(df1)
Check out the S4Vectors package for more information.
Note
This project has been set up using PyScaffold 4.4. 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
Built Distribution
Hashes for BiocGenerics-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df09a4f54298650ef825e98c49662cc2125bb1a1d18ce150711fcc8303edc9fb |
|
MD5 | 364f556d5ee98d776f12754075b10f1c |
|
BLAKE2b-256 | c5a800ec34cc9a7ab91a4f10b245578e724aca7432e145f7b6d9038c450df491 |