Skip to content

Commit

Permalink
Replace anndataread with anndataread h5ad due to 2024 deprecation (#84)
Browse files Browse the repository at this point in the history
* Replace anndata.read with anndata.read_h5ad

* Update version to 0.1.24

* Fixed assert statements
  • Loading branch information
ubyndr authored Aug 23, 2024
1 parent 116dfc0 commit f467578
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion pandasaurus_cxg/utils/anndata_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def load_from_file(file_path: str) -> Optional[anndata.AnnData]:
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=anndata.ImplicitModificationWarning)
try:
anndata_obj = anndata.read(file_path, backed="r")
anndata_obj = anndata.read_h5ad(file_path, backed="r")
return anndata_obj
except Exception as e:
print(f"An error occurred while loading the file: {e}")
Expand Down
30 changes: 17 additions & 13 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pandasaurus-cxg"
version = "0.1.23"
version = "0.1.24"
description = "Ontology enrichment tool for CxG standard AnnData files."
authors = ["Ugur Bayindir <[email protected]>"]
license = "http://www.apache.org/licenses/LICENSE-2.0"
Expand Down
4 changes: 2 additions & 2 deletions test/graph_generator/test_graph_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def test_enrich_rdf_graph(graph_generator_instance_for_kidney):

graph_generator.enrich_rdf_graph()

assert len(graph_generator.graph) == 1145
assert len(graph_generator.graph) == 1147
assert (
URIRef(CONSIST_OF.get("iri")),
RDFS.label,
Expand All @@ -173,7 +173,7 @@ def test_enrich_rdf_graph(graph_generator_instance_for_kidney):
if str(s).startswith("http://purl.obolibrary.org/obo/CL_")
]
)
== 529
== 531
)


Expand Down
6 changes: 3 additions & 3 deletions test/test_anndata_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
def sample_immune_data():
current_dir = os.path.dirname(os.path.abspath(__file__))
file_path = os.path.join(current_dir, "data/immune_example.h5ad")
return anndata.read(file_path, backed="r")
return anndata.read_h5ad(file_path, backed="r")


@pytest.fixture
def sample_anndata_with_uns():
current_dir = os.path.dirname(os.path.abspath(__file__))
file_path = os.path.join(current_dir, "data/modified_human_kidney.h5ad")
return anndata.read(file_path, backed="r")
return anndata.read_h5ad(file_path, backed="r")


@pytest.fixture
def sample_anndata_without_uns():
current_dir = os.path.dirname(os.path.abspath(__file__))
file_path = os.path.join(current_dir, "data/human_kidney.h5ad")
return anndata.read(file_path, backed="r")
return anndata.read_h5ad(file_path, backed="r")


@pytest.fixture()
Expand Down
2 changes: 1 addition & 1 deletion test/test_anndata_enricher.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
def sample_immune_data():
current_dir = os.path.dirname(os.path.abspath(__file__))
file_path = os.path.join(current_dir, "data/immune_example.h5ad")
return anndata.read(file_path, backed="r")
return anndata.read_h5ad(file_path, backed="r")


@pytest.fixture
Expand Down

0 comments on commit f467578

Please sign in to comment.