Hello
I tried umap visualization with scanpy
:
sc.pp.scale(adata, zero_center=True, max_value=None, copy=False, layer=None, obsm=None)
sc.pp.pca(adata, n_comps=50, use_highly_variable=True, svd_solver='arpack')
sc.pp.neighbors(adata, n_neighbors=50)
sc.tl.umap(adata, min_dist=0.5, spread=1.0)
sc.pl.umap(adata, color='fullname', use_raw=False, save='samples_umap.pdf')
But the cells can't separate well
I tried another small dataset with scanpy
using the same parameters as before:
sc.tl.umap
still failed to down dimension the data properly.
Then I tried the original umap
package using the same data set:
import umap
import umap.plot
mapper = umap.UMAP().fit(adata.X)
umap.plot.points(mapper)
Now the original umap
package can do down dimension very well:
I think there may be something wrong with the umap
function in scanpy
Can anyone please let me know the reason? Thanks a lot.
Hi Mensur:
I compare the
umap
inscanpy
with the originalumap
(https://umap-learn.readthedocs.io/en/latest/plotting.html) using the same dataset, the originalumap
works well, I think the problem is inscanpy
. I edited my question to include this. Do you have some suggestions? ThanksDan
Not sure why you need me to point this out because it seems obvious that scanpy is calling UMAP with different parameters.
On the other hand, your plot using UMAP directly shows
n_neighbors=15, min_dist=0.1
, so there is your difference.