-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EOD: parse dicts, fix for dframes with nrows, and trying to parse SCE
- Loading branch information
Showing
11 changed files
with
76 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from .generics import _dispatcher | ||
from .rdsutils import get_class | ||
|
||
__author__ = "jkanche" | ||
__copyright__ = "jkanche" | ||
__license__ = "MIT" | ||
|
||
|
||
def parse_vector(robject: dict): | ||
print("in parse vector") | ||
_cls = get_class(robject) | ||
|
||
if _cls not in ["vector"]: | ||
raise RuntimeError(f"`robject` does not contain not a vector/dictionary object, contains `{_cls}`.") | ||
|
||
dict_keys = list(_dispatcher(robject["attributes"]["names"])) | ||
|
||
print(dict_keys) | ||
print("final_vec") | ||
final_vec = {} | ||
for idx, dkey in enumerate(dict_keys): | ||
final_vec[dkey] = _dispatcher(robject["data"][idx]) | ||
|
||
return final_vec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import pytest | ||
|
||
from rds2py import read_rds | ||
|
||
__author__ = "jkanche" | ||
__copyright__ = "jkanche" | ||
__license__ = "MIT" | ||
|
||
|
||
def test_read_simple_lists(): | ||
obj = read_rds("tests/data/simple_list.rds") | ||
|
||
assert obj is not None | ||
assert len(obj) > 0 | ||
|
||
assert "collab" in obj | ||
assert len(obj["collab"]) > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import pytest | ||
|
||
from rds2py import read_rds | ||
|
||
from singlecellexperiment import SingleCellExperiment | ||
|
||
__author__ = "jkanche" | ||
__copyright__ = "jkanche" | ||
__license__ = "MIT" | ||
|
||
|
||
def test_read_sce(): | ||
data = read_rds("tests/data/simple_sce.rds") | ||
|
||
assert data is not None | ||
assert isinstance(data, SingleCellExperiment) | ||
assert data.shape == (100, 100) | ||
|
File renamed without changes.