From b54cdb55d3f23ea46be176f6d4f8a56d2a48f792 Mon Sep 17 00:00:00 2001 From: Abdul Moeed Date: Fri, 20 Nov 2020 16:48:25 +0100 Subject: [PATCH] Explicitly cast indices and indptr of final backed file to int64. (#17) For the background on this: https://github.com/theislab/anndata/issues/453 --- sfaira/data/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sfaira/data/base.py b/sfaira/data/base.py index ed9910046..98d6d55c9 100644 --- a/sfaira/data/base.py +++ b/sfaira/data/base.py @@ -816,7 +816,10 @@ def load_all_tobacked( self.adata.filename = fn_backed # setting this attribute switches this anndata to a backed object # Note that setting .filename automatically redefines .X as dense, so we have to redefine it as sparse: if not as_dense: - self.adata.X = scipy.sparse.csr_matrix(self.adata.X) # redefines this backed anndata as sparse + X = scipy.sparse.csr_matrix(self.adata.X) # redefines this backed anndata as sparse + X.indices = X.indices.astype(np.int64) + X.indptr = X.indptr.astype(np.int64) + self.adata.X = X keys = [ "lab", "year",