Closed dgodovich closed 1 year ago
Hello @dgodovich,
Thank you for bringing this to our attention. Given the deprecation of scanpy.external
, we've aligned Palantir's functionality to be similar to the Scanpy wrapper for ease of transition.
Here's how we would suggest to execute your diffusion maps and Palantir analysis:
# Diffusion Maps
palantir.utils.run_diffusion_maps(adata, n_components=20, knn=30)
# Multiscale Space
palantir.utils.determine_multiscale_space(adata)
# Run Palantir
palantir.core.run_palantir(adata, early_cell=start_cell, num_waypoints=1000)
adata.obsm
keys differ by default.If you're keen on Scanpy's naming scheme, you can explicitly specify the keys as follows:
# Diffusion Maps
palantir.utils.run_diffusion_maps(
adata,
n_components=20,
knn=30,
eigvec_key="X_palantir_diff_comp",
eigval_key="palantir_EigenValues",
sim_key="palantir_diff_op"
)
# Multiscale Space
palantir.utils.determine_multiscale_space(
adata,
eigvec_key="X_palantir_diff_comp",
out_key="X_palantir_multiscale"
)
# Run Palantir
pr_res = palantir.core.run_palantir(
adata,
early_cell=start_cell,
num_waypoints=1000,
eigvec_key="X_palantir_multiscale"
)
The palantir.core.run_palantir
wrapper now additionally saves the results in adata.obs
and adata.obsm
under the following keys:
adata.obs["palantir_pseudotime"]
adata.obs["palantir_entropy"]
adata.obsm["palantir_fate_probabilities"]
adata.uns["palantir_waypoints"]
I did not know scanpy is depreciating the external API. I followed the tutorial notebook and was able to reproduce my previous results with very similar code to what you provided here, so I have no issues.
I appreciate saving results in adata.obs
and adata.obsm
, as that saves a step later on. Generally this workflow is easier to understand as well.
My one note is that the documentation on your home page says that Palantir is fully integrated with scanpy, which is no longer the case.
Thank you for the comprehensive reply!
Hello,
I recently updated palantir to the latest release (1.3.0) using
pip install -U palantir
and found that my previous notebooks do not work. I was using the scanpy integration throughsc.external.tl.palantir(adata)
and now get an error:If I try to recalculate palantir results with already found diffusion maps, I get a similar error:
I am using the most recent scanpy release 1.9.4. Please let me know if you need any additional information.
Thank you!