Parse and read RDS files as Python representations
Project description
rds2py
Parse and construct Python representations for datasets stored in RDS files. rds2py
supports a few base classes from R and Bioconductor's SummarizedExperiment
and SingleCellExperiment
S4 classes. This is possible because of Aaron's rds2cpp library.
The package uses memory views (except for strings) to access the same memory from C++ in Python (through Cython of course). This is especially useful for large datasets so we don't make multiple copies of data.
Install
Package is published to PyPI
pip install rds2py
Usage
If you do not have an RDS object handy, feel free to download one from single-cell-test-files.
from rds2py import as_summarized_experiment, read_rds
rObj = read_rds(<path_to_file>)
Once we have a dictionary representation of the RDS file, we can now build useful Python representations from these objects.
This rObj
contains two keys
data
: If atomic entities, contains the numpy view of the memory space.attributes
: Additional properties available for the object.
The package provides friendly functions to easily convert a few R representations to Python.
from rds2py import as_spase_matrix, as_summarized_experiment
# to convert an robject to a sparse matrix
sp_mat = as_sparse(rObj)
# to convert an robject to SCE
sce = as_summarized_experiment(rObj)
For more examples converting data.frame
, dgCMatrix
, dgRMatrix
, dgTMatrix
to Python, checkout the documentation.
Developer Notes
This project uses Cython to provide bindings from C++ to Python.
Steps to setup dependencies -
- git submodules is initialized in
extern/rds2cpp
cmake .
inextern/rds2cpp
directory to download dependencies, especially thebyteme
library
First one needs to build the extern library, this would generate a shared object file to src/rds2py/core-[*].so
python setup.py build_ext --inplace
For typical development workflows, run
python setup.py build_ext --inplace && tox
Note
This project has been set up using PyScaffold 4.5. 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 Distributions
File details
Details for the file rds2py-0.3.1.tar.gz
.
File metadata
- Download URL: rds2py-0.3.1.tar.gz
- Upload date:
- Size: 274.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4722e8f1cdcccbe599062677324e67bc5066485bcd462caaadac2ce86bc06a84 |
|
MD5 | 0b5348f4ea907ab7c4bbf326e343553e |
|
BLAKE2b-256 | 5017ed1562ad92d7ebb0cdfc8d35bb6efad74c5667d78d6d35fac4e30b0d370f |
File details
Details for the file rds2py-0.3.1-cp311-cp311-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: rds2py-0.3.1-cp311-cp311-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.11, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe85271357ebc92bbb202ce4fd68bd1538ab095cf3c67c949c51fe403cc0976d |
|
MD5 | 4886c9cb5ae1051cb9d8e32e08a4ed5d |
|
BLAKE2b-256 | 6727f4e78842d20912a74af3b2465635af86f8487c6a87d7ad0c8904debf0d16 |
File details
Details for the file rds2py-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: rds2py-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 239873f1ace60bf2bef6ab4e3ef9bb9c44d78cd843100a7b31c20bc6413a9bb9 |
|
MD5 | f48558cf87d9c9cdf0d3ae2420312964 |
|
BLAKE2b-256 | b31eaf26222f7298dcf0249831c60d079a67cdf9f92348fbde374a8127993bc3 |
File details
Details for the file rds2py-0.3.1-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: rds2py-0.3.1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 320.8 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2fa4a69d687e6133fcf5805130f7332fd7fb4ba78f24bf1d603b9eb82927907 |
|
MD5 | f679eb889710b21616ee29539250548f |
|
BLAKE2b-256 | 7eb4e1b9085f656bd21c25cdb6d8cfd7b3c5bd93e022c2d5711c0f1fe2a73a8b |
File details
Details for the file rds2py-0.3.1-cp311-cp311-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: rds2py-0.3.1-cp311-cp311-macosx_10_9_x86_64.whl
- Upload date:
- Size: 332.6 kB
- Tags: CPython 3.11, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18f57d959ff3ef0d673e89a921cb19d8dca86f76d1e8a843dcb9b1475e284c96 |
|
MD5 | 71b6cdc7311f408e4d5dba86616686e9 |
|
BLAKE2b-256 | c38f4317228f163f8c14191014a67da03675851449047eaa0b0a4503beeda2a6 |
File details
Details for the file rds2py-0.3.1-cp310-cp310-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: rds2py-0.3.1-cp310-cp310-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.10, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93a2b3cffcca924cbced9b9a5b276fd619e0913007330d4dc2865f1f43a8b909 |
|
MD5 | 88ef50065f33e4e40d7c570e6009c92a |
|
BLAKE2b-256 | 5a16844a82ca998aa1acbbe5e1ead1627ba570dbc10204e42b922fb1fee1f79d |
File details
Details for the file rds2py-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: rds2py-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd3d56ee4218198560eef9a184adc5ed41257e268cbdb7084e5c9728c12b82f4 |
|
MD5 | 36d6f69eea99b8a492356e6f1b860607 |
|
BLAKE2b-256 | 04cf0325a92c1e37a0ff68b808ee3a8ab68dce840386299b8f5fac4cb2dfb645 |
File details
Details for the file rds2py-0.3.1-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: rds2py-0.3.1-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 320.3 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 162f649feebaf5e668963d3502d814a66e5d97876ec5d14097105bd5ab8b6034 |
|
MD5 | 77676563cf694ce25724f350bbf6ed83 |
|
BLAKE2b-256 | 63a7ba4d96f88a9860e477bdfd083ab3f546fdf15894659fe299b44600246457 |
File details
Details for the file rds2py-0.3.1-cp310-cp310-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: rds2py-0.3.1-cp310-cp310-macosx_10_9_x86_64.whl
- Upload date:
- Size: 332.3 kB
- Tags: CPython 3.10, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0482002b41f18a695f24c0c5d7b1a4fcb64b98cb37269e14b82a038936828fee |
|
MD5 | d605b50b50cb63f8f6ed6fd4dbad7cc2 |
|
BLAKE2b-256 | 52fabf6f145c3971e087f5795c873c84751677d3fc16e402394910caf01dfd42 |
File details
Details for the file rds2py-0.3.1-cp39-cp39-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: rds2py-0.3.1-cp39-cp39-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.9, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23333ea5ced49a39fa12bdc16fb897a4ee590b61d30d0838eae952e7523e2f00 |
|
MD5 | 276f7f5bfbac7b21eb6223804c965826 |
|
BLAKE2b-256 | 4263b125862f5a9ed2ef3ca5914d541b10bdcb50f6d18d14c2644ea6ffea6760 |
File details
Details for the file rds2py-0.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: rds2py-0.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 122d25535f029e1da38269a7071be1e12afb0f7a8c8799897d1170723df02211 |
|
MD5 | f01eb61e339922a4eaeb3cc6bb5f36c2 |
|
BLAKE2b-256 | 297368edd3101eebb7fa193fc47dbc3f4f7ede9d17788204a2fb3af14648c9a3 |
File details
Details for the file rds2py-0.3.1-cp39-cp39-macosx_11_0_arm64.whl
.
File metadata
- Download URL: rds2py-0.3.1-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 320.7 kB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f996120bc923a3c34d8974e3de2441e3efdedf8b7adb9b217ce038cbf236d49a |
|
MD5 | c49625a845f3e7067174dde323c8097b |
|
BLAKE2b-256 | eb14ff10784a67f3ad0095c4e1c8af2590c3ca01a6d7a4c985a467ba42e922e2 |
File details
Details for the file rds2py-0.3.1-cp39-cp39-macosx_10_9_x86_64.whl
.
File metadata
- Download URL: rds2py-0.3.1-cp39-cp39-macosx_10_9_x86_64.whl
- Upload date:
- Size: 332.9 kB
- Tags: CPython 3.9, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed0ecffce5b9b5a3539bd802af3dc358572a7b3945af325140196e07f0b5d68c |
|
MD5 | 56eab301870767c48f46528cc6812618 |
|
BLAKE2b-256 | f6f39fd8054b8cb37703b511da83d667a610c8a96ef530a294a4f093e81a52d1 |