HI Justin,
Thank you for your quick response. Here is the full stack trace:
INFO File /Users/lansev00/Documents/HCA/HCA_reference/model.pt already downloaded
INFO Found 79.79187098180233% reference vars in query data.
/Users/lansev00/.pyenv/versions/3.10.5/envs/scanpy_general/lib/python3.10/site-packages/scvi/model/base/_archesmixin.py:204: UserWarning: Query data contains less than 1% of reference var names. This may result in poor performance.
warnings.warn(
/Users/lansev00/.pyenv/versions/3.10.5/envs/scanpy_general/lib/python3.10/site-packages/scvi/model/base/_archesmixin.py:211: FutureWarning: X.dtype being converted to np.float32 from float64. In the next version of anndata (0.9) conversion will not be automatic. Pass dtype explicitly to avoid this warning. Pass AnnData(X, dtype=X.dtype, ...)
to get the future behavour.
adata_padding = AnnData(
ValueError Traceback (most recent call last)
Input In [15], in <cell line: 1>()
----> 1 scvi.model.SCANVI.prepare_query_anndata(query,“/Users/lansev00/Documents/HCA/HCA_reference/”)
File ~/.pyenv/versions/3.10.5/envs/scanpy_general/lib/python3.10/site-packages/scvi/model/base/_archesmixin.py:217, in ArchesMixin.prepare_query_anndata(adata, reference_model, return_reference_var_names, inplace)
215 adata_padding.obs_names = adata.obs_names
216 # Concatenate object
→ 217 adata_out = anndata.concat(
218 [adata, adata_padding],
219 axis=1,
220 join=“outer”,
221 index_unique=None,
222 merge=“unique”,
223 )
224 else:
225 adata_out = adata
File ~/.pyenv/versions/3.10.5/envs/scanpy_general/lib/python3.10/site-packages/anndata/_core/merge.py:888, in concat(adatas, axis, join, merge, uns_merge, label, keys, index_unique, fill_value, pairwise)
886 concat_pairwise = {}
887 elif join == “outer”:
→ 888 layers = outer_concat_aligned_mapping(
889 [a.layers for a in adatas], reindexers, axis=axis, fill_value=fill_value
890 )
891 concat_mapping = outer_concat_aligned_mapping(
892 [getattr(a, f"{dim}m") for a in adatas],
893 index=concat_indices,
894 fill_value=fill_value,
895 )
896 if pairwise:
File ~/.pyenv/versions/3.10.5/envs/scanpy_general/lib/python3.10/site-packages/anndata/_core/merge.py:526, in outer_concat_aligned_mapping(mappings, reindexers, index, fill_value, axis)
522 cur_reindexers = reindexers
524 # Handling of missing values here is hacky for dataframes
525 # We should probably just handle missing elements for all types
→ 526 result[k] = concat_arrays(
527 [
528 el if not_missing(el) else np.zeros((n, 0), dtype=bool)
529 for el, n in zip(els, ns)
530 ],
531 cur_reindexers,
532 axis=axis,
533 index=index,
534 fill_value=fill_value,
535 )
536 return result
File ~/.pyenv/versions/3.10.5/envs/scanpy_general/lib/python3.10/site-packages/anndata/_core/merge.py:440, in concat_arrays(arrays, reindexers, axis, index, fill_value)
437 elif any(isinstance(a, sparse.spmatrix) for a in arrays):
438 sparse_stack = (sparse.vstack, sparse.hstack)[axis]
439 return sparse_stack(
→ 440 [
441 f(as_sparse(a), axis=1 - axis, fill_value=fill_value)
442 for f, a in zip(reindexers, arrays)
443 ],
444 format=“csr”,
445 )
446 else:
447 return np.concatenate(
448 [
449 f(x, fill_value=fill_value, axis=1 - axis)
(…)
452 axis=axis,
453 )
File ~/.pyenv/versions/3.10.5/envs/scanpy_general/lib/python3.10/site-packages/anndata/_core/merge.py:441, in (.0)
437 elif any(isinstance(a, sparse.spmatrix) for a in arrays):
438 sparse_stack = (sparse.vstack, sparse.hstack)[axis]
439 return sparse_stack(
440 [
→ 441 f(as_sparse(a), axis=1 - axis, fill_value=fill_value)
442 for f, a in zip(reindexers, arrays)
443 ],
444 format=“csr”,
445 )
446 else:
447 return np.concatenate(
448 [
449 f(x, fill_value=fill_value, axis=1 - axis)
(…)
452 axis=axis,
453 )
File ~/.pyenv/versions/3.10.5/envs/scanpy_general/lib/python3.10/site-packages/anndata/_core/merge.py:282, in Reindexer.call(self, el, axis, fill_value)
281 def call(self, el, *, axis=1, fill_value=None):
→ 282 return self.apply(el, axis=axis, fill_value=fill_value)
File ~/.pyenv/versions/3.10.5/envs/scanpy_general/lib/python3.10/site-packages/anndata/_core/merge.py:295, in Reindexer.apply(self, el, axis, fill_value)
293 return self._apply_to_df(el, axis=axis, fill_value=fill_value)
294 elif isinstance(el, sparse.spmatrix):
→ 295 return self._apply_to_sparse(el, axis=axis, fill_value=fill_value)
296 else:
297 return self._apply_to_array(el, axis=axis, fill_value=fill_value)
File ~/.pyenv/versions/3.10.5/envs/scanpy_general/lib/python3.10/site-packages/anndata/_core/merge.py:362, in Reindexer._apply_to_sparse(self, el, axis, fill_value)
356 elif axis == 0:
357 idxmtx = sparse.coo_matrix(
358 (np.ones(len(self.new_pos), dtype=bool), (self.new_pos, self.old_pos)),
359 shape=(len(self.new_idx), len(self.old_idx)),
360 dtype=idxmtx_dtype,
361 )
→ 362 out = idxmtx @ el
364 if len(to_fill) > 0:
365 out = out.tocsr()
File ~/.pyenv/versions/3.10.5/envs/scanpy_general/lib/python3.10/site-packages/scipy/sparse/_base.py:623, in spmatrix.matmul(self, other)
620 if isscalarlike(other):
621 raise ValueError("Scalar operands are not allowed, "
622 “use ‘*’ instead”)
→ 623 return self._mul_dispatch(other)
File ~/.pyenv/versions/3.10.5/envs/scanpy_general/lib/python3.10/site-packages/scipy/sparse/_base.py:536, in spmatrix._mul_dispatch(self, other)
534 if issparse(other):
535 if self.shape[1] != other.shape[0]:
→ 536 raise ValueError(‘dimension mismatch’)
537 return self._mul_sparse_matrix(other)
539 # If it’s a list or whatever, treat it like a matrix
ValueError: dimension mismatch