Skip to content

Commit

Permalink
reading atomics
Browse files Browse the repository at this point in the history
  • Loading branch information
jkanche committed Mar 18, 2024
1 parent eec5503 commit b63e8d2
Show file tree
Hide file tree
Showing 16 changed files with 2,933 additions and 2,792 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[
Extension(
"rds2py.core",
["src/rds2py/lib/rds_parser.cpp", "src/rds2py/lib/parser.pyx"],
["src/rds2py/lib/rds2cpp_wrapper.cpp", "src/rds2py/lib/parser.pyx"],
include_dirs=[
"extern/rds2cpp/include",
"extern/rds2cpp/_deps/byteme-src/include",
Expand Down
12 changes: 2 additions & 10 deletions src/rds2py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,5 @@
finally:
del version, PackageNotFoundError

# from .core import *

from .interface import (
as_dense_matrix,
as_sparse_matrix,
as_pandas,
as_summarized_experiment,
)

from .rds_interface import read_rds, get_class
from .generics import read_rds, save_rds
from .read_atomic_vector import parse_boolean_vector, parse_double_vector, parse_integer_vector, parse_string_vector
22 changes: 0 additions & 22 deletions src/rds2py/atomics.py

This file was deleted.

21 changes: 16 additions & 5 deletions src/rds2py/generics.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
from functools import singledispatch
from importlib import import_module

from .rds_interface import get_class, load_rds
# from .atomics import parse_integer_vector
from .rdsutils import get_class, parse_rds

__author__ = "jkanche"
__copyright__ = "jkanche"
__license__ = "MIT"

REGISTRY = {}
REGISTRY = {
"integer_vector": "rds2py.parse_integer_vector",
"boolean_vector": "rds2py.parse_boolean_vector",
"string_vector": "rds2py.parse_string_vector",
"double_vector": "rds2py.parse_double_vector",

}


@singledispatch
Expand Down Expand Up @@ -39,12 +46,16 @@ def read_rds(path: str, **kwargs):
Returns:
Some kind of object.
"""
_robj = load_rds(path=path)
_robj = parse_rds(path=path)
_class_name = get_class(_robj)

print("in READ_RDS")
print(_robj)
print(_class_name)

if _class_name not in REGISTRY:
raise NotImplementedError(
"no `read_rds` method implemented for '{_class_name}' objects."
f"no `read_rds` method implemented for '{_class_name}' objects."
)

# from Aaron's dolomite-base package
Expand All @@ -55,4 +66,4 @@ def read_rds(path: str, **kwargs):
command = getattr(mod, command[first_period + 1 :])
REGISTRY[_class_name] = command

return command(path, **kwargs)
return command(_robj, **kwargs)
Loading

0 comments on commit b63e8d2

Please sign in to comment.