From 96060665c2a3df9dd6432be89c621ecd8b3023d5 Mon Sep 17 00:00:00 2001 From: Patrick Hanel <47063786+HAL9032@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:37:13 +0100 Subject: [PATCH] fixed issue with older anndata versions --- episcanpy/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/episcanpy/__init__.py b/episcanpy/__init__.py index 77da4f5..80fe210 100644 --- a/episcanpy/__init__.py +++ b/episcanpy/__init__.py @@ -1,5 +1,6 @@ # some technical stuff import sys +from packaging.version import Version from .utils import check_versions, annotate_doc_types from ._version import get_versions # version generated by versioneer @@ -25,6 +26,7 @@ from . import preprocessing as pp from . import count_matrix as ct from . import plotting as pl + # import read functions from .preprocessing._load_matrix import read_ATAC_10x, read_h5 from .preprocessing._load_matrix import read_h5 as read_h5_atac @@ -32,7 +34,13 @@ # read functions from AnnData from anndata import AnnData from anndata import read -from anndata.io import read_h5ad, read_csv, read_excel, read_hdf, read_loom, read_mtx, read_text, read_umi_tools + +import anndata + +if Version(anndata.__version__) < Version("0.11.0rc2"): + from anndata import read_h5ad, read_csv, read_excel, read_hdf, read_loom, read_mtx, read_text, read_umi_tools +else: + from anndata.io import read_h5ad, read_csv, read_excel, read_hdf, read_loom, read_mtx, read_text, read_umi_tools # import multidata information @@ -41,4 +49,3 @@ # import settings for plots import scanpy as sc from scanpy import set_figure_params -