Skip to content

Commit

Permalink
Don't use alt functions to read and save the base SE class. (#3)
Browse files Browse the repository at this point in the history
* Don't use alt functions to read and save objects.

This is simpler and avoids repeated calls to the override when traversing down
the SCE class hierarchy via save_object() and read_object().

This reverts commit 3960958.
  • Loading branch information
LTLA authored Oct 23, 2024
1 parent 3960958 commit a7ed25d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ python_requires = >=3.8
# For more information, check out https://semver.org/.
install_requires =
importlib-metadata; python_version<"3.8"
dolomite-base>=0.2.4
dolomite-se>=0.1.3
dolomite-base>=0.3.0
dolomite-se>=0.2.0
singlecellexperiment>=0.4.5


Expand Down
5 changes: 3 additions & 2 deletions src/dolomite_sce/read_single_cell_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os

import dolomite_base as dl
import dolomite_se as dlse
from dolomite_base.read_object import read_object_registry
from singlecellexperiment import SingleCellExperiment

Expand Down Expand Up @@ -36,8 +37,8 @@ def read_single_cell_experiment(
with file-backed arrays in the assays.
"""

metadata["type"] = "range_summarized_experiment"
rse = dl.alt_read_object(path, metadata=metadata, **kwargs)
# see comments in read_ranged_summarized_experiment in dolomite_se.
rse = dlse.read_ranged_summarized_experiment(path, metadata=metadata, **kwargs)

_main_expt_name = None
if "main_experiment_name" in metadata["single_cell_experiment"]:
Expand Down
16 changes: 4 additions & 12 deletions src/dolomite_sce/save_single_cell_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os

import dolomite_base as dl
import dolomite_se as dlse
from singlecellexperiment import SingleCellExperiment
from summarizedexperiment import RangedSummarizedExperiment

Expand Down Expand Up @@ -63,18 +64,9 @@ def save_single_cell_experiment(
if alt_expts_args is None:
alt_expts_args = {}

## Convert to RSE
_rse = RangedSummarizedExperiment(
assays=x.get_assays(),
row_data=x.get_row_data(),
column_data=x.get_column_data(),
row_ranges=x.get_row_ranges(),
row_names=x.get_row_names(),
column_names=x.get_column_names(),
metadata=x.get_metadata(),
)
dl.alt_save_object(
_rse, path, data_frame_args=data_frame_args, assay_args=assay_args, **kwargs
# see comments in save_ranged_summarized_experiment in dolomite_se.
dlse.save_ranged_summarized_experiment(
x, path, data_frame_args=data_frame_args, assay_args=assay_args, **kwargs
)

# Modify OBJECT
Expand Down

0 comments on commit a7ed25d

Please sign in to comment.