{"id":21962530,"url":"https://github.com/biocpy/rds2py","last_synced_at":"2025-04-23T21:26:29.004Z","repository":{"id":62776976,"uuid":"562060470","full_name":"BiocPy/rds2py","owner":"BiocPy","description":"Read RDS files, in Python","archived":false,"fork":false,"pushed_at":"2025-04-14T16:28:57.000Z","size":1080,"stargazers_count":22,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T17:33:44.395Z","etag":null,"topics":["python","r"],"latest_commit_sha":null,"homepage":"https://biocpy.github.io/rds2py/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BiocPy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-05T07:13:25.000Z","updated_at":"2025-03-13T23:38:46.000Z","dependencies_parsed_at":"2023-02-09T13:31:15.367Z","dependency_job_id":"92dc309d-9ea2-47f6-94ab-29d781cd237f","html_url":"https://github.com/BiocPy/rds2py","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiocPy%2Frds2py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiocPy%2Frds2py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiocPy%2Frds2py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BiocPy%2Frds2py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BiocPy","download_url":"https://codeload.github.com/BiocPy/rds2py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250516376,"owners_count":21443613,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","r"],"created_at":"2024-11-29T10:43:16.678Z","updated_at":"2025-04-23T21:26:28.984Z","avatar_url":"https://github.com/BiocPy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Project generated with PyScaffold](https://img.shields.io/badge/-PyScaffold-005CA0?logo=pyscaffold)](https://pyscaffold.org/)\n[![PyPI-Server](https://img.shields.io/pypi/v/rds2py.svg)](https://pypi.org/project/rds2py/)\n![Unit tests](https://github.com/BiocPy/rds2py/actions/workflows/run-tests.yml/badge.svg)\n\n# rds2py\n\nParse 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](https://github.com/LTLA/rds2cpp)._**\n\n---\n\n**Version 0.5.0** brings major changes to the package,\n\n- Complete overhaul of the codebase using pybind11\n- Streamlined readers for R data types\n- Updated API for all classes and methods\n\nPlease refer to the [documentation](https://biocpy.github.io/rds2py/) for the latest usage guidelines. Previous versions may have incompatible APIs.\n\n---\n\nThe package provides:\n\n- Efficient parsing of RDS files with _minimal_ memory overhead\n- Support for R's basic data types and complex S4 objects\n  - Vectors (numeric, character, logical)\n  - Factors\n  - Data frames\n  - Matrices (dense and sparse)\n  - Run-length encoded vectors (Rle)\n- Conversion to appropriate Python/NumPy/SciPy data structures\n  - dgCMatrix (sparse column matrix)\n  - dgRMatrix (sparse row matrix)\n  - dgTMatrix (sparse triplet matrix)\n- Preservation of metadata and attributes from R objects\n- Integration with BiocPy ecosystem for Bioconductor classes\n  - SummarizedExperiment\n  - RangedSummarizedExperiment\n  - SingleCellExperiment\n  - GenomicRanges\n  - MultiAssayExperiment\n\n## Installation\n\nPackage is published to [PyPI](https://pypi.org/project/rds2py/)\n\n```shell\npip install rds2py\n\n# or install optional dependencies\npip install rds2py[optional]\n```\n\nBy default, the package does not install packages to convert python representations to BiocPy classes. Please consider installing all optional dependencies.\n\n## Usage\n\nIf you do not have an RDS object handy, feel free to download one from [single-cell-test-files](https://github.com/jkanche/random-test-files/releases).\n\n```python\nfrom rds2py import read_rds\nr_obj = read_rds(\"path/to/file.rds\")\n```\n\nThe 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.\n\nIn addition, the package provides the dictionary representation of the RDS file.\n\n```python\nfrom rds2py import parse_rds\n\nrobject_dict = parse_rds(\"path/to/file.rds\")\nprint(robject_dict)\n```\n\n### Write-your-own-reader\n\nReading RDS files as dictionary representations allows users to write their own custom readers into appropriate Python representations.\n\n```python\nfrom rds2py import parse_rds\n\nrobject = parse_rds(\"path/to/file.rds\")\nprint(robject)\n```\n\nif 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.\n\n```python\nfrom rds2py.read_granges import read_genomic_ranges\n\ngr = read_genomic_ranges(robject)\nprint(gr)\n```\n\n## Type Conversion Reference\n\n| R Type     | Python/NumPy Type                    |\n| ---------- | ------------------------------------ |\n| numeric    | numpy.ndarray (float64)              |\n| integer    | numpy.ndarray (int32)                |\n| character  | list of str                          |\n| logical    | numpy.ndarray (bool)                 |\n| factor     | list                                 |\n| data.frame | BiocFrame                            |\n| matrix     | numpy.ndarray or scipy.sparse matrix |\n| dgCMatrix  | scipy.sparse.csc_matrix              |\n| dgRMatrix  | scipy.sparse.csr_matrix              |\n\n## Developer Notes\n\nThis project uses pybind11 to provide bindings to the rds2cpp library. Please make sure necessary C++ compiler is installed on your system.\n\n\u003c!-- pyscaffold-notes --\u003e\n\n## Note\n\nThis project has been set up using PyScaffold 4.5. For details and usage\ninformation on PyScaffold see https://pyscaffold.org/.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiocpy%2Frds2py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiocpy%2Frds2py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiocpy%2Frds2py/lists"}