atarashansky / SAMap

SAMap: Mapping single-cell RNA sequencing datasets from evolutionarily distant organisms.
MIT License
63 stars 19 forks source link

Gene Pair Finder Giving "ValueError: negative dimensions are not allowed" #118

Open acgarretson opened 1 year ago

acgarretson commented 1 year ago

I'm running gene pair finder on the output of a SAMap run, and the sam results themselves look great.

I am running find_all or find_pairs like this: gpf = GenePairFinder(sm, keys=keys) gene_pairs = gpf.find_all(align_thr=0.2)

I get the following error: >>> gpf.find_all(align_thr=0.9) Calculating gene pairs for the mapping: at;10 to sc;2 Traceback (most recent call last): File "<stdin>", line 1, in <module> File ".micromamba/envs/SAMap/lib/python3.9/site-packages/samap/analysis.py", line 689, in find_all res['{};{}'.format(ct1[i],ct2[i])] = self.find_genes(ct1[i],ct2[i],**kwargs) File ".micromamba/envs/SAMap/lib/python3.9/site-packages/samap/analysis.py", line 746, in find_genes m,gpairs = self._find_link_genes_avg(n1, n2, id1,id2, w1t=w1t, w2t=w2t, expr_thr=0.05) File ".micromamba/envs/SAMap/lib/python3.9/site-packages/samap/analysis.py", line 790, in _find_link_genes_avg X2 = _sparse_sub_standardize(sam2.adata[:, g2].X[x2 == c2, :], mu2, std2) File ".micromamba/envs/SAMap/lib/python3.9/site-packages/anndata/_core/anndata.py", line 606, in X _subset(self._adata_ref.X, (self._oidx, self._vidx)), File ".micromamba/envs/SAMap/lib/python3.9/functools.py", line 888, in wrapper return dispatch(args[0].__class__)(*args, **kw) File ".micromamba/envs/SAMap/lib/python3.9/site-packages/anndata/_core/index.py", line 140, in _subset_spmatrix return a[subset_idx] File ".micromamba/envs/SAMap/lib/python3.9/site-packages/scipy/sparse/_index.py", line 71, in __getitem__ return self._get_sliceXarray(row, col) File ".micromamba/envs/SAMap/lib/python3.9/site-packages/scipy/sparse/_csr.py", line 321, in _get_sliceXarray return self._major_slice(row)._minor_index_fancy(col) File ".micromamba/envs/SAMap/lib/python3.9/site-packages/scipy/sparse/_compressed.py", line 775, in _minor_index_fancy res_indices = np.empty(nnz, dtype=idx_dtype) ValueError: negative dimensions are not allowed

It has happened with a handful of different datasets at this point, and I'm not sure exactly how to troubleshoot.

daiyc-zoo commented 11 months ago

Hi @acgarretson , did you manage to solve this issue? I've run into the same error whilst running different datasets and I'm unsure what the cause of the issue may be. I've checked gene name matches between the single cell dataset and the blastp dataset etc.

One thing I noticed is when subsetting specific cell types from my dataset, the small test dataset can run properly and produce gene pair finder results. However I'm really unsure what is causing the error on the bigger dataset.