Parse and construct Python representations for datasets stored in RDS files
Project description
rds2py
Parse and construct Python representations for datasets stored in RDS files. rds2py
supports various base classes from R, and Bioconductor's SummarizedExperiment
and SingleCellExperiment
S4 classes. For more details, check out rds2cpp library.
Version 0.5.0 brings major changes to the package,
- Complete overhaul of the codebase using pybind11
- Streamlined readers for R data types
- Updated API for all classes and methods
Please refer to the documentation for the latest usage guidelines. Previous versions may have incompatible APIs.
The package provides:
- Efficient parsing of RDS files with minimal memory overhead
- Support for R's basic data types and complex S4 objects
- Vectors (numeric, character, logical)
- Factors
- Data frames
- Matrices (dense and sparse)
- Run-length encoded vectors (Rle)
- Conversion to appropriate Python/NumPy/SciPy data structures
- dgCMatrix (sparse column matrix)
- dgRMatrix (sparse row matrix)
- dgTMatrix (sparse triplet matrix)
- Preservation of metadata and attributes from R objects
- Integration with BiocPy ecosystem for Bioconductor classes
- SummarizedExperiment
- RangedSummarizedExperiment
- SingleCellExperiment
- GenomicRanges
- MultiAssayExperiment
Installation
Package is published to PyPI
pip install rds2py
# or install optional dependencies
pip install rds2py[optional]
Usage
If you do not have an RDS object handy, feel free to download one from single-cell-test-files.
Basic Usage
from rds2py import read_rds
r_obj = read_rds("path/to/file.rds")
The returned r_obj
either returns an appropriate Python class if a parser is already implemented or returns the dictionary containing the data from the RDS file.
Write-your-own-reader
In addition, the package provides the dictionary representation of the RDS file, allowing users to write their own custom readers into appropriate Python representations.
from rds2py import parse_rds
data = parse_rds("path/to/file.rds")
print(data)
if you know this RDS file contains an GenomicRanges
object, you can use the built-in reader or write your own reader to convert this dictionary.
from rds2py.read_granges import read_genomic_ranges
gr = read_genomic_ranges(data)
Type Conversion Reference
R Type | Python/NumPy Type |
---|---|
numeric | numpy.ndarray (float64) |
integer | numpy.ndarray (int32) |
character | list of str |
logical | numpy.ndarray (bool) |
factor | list |
data.frame | BiocFrame |
matrix | numpy.ndarray or scipy.sparse matrix |
dgCMatrix | scipy.sparse.csc_matrix |
dgRMatrix | scipy.sparse.csr_matrix |
Developer Notes
This project uses pybind11 to provide bindings to the rds2cpp library. Please make sure necessary C++ compiler is installed on your system.
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.5.1.tar.gz
.
File metadata
- Download URL: rds2py-0.5.1.tar.gz
- Upload date:
- Size: 461.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bf40b51ba87410a17244e898cdf95b19deec4ea3e7326619eb17eb35ae1461c |
|
MD5 | c3c7a7e4a6d8b7db0f83224bef4ae88b |
|
BLAKE2b-256 | 18e8e673aa74942c8a41ef14b188dc4d6f33ecfcdf547241427315a29994d5ca |
File details
Details for the file rds2py-0.5.1-cp312-cp312-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp312-cp312-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 688.2 kB
- Tags: CPython 3.12, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e15697bc36bddca4ebdf33aa176eb4ea91bd8cd9c05941c20a3c0511382a6e59 |
|
MD5 | 4bb779b3595367318e8f7d8b994e29ad |
|
BLAKE2b-256 | b5c7a9d07e03ceb5ff4be2c404c9c72e97ec64de40dc7114bba0a20e73fcdbdc |
File details
Details for the file rds2py-0.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 176.5 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ece7f11a644fd373d434288375f748f914f3dca179f9469867acd99b0e7caa25 |
|
MD5 | 4ed53fd2f13c4984b3f732cc1a40198a |
|
BLAKE2b-256 | 1d88833a8c7ed5a595385b67942e4805a2c54d2331238e64beea6c9f927d2291 |
File details
Details for the file rds2py-0.5.1-cp312-cp312-macosx_13_0_arm64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp312-cp312-macosx_13_0_arm64.whl
- Upload date:
- Size: 116.3 kB
- Tags: CPython 3.12, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09eddf95ea8ec2680a2f16b15415f936f500b298e3877f623cb65089a2197c5d |
|
MD5 | e529ab4d3918d3016e15b3f1b39690db |
|
BLAKE2b-256 | 5a30ce06ca664eec74fb329c5503db8ec897ce7d17c8756e0844ab6c92c39a41 |
File details
Details for the file rds2py-0.5.1-cp312-cp312-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp312-cp312-macosx_11_0_x86_64.whl
- Upload date:
- Size: 130.6 kB
- Tags: CPython 3.12, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef78e0e9668b1189d2260737c562b51282448b98ee9858358528cbd709e957a6 |
|
MD5 | 46e44f6f27096de345b5d8e9bc1f8e7e |
|
BLAKE2b-256 | 4386a1a5145f9756e3e35e5fdd9e798a7a50e26146e916a3f5e19aa97f04e08e |
File details
Details for the file rds2py-0.5.1-cp311-cp311-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp311-cp311-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 688.6 kB
- Tags: CPython 3.11, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33879e01d410a2b72122cd5552e405a68ca51a8554220b4e35e2f93437c730da |
|
MD5 | 65a5d3918366e1462f692c0e86b666d0 |
|
BLAKE2b-256 | a25827bff3cce0829c545d399c04348dbb3f7cee3c8afcfd635169d903ba4e9b |
File details
Details for the file rds2py-0.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 177.6 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e305a40ec9ed03171d715a59e5febb507df1dc0e55036c53905329d3c9389cec |
|
MD5 | 179f1a2af9cf1db0c3a4c3c83f4c3df8 |
|
BLAKE2b-256 | f2b24cbcf2a30587165d58f0e80e598935c41fad2ebbee76f61f3088f691b94e |
File details
Details for the file rds2py-0.5.1-cp311-cp311-macosx_13_0_arm64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp311-cp311-macosx_13_0_arm64.whl
- Upload date:
- Size: 116.6 kB
- Tags: CPython 3.11, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55964001c404f3698975583c8159a3b0f8a5479b121564a4db109e8658f0a730 |
|
MD5 | b2f09705c1a8ed8b910c6e390c2cb8a8 |
|
BLAKE2b-256 | b2e2c372270b2a9f96998bf05b6ab2da362c843961666598b42b3314989abca4 |
File details
Details for the file rds2py-0.5.1-cp311-cp311-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp311-cp311-macosx_11_0_x86_64.whl
- Upload date:
- Size: 130.6 kB
- Tags: CPython 3.11, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74d8150d205136d715b08c11843f819869f23919d94cea1c87d7c0afcc45d978 |
|
MD5 | 8a92786662c06ff3bdd9c9ac426dca73 |
|
BLAKE2b-256 | dcd489d21b439b725ebd8ffc1965d5e605fa33f903de0739cc672e7edcc9880a |
File details
Details for the file rds2py-0.5.1-cp310-cp310-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp310-cp310-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 687.8 kB
- Tags: CPython 3.10, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1816f220e7b24983fa72ef02fbd8fd97b4c01a9c6d03c67904a24b7924abd70d |
|
MD5 | f91bf9690474f77236a6cd7157dd4693 |
|
BLAKE2b-256 | 08e021e7c557e0f55f16fbb1761e66e4b8bfbf7db46ee15cd341ac48c4e98854 |
File details
Details for the file rds2py-0.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 176.3 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | feb43883a509c7dfe00688901b049b2127884c9130ff69208169b7a27788aec1 |
|
MD5 | b21bca8f1b160d46c8c0648db5513ca5 |
|
BLAKE2b-256 | f9d809884740e104e927e2e6e9ef1ec66c8b7c120f17faa3ab43d9b3ed2815a1 |
File details
Details for the file rds2py-0.5.1-cp310-cp310-macosx_13_0_arm64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp310-cp310-macosx_13_0_arm64.whl
- Upload date:
- Size: 115.5 kB
- Tags: CPython 3.10, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b708cb3ccb962c5b7ad73e32454b8496719dac7737b2454698bcda9f3fb505f |
|
MD5 | 19d473601dd5fb7cc3d69df4c813d68a |
|
BLAKE2b-256 | cab4809cba21d67bec3988376e22abd85124c51c8fbf8d81a92aa2aeaf9e2ce5 |
File details
Details for the file rds2py-0.5.1-cp310-cp310-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp310-cp310-macosx_11_0_x86_64.whl
- Upload date:
- Size: 129.3 kB
- Tags: CPython 3.10, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70a144696ab515d78027af2c92e623801a4723398726e7a30aa903820abeb55a |
|
MD5 | cc214c5b3973ee0d2b6e5738c1369d2d |
|
BLAKE2b-256 | 17e2d35f46916d20ea46c41fad7cd11cc01be9c6adb7b3ed6eac9949d304c55f |
File details
Details for the file rds2py-0.5.1-cp39-cp39-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp39-cp39-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 688.0 kB
- Tags: CPython 3.9, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5ce6f67a93b53660f80435a38c05b303fbd3e6620ead5a95a975b1d02d36131 |
|
MD5 | 8f0e9eb7ad377e21e8f739921b57135e |
|
BLAKE2b-256 | 8782f8ac2b964111f013724218b076a193680f5f1d49078e18d84aea14245c9e |
File details
Details for the file rds2py-0.5.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 176.6 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 191f6c444fae2e6b56db47fdf0cd44fa8b9462be8ef8741bd85465600e71ff4b |
|
MD5 | cdf017f04e78d0a8eaf06f3984e0e592 |
|
BLAKE2b-256 | f35d227603b8dcadb78ddfc7b2022e006983c7b83e4eb9601de6e7933f636479 |
File details
Details for the file rds2py-0.5.1-cp39-cp39-macosx_13_0_arm64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp39-cp39-macosx_13_0_arm64.whl
- Upload date:
- Size: 115.6 kB
- Tags: CPython 3.9, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 346a0a953e610ccb7332a70e38ccb544cdc0d5067f61707dc76beeb30a25a66e |
|
MD5 | 4094ba614f5f67bf0e8190ebe3201d18 |
|
BLAKE2b-256 | 05f38c53fcffc88417e90f443c12335c1ca3572153c8508c6c5910fa6dc61d7d |
File details
Details for the file rds2py-0.5.1-cp39-cp39-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp39-cp39-macosx_11_0_x86_64.whl
- Upload date:
- Size: 129.4 kB
- Tags: CPython 3.9, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7ac6fa1af76cf7392e332c01ae062a3e4a9b75cbcf5debc87aae21a5d2ccd04 |
|
MD5 | a9cf325477b8327388af25c19750506a |
|
BLAKE2b-256 | b386beefa62865b6336d74e7950205c48b696c61a477653f75146d703c414235 |
File details
Details for the file rds2py-0.5.1-cp38-cp38-musllinux_1_1_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp38-cp38-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 687.7 kB
- Tags: CPython 3.8, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52312d73d15195b29af1f1cb2c60bcc21b6c45b9ae77df3b986b432d3e7fed35 |
|
MD5 | 43a4b03224a1d35f6f872eea127d8fa3 |
|
BLAKE2b-256 | 4f7ca8218a888e475e8699d70ded3bd82d58fdd3b86b244af0d0d05bb26d6cbe |
File details
Details for the file rds2py-0.5.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 176.3 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e06100c917d546e36d3a129e12784ec467f5b28b9492e414cb46e868db9075f |
|
MD5 | 9637f2ab2d9bd988c30bb55266fb6bf7 |
|
BLAKE2b-256 | ebe9d3f54ea696a7dd14ce32603ccdc17712facb21c5c6d12e488fa9f152db56 |
File details
Details for the file rds2py-0.5.1-cp38-cp38-macosx_13_0_arm64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp38-cp38-macosx_13_0_arm64.whl
- Upload date:
- Size: 115.3 kB
- Tags: CPython 3.8, macOS 13.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50be5e5f183d5357036e7c435c307f326aac69bfc6aac9179e60d2bc7cea34df |
|
MD5 | 0282354175c9412e3a7c401a22b0006e |
|
BLAKE2b-256 | 900f5fa3a5147f553cce8a6acc056e88573a666ef4850995a0760d582be7cfb5 |
File details
Details for the file rds2py-0.5.1-cp38-cp38-macosx_11_0_x86_64.whl
.
File metadata
- Download URL: rds2py-0.5.1-cp38-cp38-macosx_11_0_x86_64.whl
- Upload date:
- Size: 129.1 kB
- Tags: CPython 3.8, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 877b06814b5019a10579d36b7ddd7206ad2f904f124e87801f5f5b104984be0a |
|
MD5 | d7725034650061d4f56f66f90f8b2175 |
|
BLAKE2b-256 | 54ac50f48a057bbcbad198886ac9527161c1e6680718abd1dad2733b01fdf7c2 |