Issue with tsne
st4302 opened this issue · 1 comments
Hello,
I am trying to use palantir using scanpy and then the plotting commands from your notebook.
I tried to run sc.tl.tsne(adata, n_pcs=2, use_rep='X_palantir_multiscale', perplexity=150)
but I am getting the following error:
ValueError: X_palantir_multiscale does not have enough Dimensions. Provide a Representation with equal or more dimensions than
n_pcsor lower
n_pcs
I had run palantir previously that way with other samples but I have not encountered this before. Is it a problem with my data?
I run palantir like shown here:
start_cell = 'AAACCCAAGACATGCG-1-1'
pr_res = sce.tl.palantir_results(
adata,
early_cell=start_cell,
ms_data='X_palantir_multiscale',
num_waypoints=500,
)
And I plotted it also like shown below with umap:
# Check where start cell is in umap
cell = ['AAACCCAAGACATGCG-1-1']
umap = pd.DataFrame(adata.obsm['X_umap'][:,0:2], index=adata.obs_names, columns=['x', 'y'])
plt.scatter(umap["x"], umap["y"], s=5, color="lightgrey")
plt.scatter(umap.loc[cell, "x"], umap.loc[cell, "y"], s=30)
#Plot results
palantir.plot.plot_palantir_results(pr_res, umap)
Plotting with UMAP is not giving me any issues.
Thank you
Hello - We recommend the use of umaps or force directed layouts over tSNE computed on diffusion components. Is there a reason, why you would need to compute tSNE. The n_pcs
parameter should be bumped up for tsne
to work.