Skip to main content

Parse and save Python objects as **RDS or RData** files

Project description

Project generated with PyScaffold PyPI-Server Unit tests

rds2py

Parse and save Python objects as RDS or RData files. rds2py supports various base classes from R, and Bioconductor's SummarizedExperiment and SingleCellExperiment S4 classes. For more details, check out rds2cpp library.

Installation

Package is published to PyPI

pip install rds2py

# or install optional dependencies
pip install rds2py[optional]

By default, the package does not install packages to convert python representations to BiocPy classes. Please consider installing all optional dependencies.

Usage

[!NOTE]

If you do not have an RDS object handy, feel free to download one from single-cell-test-files.

from rds2py import read_rds, read_rda
r_obj = read_rds("path/to/file.rds") # or read_rda("path/to/file.rda")

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.

Save RDS/RData files

You can also construct RDS or RData files from Python objects. rds2py supports writing atomic types, generic dictionaries/lists, and BiocPy objects.

from rds2py import write_rds, write_rda
import numpy as np

# Write atomic types
write_rds(np.array([1, 2, 3], dtype=np.int32), "path/to/file.rds")

# Write complex objects
from genomicranges import GenomicRanges
from iranges import IRanges

gr = GenomicRanges(
    seqnames=["chr1", "chr2"],
    ranges=IRanges(start=[1, 2], width=[10, 20]),
    strand=["+", "-"]
)
write_rds(gr, "path/to/granges.rds")

Write-your-own-reader

Reading RDS or RData files as dictionary representations allows users to write their own custom readers into appropriate Python representations.

from rds2py import parse_rds, parse_rda

robject = parse_rds("path/to/file.rds") # or use parse_rda for rdata files
print(robject)

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(robject)
print(gr)

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

and integration with BiocPy ecosystem for Bioconductor classes

  • SummarizedExperiment
  • RangedSummarizedExperiment
  • SingleCellExperiment
  • GenomicRanges
  • MultiAssayExperiment

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rds2py-0.10.0.tar.gz (479.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

rds2py-0.10.0-cp313-cp313-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

rds2py-0.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (224.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

rds2py-0.10.0-cp313-cp313-macosx_11_0_arm64.whl (168.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rds2py-0.10.0-cp312-cp312-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

rds2py-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (224.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

rds2py-0.10.0-cp312-cp312-macosx_11_0_arm64.whl (168.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rds2py-0.10.0-cp311-cp311-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

rds2py-0.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (221.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

rds2py-0.10.0-cp311-cp311-macosx_11_0_arm64.whl (167.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rds2py-0.10.0-cp310-cp310-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

rds2py-0.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (220.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

rds2py-0.10.0-cp310-cp310-macosx_11_0_arm64.whl (165.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file rds2py-0.10.0.tar.gz.

File metadata

  • Download URL: rds2py-0.10.0.tar.gz
  • Upload date:
  • Size: 479.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rds2py-0.10.0.tar.gz
Algorithm Hash digest
SHA256 39428bcd63e1959831e6a6ef2e0ac8760f5d39215fb44127e51556fd2a520abc
MD5 9f4dec99272847de1e341c7a065b60a3
BLAKE2b-256 4b4933d06d3658fb57debf50c70430efa6a749b6e95a9c3d2b492a1c395779b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for rds2py-0.10.0.tar.gz:

Publisher: publish-pypi.yml on BiocPy/rds2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rds2py-0.10.0-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rds2py-0.10.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0b0cd4a0ec8f43da78bb76b69bd8938c611fd28309a94196fd7228890d0aca9f
MD5 7e11e47a295199fbba945b5047f244fc
BLAKE2b-256 434409328b98c8006caa659e0395e49bf1551c063987c9ec4ada7ce3af5c149b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rds2py-0.10.0-cp313-cp313-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/rds2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rds2py-0.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rds2py-0.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 78fca96dd2e55b805461576bab027ec4c454901a6745e55aefa409c74840de84
MD5 15f8531968325aed8281ee063de0fdfa
BLAKE2b-256 22e51abd4f8ed2f1a7087c2c6fcf83c2c7b8c2eabafc3d5cba5e3bc07b9bf4ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for rds2py-0.10.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/rds2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rds2py-0.10.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rds2py-0.10.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1fae0d2942e34b601de9592068d213d14d72efcd78b6faefa461d5fcfc6bffe7
MD5 2deebb853814e2d157331af0b4803a69
BLAKE2b-256 ab6105b9cf6b6d0b10acafc83894b0eee627a936be2033f2240f731ded8bd224

See more details on using hashes here.

Provenance

The following attestation bundles were made for rds2py-0.10.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on BiocPy/rds2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rds2py-0.10.0-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rds2py-0.10.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0397697a617f543c079dd3a25af67db3fd5f460cb64474753b1d90e6d884c2d6
MD5 533783f6f8febd1b690f0e2488209d01
BLAKE2b-256 0d41034aa362bc73e6a6cabb74d7fbbb711cd13c2354c05de7cc025e47cb85bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for rds2py-0.10.0-cp312-cp312-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/rds2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rds2py-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rds2py-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5a407fcd2874a87501637642565c28f7f0c9c98755352079ce5da61fa7193336
MD5 518b5cb3f4e7ba41ad0521fc73b68d61
BLAKE2b-256 c41644e48034d7709a2f930d7dbfeb4623192484ab83abff01acfae6cf3868d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for rds2py-0.10.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/rds2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rds2py-0.10.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rds2py-0.10.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b0d7d7c53f65ca394a7e75f31af7ced4dbf25bc705b32153de9477a7a950fb14
MD5 854bb1483ebf01e20108245ffc001d02
BLAKE2b-256 8e0ccb317556cca46fb8f55ad5e9689c8dc774b9886576692506109cf318705f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rds2py-0.10.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on BiocPy/rds2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rds2py-0.10.0-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rds2py-0.10.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 66e54c1de9481f69b0e1b3a8341da44d3a7c317d631ffdff9b5ca54efffe3ecc
MD5 4eabbb2d7c39a002b8c2fc4bdac03ad9
BLAKE2b-256 f83ec56f243f5546dfc7c3998692bbafc0f02bd468d250e3296574f98ede50d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for rds2py-0.10.0-cp311-cp311-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/rds2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rds2py-0.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rds2py-0.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a22474d824ea7ddfdd203a71f80203115b65b329a2853e62f374320104c98b4b
MD5 d824504a3de18f3d423783c673d56bc7
BLAKE2b-256 390635b90c9c15f1f27c389b2eee022e458d991b818e6208b4aec1172e62a48b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rds2py-0.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/rds2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rds2py-0.10.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rds2py-0.10.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7f26f906209634f4555734eb15595ce2c43e7b2d0d74ef0e0d569f5b4cc16d34
MD5 e04282925d6abd2a75e986ed2dd1dc05
BLAKE2b-256 c59b93270a52e101cb948cc75220267e7dc8ccb823bccc9fcb6c7f27de228b1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rds2py-0.10.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on BiocPy/rds2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rds2py-0.10.0-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for rds2py-0.10.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 08779a73f513f91c7435fdd1a5f0907f397a2b60c22c465270b39dcc65ca6963
MD5 302fd2d86ae3ce33dd1dc25ceb2459a4
BLAKE2b-256 c5a70c7a73ff9b263cb2467c91eeb519ae766086bb3449e26aa895b70ec52820

See more details on using hashes here.

Provenance

The following attestation bundles were made for rds2py-0.10.0-cp310-cp310-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/rds2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rds2py-0.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rds2py-0.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7ead0708e568687a2b37c488911fdadf6f2723fd720e1e8e3f4a58386e8b7d0b
MD5 74e0efb8300870431cd106bbc2319b9a
BLAKE2b-256 e2e82b9ad3c4bf64ffd87315c06b8d24ec2a7be3460dd9b23ee8214a520d742c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rds2py-0.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/rds2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rds2py-0.10.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rds2py-0.10.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5f00ac7a82c749dfef7a047696801251437d37433c922b5759e1e8afb0ff3dae
MD5 94eea7222e6230a5ed8d2c69b39ba4a0
BLAKE2b-256 45334c0ad9bf542377175a167bdc469825e3973fc7d68b7b0a746065aaad72bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for rds2py-0.10.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on BiocPy/rds2py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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