From 5ab08f6ddfc4f107b87741e72f1c79a4933f8d68 Mon Sep 17 00:00:00 2001 From: Jayaram Kancherla Date: Fri, 16 Jan 2026 22:58:35 -0800 Subject: [PATCH 1/2] Switch to the compressed granges list --- setup.cfg | 11 ++++++----- src/rds2py/read_granges.py | 26 ++++++++++++++++---------- tests/test_granges.py | 4 ++-- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/setup.cfg b/setup.cfg index 917b4e4..b853bae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -66,11 +66,12 @@ optional = hdf5array scipy biocframe - genomicranges>=0.4.9 - summarizedexperiment>=0.4.1 - singlecellexperiment>=0.4.1 - multiassayexperiment - compressed_lists>=0.3.0 + genomicranges>=0.8.4 + summarizedexperiment>=0.6.5 + singlecellexperiment>=0.6.2 + multiassayexperiment>=0.6.0 + compressed_lists>=0.4.4 + biocutils>=0.3.4 # Add here test requirements (semicolon/line-separated) testing = diff --git a/src/rds2py/read_granges.py b/src/rds2py/read_granges.py index 6d7181e..40f3be0 100644 --- a/src/rds2py/read_granges.py +++ b/src/rds2py/read_granges.py @@ -76,21 +76,22 @@ def read_genomic_ranges(robject: dict, **kwargs): def read_granges_list(robject: dict, **kwargs): - """Convert an R `GenomicRangesList` object to a Python :py:class:`~genomicranges.GenomicRangesList`. + """Convert an R `CompressedGenomicRangesList` object to a Python :py:class:`~genomicranges.grangeslist.CompressedGenomicRangesList`. Args: robject: - Dictionary containing parsed GenomicRangesList data. + Dictionary containing parsed CompressedGenomicRangesList data. **kwargs: Additional arguments. Returns: - A Python `GenomicRangesList` object containing containing multiple + A Python `CompressedGenomicRangesList` object containing containing multiple `GenomicRanges` objects. """ - from genomicranges import GenomicRangesList + from compressed_lists import Partitioning + from genomicranges import CompressedGenomicRangesList _cls = get_class(robject) @@ -106,11 +107,16 @@ def read_granges_list(robject: dict, **kwargs): _partitionends = _dispatcher(robject["attributes"]["partitioning"]["attributes"]["end"], **kwargs) - _grelist = [] + _part_obj = Partitioning(ends=_partitionends, names=_groups) - current = 0 - for _pend in _partitionends: - _grelist.append(_gre[current:_pend]) - current = _pend + element_metadata = None + if "elementMetadata" in robject["attributes"]: + element_metadata = _dispatcher(robject["attributes"]["elementMetadata"], **kwargs) - return GenomicRangesList(ranges=_grelist, names=_groups) + metadata = None + if "metadata" in robject["attributes"]: + metadata = _dispatcher(robject["attributes"]["metadata"], **kwargs) + + return CompressedGenomicRangesList( + unlist_data=_gre, partitioning=_part_obj, element_metadata=element_metadata, metadata=metadata + ) diff --git a/tests/test_granges.py b/tests/test_granges.py index 93d90e5..292b3ed 100644 --- a/tests/test_granges.py +++ b/tests/test_granges.py @@ -1,6 +1,6 @@ from rds2py import read_rds -from genomicranges import GenomicRanges, GenomicRangesList +from genomicranges import GenomicRanges, CompressedGenomicRangesList import numpy as np __author__ = "jkanche" @@ -32,5 +32,5 @@ def test_granges(): def test_granges_list(): gr = read_rds("tests/data/grangeslist.rds") - assert isinstance(gr, GenomicRangesList) + assert isinstance(gr, CompressedGenomicRangesList) assert len(gr) == 5 From 000e771ace2ff8eb17a0a56ccd8686557dba4a84 Mon Sep 17 00:00:00 2001 From: Jayaram Kancherla Date: Fri, 16 Jan 2026 23:02:34 -0800 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 28f9bbc..6bf6c55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ # Changelog -## Version 0.8.0 +## Version 0.8.0 - 0.8.1 - Implement parsers for compressed list objects. +- Switch `GenomicRangesList` to the `CompressedGenomicRangesList` implementation. ## Version 0.7.0 - 0.7.3