|
8 | 8 | import scipy.sparse
|
9 | 9 | import xarray as xr
|
10 | 10 |
|
| 11 | +try: |
| 12 | + from anndata.base import Raw |
| 13 | +except ImportError: |
| 14 | + from anndata import Raw |
| 15 | + |
11 | 16 | from batchglm import data as data_utils
|
12 | 17 | from batchglm.xarray_sparse import SparseXArrayDataSet
|
13 | 18 | from diffxpy import pkg_constants
|
@@ -197,7 +202,7 @@ def _fit(
|
197 | 202 |
|
198 | 203 |
|
199 | 204 | def lrt(
|
200 |
| - data: Union[anndata.AnnData, anndata.base.Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
| 205 | + data: Union[anndata.AnnData, Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
201 | 206 | full_formula_loc: str,
|
202 | 207 | reduced_formula_loc: str,
|
203 | 208 | full_formula_scale: str = "~1",
|
@@ -382,7 +387,7 @@ def lrt(
|
382 | 387 |
|
383 | 388 |
|
384 | 389 | def wald(
|
385 |
| - data: Union[anndata.AnnData, anndata.base.Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
| 390 | + data: Union[anndata.AnnData, Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
386 | 391 | factor_loc_totest: Union[str, List[str]] = None,
|
387 | 392 | coef_to_test: Union[str, List[str]] = None,
|
388 | 393 | formula_loc: Union[None, str] = None,
|
@@ -659,7 +664,7 @@ def wald(
|
659 | 664 |
|
660 | 665 |
|
661 | 666 | def t_test(
|
662 |
| - data: Union[anndata.AnnData, anndata.base.Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
| 667 | + data: Union[anndata.AnnData, Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
663 | 668 | grouping,
|
664 | 669 | gene_names: Union[np.ndarray, list] = None,
|
665 | 670 | sample_description: pd.DataFrame = None,
|
@@ -700,7 +705,7 @@ def t_test(
|
700 | 705 |
|
701 | 706 |
|
702 | 707 | def rank_test(
|
703 |
| - data: Union[anndata.AnnData, anndata.base.Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
| 708 | + data: Union[anndata.AnnData, Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
704 | 709 | grouping: Union[str, np.ndarray, list],
|
705 | 710 | gene_names: Union[np.ndarray, list] = None,
|
706 | 711 | sample_description: pd.DataFrame = None,
|
@@ -741,7 +746,7 @@ def rank_test(
|
741 | 746 |
|
742 | 747 |
|
743 | 748 | def two_sample(
|
744 |
| - data: Union[anndata.AnnData, anndata.base.Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
| 749 | + data: Union[anndata.AnnData, Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
745 | 750 | grouping: Union[str, np.ndarray, list],
|
746 | 751 | as_numeric: Union[List[str], Tuple[str], str] = (),
|
747 | 752 | test: str = "t-test",
|
@@ -909,7 +914,7 @@ def two_sample(
|
909 | 914 |
|
910 | 915 |
|
911 | 916 | def pairwise(
|
912 |
| - data: Union[anndata.AnnData, anndata.base.Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
| 917 | + data: Union[anndata.AnnData, Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
913 | 918 | grouping: Union[str, np.ndarray, list],
|
914 | 919 | as_numeric: Union[List[str], Tuple[str], str] = (),
|
915 | 920 | test: str = 'z-test',
|
@@ -1116,7 +1121,7 @@ def pairwise(
|
1116 | 1121 |
|
1117 | 1122 |
|
1118 | 1123 | def versus_rest(
|
1119 |
| - data: Union[anndata.AnnData, anndata.base.Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
| 1124 | + data: Union[anndata.AnnData, Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
1120 | 1125 | grouping: Union[str, np.ndarray, list],
|
1121 | 1126 | as_numeric: Union[List[str], Tuple[str], str] = (),
|
1122 | 1127 | test: str = 'wald',
|
@@ -1274,7 +1279,7 @@ def versus_rest(
|
1274 | 1279 |
|
1275 | 1280 |
|
1276 | 1281 | def partition(
|
1277 |
| - data: Union[anndata.AnnData, anndata.base.Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
| 1282 | + data: Union[anndata.AnnData, Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
1278 | 1283 | parts: Union[str, np.ndarray, list],
|
1279 | 1284 | gene_names: Union[np.ndarray, list] = None,
|
1280 | 1285 | sample_description: pd.DataFrame = None
|
@@ -1672,7 +1677,7 @@ def wald(
|
1672 | 1677 |
|
1673 | 1678 |
|
1674 | 1679 | def continuous_1d(
|
1675 |
| - data: Union[anndata.AnnData, anndata.base.Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
| 1680 | + data: Union[anndata.AnnData, Raw, xr.DataArray, xr.Dataset, np.ndarray, scipy.sparse.csr_matrix], |
1676 | 1681 | continuous: str,
|
1677 | 1682 | df: int = 5,
|
1678 | 1683 | factor_loc_totest: Union[str, List[str]] = None,
|
|
0 commit comments