Giter Site home page Giter Site logo

dpeerlab / palantir Goto Github PK

View Code? Open in Web Editor NEW
203.0 10.0 45.0 57.03 MB

Single cell trajectory detection

Home Page: https://palantir.readthedocs.io

License: GNU General Public License v2.0

Jupyter Notebook 94.71% Python 5.29%
scrna-seq scrna-seq-analysis manifold-learning dimensionality-reduction diffusion-maps markov-chain differentiation single-cell-genomics trajectory-generation cell-fate-transitions

palantir's Introduction

PyPI version codecov

Palantir

Palantir is an algorithm to align cells along differentiation trajectories. Palantir models differentiation as a stochastic process where stem cells differentiate to terminally differentiated cells by a series of steps through a low dimensional phenotypic manifold. Palantir effectively captures the continuity in cell states and the stochasticity in cell fate determination. Palantir has been designed to work with multidimensional single cell data from diverse technologies such as Mass cytometry and single cell RNA-seq.

Installation

Palantir has been implemented in Python3 and can be installed using:

Using pip

pip install palantir

Using conda, mamba, or micromamba from the bioconda channel

You can also install Palantir via conda, mamba, or micromamba from the bioconda channel:

Using conda

conda install -c conda-forge -c bioconda palantir

Using mamba

mamba install -c conda-forge -c bioconda palantir

Using micromamba

micromamba install -c conda-forge -c bioconda palantir

These methods ensure that all dependencies are resolved and installed efficiently.

Usage

A tutorial on Palantir usage and results visualization for single cell RNA-seq data can be found in this notebook: https://github.com/dpeerlab/Palantir/blob/master/notebooks/Palantir_sample_notebook.ipynb

More tutorials and a documentation of all the Palantir components can be found here: https://palantir.readthedocs.io

Processed data and metadata

scanpy anndata objects are available for download for the three replicates generated in the manuscript:

This notebook details how to use the data in Python and R: https://github.com/dpeerlab/Palantir/blob/master/notebooks/manuscript_data.ipynb

Comparison to trajectory detection algorithms

Notebooks detailing the generation of results comparing Palantir to trajectory detection algorithms are available here

Citations

Palantir manuscript is available from Nature Biotechnology. If you use Palantir for your work, please cite our paper.

    @article{Palantir_2019,
            title = {Characterization of cell fate probabilities in single-cell data with Palantir},
            author = {Manu Setty and Vaidotas Kiseliovas and Jacob Levine and Adam Gayoso and Linas Mazutis and Dana Pe'er},
            journal = {Nature Biotechnology},
            year = {2019},
            month = {march},
            url = {https://doi.org/10.1038/s41587-019-0068-4},
            doi = {10.1038/s41587-019-0068-4}
    }

Release Notes

Version 1.3.4rc

  • avoid devision by zero in select_branch_cells for very small datasets
  • make branch selection robust against NaNs
  • do not plot unclustered trends (NaN cluster) in plot_gene_trend_clusters

Version 1.3.3

  • optional progress bar with progress=True in palantir.utils.run_local_variability
  • avoid NaN in local variablility output
  • compatibility with scanpy>=1.10.0

Version 1.3.2

  • require python>=3.8
  • implement CI for testing
  • fixes for edge cases discoverd through extended testing
  • implement plot_trajectory function to show trajectory on the umap
  • scale pseudotime to unit intervall in anndata

Version 1.3.1

  • implemented palantir.plot.plot_stats to plot arbitray cell-wise statistics as x-/y-positions.
  • reduce memory usgae of palantir.presults.compute_gene_trends
  • removed seaborn dependency
  • refactor run_diffusion_maps to split out compute_kernel and diffusion_maps_from_kernel
  • remove unused dependencies tables, Cython, cmake, and tzlocal.
  • fixes in run_pca (return correct projections and do not use too many components)

Version 1.3.0

New Features

  • Enable an AnnData-centric workflow for improved usability and interoperability with other single-cell analysis tools.
  • Introduced new utility functions
    • palantir.utils.early_cell To automate fining an early cell based on cell type and diffusion components.
    • palantir.utils.find_terminal_states To automate finding terminal cell states based on cell type and diffusion components.
    • palantir.presults.select_branch_cells To find cells associated to each branch based on fate probability.
    • palantir.plot.plot_branch_selection To inspect the cell to branch association.
    • palantir.utils.run_local_variability To compute local gene expression variability.
    • palantir.utils.run_density A wrapper for mellon.DensityEstimator.
    • palantir.utils.run_density_evaluation Evaluate computed density on a different dataset.
    • palantir.utils.run_low_density_variability. To aggregate local gene expression variability in low density.
    • palantir.plot.plot_branch. To plot branch-selected cells over pseudotime in arbitrary y-postion and coloring.
    • palantir.plot.plot_trend. To plot the gene trend ontop of palantir.plot.plot_branch.
  • Added input validation for better error handling and improved user experience.
  • Expanded documentation within docstrings, providing additional clarity for users and developers.

Enhancements

  • Updated tutorial notebook to reflect the new workflow, guiding users through the updated processes.
  • Implemented gene trend computation using Mellon, providing more robust and efficient gene trend analysis.
  • Enable annotation in palantir.plot.highight_cells_on_umap.

Changes

  • Replaced PhenoGraph dependency with scanpy.tl.leiden for gene trend clustering.
  • Deprecated the run_tsne, determine_cell_clusters, and plot_cell_clusters functions. Use corresponding implementations from Scanpy, widely used single-cell analysis library and direct dependecy of Palantir.
  • Rename palantir.plot.highight_cells_on_tsne to palantir.plot.highight_cells_on_umap
  • Depend on anndata>=0.8.0 to avoid issues writing dataframes in ad.obsm.

Fixes

  • Addressed the issue of variability when reproducing results (issue#64), enhancing the reproducibility and reliability of Palantir.

Version 1.1.0

  • Replaced rpy2 with pyGAM for computing gene expression trends.
  • Updated tutorial and plotting functions

Version 1.0.0

  • A fix to issue#41
  • A fix to issue#42
  • Revamped tutorial with support for Anndata and force directed layouts

Version 0.2.6

Version 0.2.5

  • A fix related to issue#28. When identifying terminal states, duplicate values were generated instead of unique ones.

palantir's People

Contributors

andrewmoorman avatar awnimo avatar christinedien avatar flying-sheep avatar ivirshup avatar katosh avatar lisasikkema avatar manusetty avatar mbuttner avatar mrland99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

palantir's Issues

Update access of neighbor distances from Anndata

Need a fix for deprecation warning

 self.func_ir.loc))
/home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages/palantir/utils.py:43: FutureWarning: This location for 'distances' is deprecated. It has been moved to .obsp[distances], and will not be accesible here in a future version of anndata.
  kNN = temp.uns['neighbors']['distances']

Error running 'sce.tl.palantir(adata)'

I am using palantir and scanpy for trajectory inference in single-cell RNA-seq dataset.
There is some issue with computing Palantir diffusion maps.

  1. It gives me an error that is did not find adata.var['highly_variable'] when it is already present.
  2. It gives an error, that 'n_components' is not a valid argument, when it is.

Python 3.7.3 (default, Mar 27 2019, 22:11:17) [GCC 7.3.0]
Linux-3.10.0-1127.18.2.el7.x86_64-x86_64-with-redhat-7.8-Maipo
16 logical CPU cores, x86_64

palantir version 1.0.0

image
image

Stability of palantir results

Hi all, I'm using palantir on some data of mine, I've noticed that multiple runs with the same parameters give different result in entropy estimation, while pseudotime converges always to the same solution. This seems to be related to the estimation of branching trajectories, which varies across runs.
Looking at branch probabilities in two examples, you may notice that some are conserved, while other appear to be merged/split as branch p_4 here
branch2
which is split into branches p_0 and p_5 here
branch1
Is there a way to enforce some type of convergence at this step?

MulticoreTSNE

Multicoretsne is a very problematic dependency:

image

I was wondering if it's really essential to palantir or could it be simply a runtime dependency to avoid all these issues?

from_10x_HDF5

What does the genome argument require? I looked at the function and wasn't able to decipher what needed to be passed to the function? Any insight would be helpful

Font issue and no plot result in scanpy

Hi, I constantly have issue on font. Any tip to install these fonts? And my scanpy plot function has no output after loading Palantir:

findfont: Font family ['Raleway'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Lato'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Bitstream Vera Sans'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Bitstream Vera Sans'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Bitstream Vera Sans'] not found. Falling back to DejaVu Sans.

%matplotlib inline has to be added to recover the inline plot function. Not sure if they are related but Palantir could have been removing the original %matplotline inline function

Release on PyPI

Palantir should have a stable version on PyPI, so people can just pip install palantir

error while reading mtx file

Hi, Thanks for developing Palantir. I have been trying to read in a count matrix in mtx format along with the gene_file_name via palantir.io.from_mtx but get an error which I don't understand. Can you help me out with this?

counts = palantir.io.from_mtx('matrix.mtx',gene_name_file='genes.tsv')
Traceback (most recent call last):
File "/Users/sumithrasankararaman/opt/anaconda3/lib/python3.7/site-packages/pandas/core/internals/managers.py", line 1654, in create_block_manager_from_blocks
make_block(values=blocks[0], placement=slice(0, len(axes[0])))
File "/Users/sumithrasankararaman/opt/anaconda3/lib/python3.7/site-packages/pandas/core/internals/blocks.py", line 3041, in make_block
return klass(values, ndim=ndim, placement=placement)
File "/Users/sumithrasankararaman/opt/anaconda3/lib/python3.7/site-packages/pandas/core/internals/blocks.py", line 125, in init
f"Wrong number of items passed {len(self.values)}, "
ValueError: Wrong number of items passed 3128, placement implies 26541

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/Users/sumithrasankararaman/opt/anaconda3/lib/python3.7/site-packages/palantir/io.py", line 32, in from_mtx
df = pd.DataFrame(count_matrix.todense(), columns=gene_names)
File "/Users/sumithrasankararaman/opt/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py", line 464, in init
mgr = init_ndarray(data, index, columns, dtype=dtype, copy=copy)
File "/Users/sumithrasankararaman/opt/anaconda3/lib/python3.7/site-packages/pandas/core/internals/construction.py", line 210, in init_ndarray
return create_block_manager_from_blocks(block_values, [columns, index])
File "/Users/sumithrasankararaman/opt/anaconda3/lib/python3.7/site-packages/pandas/core/internals/managers.py", line 1664, in create_block_manager_from_blocks
construction_error(tot_items, blocks[0].shape[1:], axes, e)
File "/Users/sumithrasankararaman/opt/anaconda3/lib/python3.7/site-packages/pandas/core/internals/managers.py", line 1694, in construction_error
raise ValueError(f"Shape of passed values is {passed}, indices imply {implied}")
ValueError: Shape of passed values is (26541, 3128), indices imply (26541, 26541)

Thank You

palantir.utils.determine_multiscale_space returns 0 columns

(1469, 0) is the shape of data returned by the code.

[atac.txt](https://github.com/dpeerlab/Palantir/files/5059399/atac.txt)
// first load data
data = pd.read_csv("atac.txt")
dm_res = palantir.utils.run_diffusion_maps(data, n_components=5)
ms_data = palantir.utils.determine_multiscale_space(dm_res)  # something wrong with shape

Error in palantir.utils.run_magic_imputation

Hi, when I run your tutorial on Palantir using your data, I run into this error when running magic imputation:
imp_df = palantir.utils.run_magic_imputation(ad, dm_res)
it results in:
Traceback (most recent call last): File "<pyshell#23>", line 1, in <module> imp_df = palantir.utils.run_magic_imputation(ad, dm_res) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/palantir/utils.py", line 123, in run_magic_imputation data = pd.DataFrame(data.X.todense(), index=data.obs_names, columns=data.var_names) AttributeError: 'numpy.ndarray' object has no attribute 'todense'

any idea how to resolve this issue and get imp_df computed?
I'm using python 3.8

anndata 0.7.4
harmony 0.1.4
matplotlib 3.3.3
numpy 1.19.2
palantir 1.0.0
pandas 1.1.4
scanpy 1.6.0
sinfo 0.3.1
IPython 7.19.0
jupyter_client 6.1.7
jupyter_core 4.7.0
jupyterlab 2.2.9
notebook 6.1.5
Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27) [Clang 6.0 (clang-600.0.57)]
macOS-10.16-x86_64-i386-64bit
4 logical CPU cores, i386
Session information updated at 2020-11-24 09:48

installation failed due to bhtsne

Hi,
I got stuck when I install the package.
image

I am using it in conda enviroment.
I also tried to install bhtsne, still got the error
image

Any suggestion?
Thanks!

PhenoGraph multi-processing error

Hi,

I was trying to use Palantir.presults.cluster_gene_trends funtion and run into a Type Error showing- "expected list, got np.ndarray". The function worked perfectly before the scanpy update, and I also updated Palantir package. I also followed the latest Palantir tutorial notebook.

/usr/lib/python3.8/site-packages/scipy/sparse/lil.py in tocsr(self, copy)
475 indices = np.empty(nnz, dtype=idx_dtype)
476 data = np.empty(nnz, dtype=self.dtype)
--> 477 _csparsetools.lil_flatten_to_array(self.rows, indices)
478 _csparsetools.lil_flatten_to_array(self.data, data)

_csparsetools.pyx in scipy.sparse._csparsetools.lil_flatten_to_array()

_csparsetools.pyx in scipy.sparse._csparsetools._lil_flatten_to_array_int32()

TypeError: Expected list, got numpy.ndarray

The issue was fixed by setting n_job parameter to 1. I am not sure why n_job -1 would cause the issue and would like to know if this issue happens on other systems.

Thank you for your time!

phenograph error during install

hi,
I am trying to install this via conda using
pip install .

But I get the following error
"Collecting phenograph (from palantir==0.2.1)
ERROR: Could not find a version that satisfies the requirement phenograph (from palantir==0.2.1) (from versions: none)
ERROR: No matching distribution found for phenograph (from palantir==0.2.1)

I tried to install this directly from git as mentioned in setup.py, but I am not sure if it worked because subsequently I got a segmentation fault while trying the test example in the
dm_res = palantir.utils.run_diffusion_maps(pca_projections, n_components=5)
command

Segmentation fault with run_diffusion_maps

I'm running into a segmentation fault error when running:

k = round(norm_df.shape[0]*0.10);
comp = 200
dm_res = palantir.utils.run_diffusion_maps(pca_projections, n_components=comp, knn=k)

where k evaluates to 6599 and I've tried comp of 200 & 300 and all attempts have returned the segmentation fault (and it reaches the segmentation fault quicker with a comp=200). Also, checking the memory usage on the node, I'm no where near the memory limit when the segmentation fault happens.

Any advice on what I can do to overcome this issue would be greatly appreciated. I tried updating my package and python versions (per this issue: #20) but the issue still persists.

My conda environment currently has these versions:

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_r-mutex                  1.0.1               anacondar_1    conda-forge
anndata                   0.7.3                    pypi_0    pypi
attrs                     19.3.0                   pypi_0    pypi
backcall                  0.1.0                    py37_0    anaconda
binutils_impl_linux-64    2.31.1               h6176602_1  
binutils_linux-64         2.31.1               h6176602_9  
blas                      1.0                         mkl  
blosc                     1.16.3               hd408876_0  
bwidget                   1.9.14                        0    conda-forge
bzip2                     1.0.8                h7b6447c_0  
ca-certificates           2020.1.1                      0    anaconda
cairo                     1.14.12              h8948797_3  
certifi                   2020.4.5.1               py37_0    anaconda
cffi                      1.14.0                   pypi_0    pypi
cmake                     3.17.2                   pypi_0    pypi
curl                      7.69.1               h33f0ec9_0    conda-forge
cycler                    0.10.0                   py37_0  
cython                    0.29.19                  pypi_0    pypi
dbus                      1.13.14              hb2f20db_0  
decorator                 4.4.2                      py_0    conda-forge
deprecated                1.2.10                   pypi_0    pypi
expat                     2.2.6                he6710b0_0  
fcsparser                 0.2.1                    pypi_0    pypi
fontconfig                2.13.0               h9420a91_0  
freetype                  2.9.1                h8a8886c_1  
fribidi                   1.0.9                h516909a_0    conda-forge
future                    0.18.2                   pypi_0    pypi
gcc_impl_linux-64         7.3.0                habb00fd_1  
gcc_linux-64              7.3.0                h553295d_9  
get-version               2.1                      pypi_0    pypi
gfortran_impl_linux-64    7.3.0                hdf63c60_1  
gfortran_linux-64         7.3.0                h553295d_9  
glib                      2.63.1               h5a9c865_0  
gmp                       6.2.0                he1b5a44_2    conda-forge
graphite2                 1.3.13            he1b5a44_1001    conda-forge
graphtools                1.5.1                    pypi_0    pypi
gsl                       2.4                  h14c3975_4  
gst-plugins-base          1.14.0               hbbd80ab_1  
gstreamer                 1.14.0               hb453b48_1  
gxx_impl_linux-64         7.3.0                hdf63c60_1  
gxx_linux-64              7.3.0                h553295d_9  
h5py                      2.10.0                   pypi_0    pypi
harfbuzz                  1.8.8                hffaf4a1_0  
hdf5                      1.10.4               hb1b8bf9_0  
icu                       58.2                 he6710b0_3  
igraph                    0.7.1             h2166141_1005    conda-forge
importlib-metadata        1.6.0                    pypi_0    pypi
intel-openmp              2020.1                      217  
ipython                   7.13.0           py37h5ca1d4c_0    anaconda
ipython_genutils          0.2.0                    py37_0    anaconda
jedi                      0.17.0                   py37_0    anaconda
jinja2                    2.11.2                   pypi_0    pypi
joblib                    0.15.1                     py_0  
jpeg                      9b                   h024ee3a_2  
kiwisolver                1.2.0            py37hfd86e86_0  
krb5                      1.17.1               h173b8e3_0  
legacy-api-wrap           1.2                      pypi_0    pypi
leidenalg                 0.8.0            py37h43df1e8_0    conda-forge
libblas                   3.8.0                    15_mkl    conda-forge
libcblas                  3.8.0                    15_mkl    conda-forge
libcurl                   7.69.1               hf7181ac_0    conda-forge
libedit                   3.1.20181209         hc058e9b_0  
libffi                    3.2.1                hd88cf55_4  
libgcc-ng                 9.1.0                hdf63c60_0  
libgfortran-ng            7.3.0                hdf63c60_0  
libiconv                  1.15              h516909a_1006    conda-forge
liblapack                 3.8.0                    15_mkl    conda-forge
libpng                    1.6.37               hbc83047_0  
libssh2                   1.9.0                hab1572f_2    conda-forge
libstdcxx-ng              9.1.0                hdf63c60_0  
libtiff                   4.1.0                h2733197_0  
libuuid                   1.0.3                h1bed415_2  
libxcb                    1.13                 h1bed415_1  
libxml2                   2.9.9                hea5a465_1  
llvmlite                  0.32.1           py37hd408876_0  
lz4-c                     1.8.1.2              h14c3975_0  
lzo                       2.10                 h7b6447c_2  
magic-impute              2.0.3                    pypi_0    pypi
make                      4.3                  h516909a_0    conda-forge
markupsafe                1.1.1                    pypi_0    pypi
matplotlib                3.1.3                    py37_0  
matplotlib-base           3.1.3            py37hef1b27d_0  
mkl                       2020.1                      217  
mkl-service               2.3.0            py37he904b0f_0  
mkl_fft                   1.0.15           py37ha843d7b_0  
mkl_random                1.1.0            py37hd6b4f25_0  
mock                      4.0.2                      py_0  
more-itertools            8.3.0                    pypi_0    pypi
multicoretsne             0.1                      pypi_0    pypi
natsort                   7.0.1                    pypi_0    pypi
ncurses                   6.2                  he6710b0_1  
networkx                  2.4                      pypi_0    pypi
numba                     0.49.1           py37h0573a6f_0  
numexpr                   2.7.1            py37h423224d_0  
numpy                     1.18.4           py37h8960a57_0    conda-forge
numpy-base                1.18.1           py37hde5b4d6_1  
openssl                   1.1.1g               h7b6447c_0    anaconda
os                        0.1.4                         0    jmcmurray
packaging                 20.4                     pypi_0    pypi
palantir                  0.2.6                    pypi_0    pypi
pandas                    1.0.3            py37h0573a6f_0    anaconda
pango                     1.42.4               h049681c_0  
parso                     0.7.0                      py_0    anaconda
patsy                     0.5.1                    py37_0  
pcre                      8.43                 he6710b0_0  
pexpect                   4.8.0                    py37_0    anaconda
phenograph                1.5.6                    pypi_0    pypi
pickle5                   0.0.10           py37h8f50634_0    conda-forge
pickleshare               0.7.5                    py37_0    anaconda
pip                       20.0.2                   py37_3  
pixman                    0.38.0            h516909a_1003    conda-forge
pluggy                    0.13.1                   pypi_0    pypi
prompt-toolkit            3.0.4                      py_0    anaconda
prompt_toolkit            3.0.4                         0    anaconda
psutil                    5.7.0            py37h8f50634_1    conda-forge
ptyprocess                0.6.0                    py37_0    anaconda
py                        1.8.1                    pypi_0    pypi
pycairo                   1.18.0          py37h1b9232e_1000    conda-forge
pycparser                 2.20                     pypi_0    pypi
pygments                  2.6.1                      py_0    anaconda
pygsp                     0.5.1                    pypi_0    pypi
pyparsing                 2.4.7                      py_0  
pyqt                      5.9.2            py37h05f1152_2  
pytables                  3.6.1            py37h71ec239_0  
pytest                    5.4.2                    pypi_0    pypi
python                    3.7.4                h265db76_1  
python-dateutil           2.8.1                      py_0  
python-igraph             0.7.1.post7      py37h516909a_0    conda-forge
python_abi                3.7                     1_cp37m    conda-forge
pytz                      2020.1                     py_0  
qt                        5.9.7                h5867ecd_1  
qutil                     3.2.1                         6    jmcmurray
r                         3.5.1                  r35_1003    conda-forge
r-askpass                 1.1               r35hcdcec82_1    conda-forge
r-assertthat              0.2.1             r35h6115d3f_1    conda-forge
r-backports               1.1.6             r35hcdcec82_1    conda-forge
r-base                    3.5.3                h067a564_0  
r-boot                    1.3_25            r35h6115d3f_0    conda-forge
r-brew                    1.0_6           r35h6115d3f_1002    conda-forge
r-callr                   3.4.3             r35h6115d3f_0    conda-forge
r-class                   7.3_17            r35hcdcec82_0    conda-forge
r-cli                     2.0.2             r35h6115d3f_0    conda-forge
r-clipr                   0.7.0             r35h6115d3f_0    conda-forge
r-cluster                 2.1.0             r35h9bbef5b_2    conda-forge
r-codetools               0.2_16          r35h6115d3f_1001    conda-forge
r-commonmark              1.7             r35hcdcec82_1001    conda-forge
r-covr                    3.5.0             r35h0357c0b_0    conda-forge
r-crayon                  1.3.4           r35h6115d3f_1002    conda-forge
r-crosstalk               1.1.0.1           r35h6115d3f_0    conda-forge
r-curl                    4.3               r35hcdcec82_0    conda-forge
r-desc                    1.2.0           r35h6115d3f_1002    conda-forge
r-devtools                2.3.0             r35h6115d3f_0    conda-forge
r-digest                  0.6.25            r35h0357c0b_1    conda-forge
r-dt                      0.13              r35h6115d3f_0    conda-forge
r-ellipsis                0.3.0             r35hcdcec82_0    conda-forge
r-evaluate                0.14              r35h6115d3f_1    conda-forge
r-fansi                   0.4.1             r35hcdcec82_0    conda-forge
r-foreach                 1.5.0             r35h6115d3f_0    conda-forge
r-foreign                 0.8_76            r35hcdcec82_0    conda-forge
r-fs                      1.4.1             r35h0357c0b_0    conda-forge
r-gam                     1.16.1            r35h9bbef5b_2    conda-forge
r-gh                      1.1.0             r35h6115d3f_0    conda-forge
r-git2r                   0.26.1            r35h7253d3a_1    conda-forge
r-glue                    1.4.0             r35hcdcec82_0    conda-forge
r-highr                   0.8               r35h6115d3f_1    conda-forge
r-htmltools               0.4.0             r35h0357c0b_0    conda-forge
r-htmlwidgets             1.5.1             r35h6115d3f_0    conda-forge
r-httr                    1.4.1             r35h6115d3f_1    conda-forge
r-ini                     0.3.1           r35h6115d3f_1002    conda-forge
r-iterators               1.0.12            r35h6115d3f_0    conda-forge
r-jsonlite                1.6.1             r35hcdcec82_0    conda-forge
r-kernsmooth              2.23_17           r35hfa343cc_0    conda-forge
r-knitr                   1.28              r35h6115d3f_0    conda-forge
r-later                   1.0.0             r35h0357c0b_0    conda-forge
r-lattice                 0.20_41           r35hcdcec82_1    conda-forge
r-lazyeval                0.2.2             r35hcdcec82_1    conda-forge
r-lifecycle               0.2.0             r35h6115d3f_0    conda-forge
r-magrittr                1.5             r35h6115d3f_1002    conda-forge
r-markdown                1.1               r35hcdcec82_0    conda-forge
r-mass                    7.3_51.6          r35hcdcec82_1    conda-forge
r-matrix                  1.2_18            r35h7fa42b6_2    conda-forge
r-memoise                 1.1.0           r35h6115d3f_1003    conda-forge
r-mgcv                    1.8_31            r35h7fa42b6_0    conda-forge
r-mime                    0.9               r35hcdcec82_0    conda-forge
r-nlme                    3.1_147           r35h9bbef5b_0    conda-forge
r-nnet                    7.3_14            r35hcdcec82_0    conda-forge
r-openssl                 1.4.1             r35he5c4762_0    conda-forge
r-pillar                  1.4.3             r35h6115d3f_0    conda-forge
r-pkgbuild                1.0.7             r35h6115d3f_0    conda-forge
r-pkgconfig               2.0.3             r35h6115d3f_0    conda-forge
r-pkgload                 1.0.2           r35h0357c0b_1001    conda-forge
r-praise                  1.0.0           r35h6115d3f_1003    conda-forge
r-prettyunits             1.1.1             r35h6115d3f_0    conda-forge
r-processx                3.4.2             r35hcdcec82_0    conda-forge
r-promises                1.1.0             r35h0357c0b_0    conda-forge
r-ps                      1.3.2             r35hcdcec82_0    conda-forge
r-purrr                   0.3.4             r35hcdcec82_0    conda-forge
r-r6                      2.4.1             r35h6115d3f_0    conda-forge
r-rcmdcheck               1.3.3             r35h6115d3f_2    conda-forge
r-rcpp                    1.0.4.6           r35h0357c0b_0    conda-forge
r-recommended             3.5.1                  r35_1003    conda-forge
r-rematch2                2.1.2             r35h6115d3f_0    conda-forge
r-remotes                 2.1.1             r35h6115d3f_0    conda-forge
r-rex                     1.2.0             r35h6115d3f_0    conda-forge
r-rlang                   0.4.5             r35hcdcec82_2    conda-forge
r-roxygen2                7.1.0             r35h0357c0b_0    conda-forge
r-rpart                   4.1_15            r35hcdcec82_1    conda-forge
r-rprojroot               1.3_2           r35h6115d3f_1002    conda-forge
r-rstudioapi              0.11              r35h6115d3f_0    conda-forge
r-rversions               2.0.1             r35h6115d3f_0    conda-forge
r-sessioninfo             1.1.1           r35h6115d3f_1001    conda-forge
r-spatial                 7.3_12            r35hcdcec82_0    conda-forge
r-stringi                 1.4.3             r35h0357c0b_2    conda-forge
r-stringr                 1.4.0             r35h6115d3f_1    conda-forge
r-survival                3.1_12            r35hcdcec82_0    conda-forge
r-sys                     3.3               r35hcdcec82_0    conda-forge
r-testthat                2.3.2             r35h0357c0b_0    conda-forge
r-tibble                  3.0.1             r35hcdcec82_0    conda-forge
r-usethis                 1.6.1             r35h6115d3f_0    conda-forge
r-utf8                    1.1.4           r35hcdcec82_1002    conda-forge
r-vctrs                   0.2.4             r35hcdcec82_0    conda-forge
r-whisker                 0.4               r35h6115d3f_0    conda-forge
r-withr                   2.2.0             r35h6115d3f_0    conda-forge
r-xfun                    0.13              r35h6115d3f_0    conda-forge
r-xml2                    1.3.2             r35h0357c0b_0    conda-forge
r-xopen                   1.0.0           r35h6115d3f_1002    conda-forge
r-yaml                    2.2.1             r35hcdcec82_0    conda-forge
r-zeallot                 0.1.0           r35h6115d3f_1001    conda-forge
readline                  7.0                  h7b6447c_5  
rpy2                      3.3.3                    pypi_0    pypi
scanpy                    1.5.1                    pypi_0    pypi
scikit-learn              0.22.1           py37hd81dba3_0  
scipy                     1.4.1            py37h0b6359f_0  
scprep                    1.0.5.post2              pypi_0    pypi
seaborn                   0.10.1                     py_0  
setuptools                46.4.0                   py37_0  
setuptools-scm            3.5.0                    pypi_0    pypi
sip                       4.19.8           py37hf484d3e_0  
six                       1.14.0                   py37_0  
snappy                    1.1.7                hbae5bb6_3  
sqlite                    3.31.1               h62c20be_1  
statsmodels               0.11.1           py37h7b6447c_0  
tasklogger                1.0.0                    pypi_0    pypi
tbb                       2020.0.133               pypi_0    pypi
tk                        8.6.8                hbc83047_0  
tktable                   2.10                 h14c3975_0  
tornado                   6.0.4            py37h7b6447c_1  
tqdm                      4.46.0                   pypi_0    pypi
traitlets                 4.3.3                    py37_0    anaconda
tzlocal                   2.1                      pypi_0    pypi
umap-learn                0.4.3                    pypi_0    pypi
wcwidth                   0.1.9                      py_0    anaconda
wheel                     0.34.2                   py37_0  
wrapt                     1.12.1                   pypi_0    pypi
xz                        5.2.5                h7b6447c_0  
zipp                      3.1.0                    pypi_0    pypi
zlib                      1.2.11               h7b6447c_3  
zstd                      1.3.7                h0b5b093_0  

Shape mismatch in terminal cluster identification

Hi Palantir team,

Great work on this tool -- I hope you are getting a positive response!

I am getting a persistent error during terminal cluster identification:

shape mismatch: value array of shape (0,1152) could not be broadcast to indexing result of shape (0,)

The value varies but it's always been between 1100 and 1200.

I suspect this is happening because the set of absorbing states is coming up empty. The traceback points to line 371 in palantir/core.py, which does T[abs_states, :] = 0 inside a function called _differentiation_entropy.

Right now, I am testing palantir on confidential data, so I can't share the exact example, but if I have time to reproduce the code on public data, I'll post here again.

d = sce.tl.palantir(adata) returns "None"

Hi,
It's me again :)
Thanks for providing an amazing tool for single-cell data analysis.
I was trying to use palantir in scanpy and I just reran the example data. However,
d = sce.tl.palantir(adata)
always return None for any kind of data. Could you please comment on this?
I am using scanpy 1.5 and have updated Palantir to 0.2.6
Thanks in advance,
Zeinab

Adding colorbar to plot_gene_expression

Is there a way to produce colorbar with a plot using plot_gene_expression? It tried this, but it didn't work:

palantir.plot.plot_gene_expression(imp_df, tsne, ['CD34'])
plt.colorbar()

Error returned:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-58-a001565da174> in <module>()
      1 palantir.plot.plot_gene_expression(imp_df, tsne, ['CD34'])
----> 2 plt.colorbar()

/Users/mcfefa/.local/lib/python3.6/site-packages/matplotlib/pyplot.py in colorbar(mappable, cax, ax, **kw)
   2091         mappable = gci()
   2092         if mappable is None:
-> 2093             raise RuntimeError('No mappable was found to use for colorbar '
   2094                                'creation. First define a mappable such as '
   2095                                'an image (with imshow) or a contour set ('

RuntimeError: No mappable was found to use for colorbar creation. First define a mappable such as an image (with imshow) or a contour set (with contourf).

rpy2 raises Error

RRuntimError is moved to a different interface in rpy2 and raises an error.

module 'rpy2.situation' has no attribute 'get_rlib_path'

Hi,
I am encountering this error, I guess it may be due to lack of some package?
However, I am too naive with rpy2, any suggestion?
Thanks!

AttributeError Traceback (most recent call last)
in
1 genes = ['CD34', 'MPO', 'GATA1', 'IRF8']
----> 2 gene_trends = palantir.presults.compute_gene_trends( pr_res, imp_df.loc[:, genes])

~/anaconda3/envs/myenv/lib/python3.7/site-packages/palantir/presults.py in compute_gene_trends(pr_res, gene_exprs, lineages, n_jobs)
77 try:
78 import rpy2
---> 79 import rpy2.rinterface_lib.embedded as embedded
80 from rpy2.robjects.packages import importr
81 except ImportError:

~/anaconda3/envs/myenv/lib/python3.7/site-packages/rpy2/rinterface_lib/embedded.py in
5 import warnings
6 from _rinterface_cffi import ffi
----> 7 from . import openrlib
8 from . import callbacks
9

~/anaconda3/envs/myenv/lib/python3.7/site-packages/rpy2/rinterface_lib/openrlib.py in
19
20
---> 21 rlib = _dlopen_rlib(R_HOME)
22
23

~/anaconda3/envs/myenv/lib/python3.7/site-packages/rpy2/rinterface_lib/openrlib.py in _dlopen_rlib(r_home)
14 raise ValueError('r_home is None. '
15 'Try python -m rpy2.situation')
---> 16 lib_path = rpy2.situation.get_rlib_path(r_home, platform.system())
17 rlib = ffi.dlopen(lib_path)
18 return rlib

AttributeError: module 'rpy2.situation' has no attribute 'get_rlib_path'

EDITED:

import rpy2
print(rpy2.__version__)

2.9.4

import rpy2.situation
for row in rpy2.situation.iter_info():
    print(row)

Python version:
3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0]
Looking for R's HOME:
Environment variable R_HOME: None
Calling R RHOME: /home/xupb/anaconda3/lib/R
InstallPath in the registry: *** Only available on Windows ***
R version:
In the PATH: R version 3.5.1 (2018-07-02) -- "Feather Spray"
Used to build rpy2: 3-5.1--74947
Additional directories to load R packages from:
None

cannot install Palantir

Hi. I am new to Biology and want to install Palantir package with pip install palantir.

conda -V
conda 4.8.3
pip -V
pip 20.0.2 from C:\Users\CSY\anaconda3\lib\site-packages\pip (python 3.7)

Error is listed below.

(base) C:\Users\CSY>pip install palantir
Collecting palantir
  Using cached palantir-0.2.6-py3-none-any.whl (26 kB)
Requirement already satisfied: Cython in c:\users\csy\anaconda3\lib\site-packages (from palantir) (0.29.15)
Requirement already satisfied: scanpy in c:\users\csy\anaconda3\lib\site-packages (from palantir) (1.5.1)
Requirement already satisfied: pandas>=0.22.0 in c:\users\csy\anaconda3\lib\site-packages (from palantir) (1.0.1)
Requirement already satisfied: numpy>=1.14.2 in c:\users\csy\anaconda3\lib\site-packages (from palantir) (1.18.1)
Requirement already satisfied: PhenoGraph>=1.5.3 in c:\users\csy\anaconda3\lib\site-packages (from palantir) (1.5.6)
Requirement already satisfied: tables>=3.4.2 in c:\users\csy\anaconda3\lib\site-packages (from palantir) (3.6.1)
Requirement already satisfied: scipy>=1.3 in c:\users\csy\anaconda3\lib\site-packages (from palantir) (1.4.1)
Requirement already satisfied: networkx>=2.1 in c:\users\csy\anaconda3\lib\site-packages (from palantir) (2.4)
Requirement already satisfied: cmake in c:\users\csy\anaconda3\lib\site-packages (from palantir) (3.17.3)
Requirement already satisfied: joblib in c:\users\csy\anaconda3\lib\site-packages (from palantir) (0.14.1)
Requirement already satisfied: matplotlib>=2.2.2 in c:\users\csy\anaconda3\lib\site-packages (from palantir) (3.1.3)
Requirement already satisfied: seaborn>=0.8.1 in c:\users\csy\anaconda3\lib\site-packages (from palantir) (0.10.0)
Requirement already satisfied: tzlocal in c:\users\csy\anaconda3\lib\site-packages (from palantir) (2.1)
Requirement already satisfied: scikit-learn in c:\users\csy\anaconda3\lib\site-packages (from palantir) (0.22.1)
Collecting MulticoreTSNE
  Using cached MulticoreTSNE-0.1.tar.gz (20 kB)
Requirement already satisfied: fcsparser>=0.1.2 in c:\users\csy\anaconda3\lib\site-packages (from palantir) (0.2.1)
Requirement already satisfied: umap-learn>=0.3.10 in c:\users\csy\anaconda3\lib\site-packages (from scanpy->palantir) (0.4.5)
Requirement already satisfied: tqdm in c:\users\csy\anaconda3\lib\site-packages (from scanpy->palantir) (4.42.1)
Requirement already satisfied: importlib-metadata>=0.7; python_version < "3.8" in c:\users\csy\anaconda3\lib\site-packages (from scanpy->palantir) (1.5.0)
Requirement already satisfied: patsy in c:\users\csy\anaconda3\lib\site-packages (from scanpy->palantir) (0.5.1)
Requirement already satisfied: natsort in c:\users\csy\anaconda3\lib\site-packages (from scanpy->palantir) (7.0.1)
Requirement already satisfied: setuptools-scm in c:\users\csy\anaconda3\lib\site-packages (from scanpy->palantir) (4.1.2)
Requirement already satisfied: numba>=0.41.0 in c:\users\csy\anaconda3\lib\site-packages (from scanpy->palantir) (0.48.0)
Requirement already satisfied: anndata>=0.7 in c:\users\csy\anaconda3\lib\site-packages (from scanpy->palantir) (0.7.4)
Requirement already satisfied: statsmodels>=0.10.0rc2 in c:\users\csy\anaconda3\lib\site-packages (from scanpy->palantir) (0.11.0)
Requirement already satisfied: h5py>=2.10.0 in c:\users\csy\anaconda3\lib\site-packages (from scanpy->palantir) (2.10.0)
Requirement already satisfied: legacy-api-wrap in c:\users\csy\anaconda3\lib\site-packages (from scanpy->palantir) (1.2)
Requirement already satisfied: packaging in c:\users\csy\anaconda3\lib\site-packages (from scanpy->palantir) (20.1)
Requirement already satisfied: python-dateutil>=2.6.1 in c:\users\csy\anaconda3\lib\site-packages (from pandas>=0.22.0->palantir) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in c:\users\csy\anaconda3\lib\site-packages (from pandas>=0.22.0->palantir) (2019.3)
Requirement already satisfied: psutil>4 in c:\users\csy\anaconda3\lib\site-packages (from PhenoGraph>=1.5.3->palantir) (5.6.7)
Requirement already satisfied: leidenalg>=0.7.0 in c:\users\csy\anaconda3\lib\site-packages (from PhenoGraph>=1.5.3->palantir) (0.8.1)
Requirement already satisfied: setuptools>=18.0.1 in c:\users\csy\anaconda3\lib\site-packages (from PhenoGraph>=1.5.3->palantir) (45.2.0.post20200210)
Requirement already satisfied: numexpr>=2.6.2 in c:\users\csy\anaconda3\lib\site-packages (from tables>=3.4.2->palantir) (2.7.1)
Requirement already satisfied: decorator>=4.3.0 in c:\users\csy\anaconda3\lib\site-packages (from networkx>=2.1->palantir) (4.4.1)
Requirement already satisfied: cycler>=0.10 in c:\users\csy\anaconda3\lib\site-packages (from matplotlib>=2.2.2->palantir) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\users\csy\anaconda3\lib\site-packages (from matplotlib>=2.2.2->palantir) (2.4.6)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\csy\anaconda3\lib\site-packages (from matplotlib>=2.2.2->palantir) (1.1.0)
Requirement already satisfied: cffi in c:\users\csy\anaconda3\lib\site-packages (from MulticoreTSNE->palantir) (1.14.0)
Requirement already satisfied: six in c:\users\csy\anaconda3\lib\site-packages (from fcsparser>=0.1.2->palantir) (1.14.0)
Requirement already satisfied: zipp>=0.5 in c:\users\csy\anaconda3\lib\site-packages (from importlib-metadata>=0.7; python_version < "3.8"->scanpy->palantir) (2.2.0)
Requirement already satisfied: llvmlite<0.32.0,>=0.31.0dev0 in c:\users\csy\anaconda3\lib\site-packages (from numba>=0.41.0->scanpy->palantir) (0.31.0)
Requirement already satisfied: get-version>=2.0.4 in c:\users\csy\anaconda3\lib\site-packages (from legacy-api-wrap->scanpy->palantir) (2.1)
Requirement already satisfied: python-igraph>=0.8.0 in c:\users\csy\anaconda3\lib\site-packages (from leidenalg>=0.7.0->PhenoGraph>=1.5.3->palantir) (0.8.2)
Requirement already satisfied: pycparser in c:\users\csy\anaconda3\lib\site-packages (from cffi->MulticoreTSNE->palantir) (2.19)
Requirement already satisfied: texttable>=1.6.2 in c:\users\csy\anaconda3\lib\site-packages (from python-igraph>=0.8.0->leidenalg>=0.7.0->PhenoGraph>=1.5.3->palantir) (1.6.2)
Building wheels for collected packages: MulticoreTSNE
  Building wheel for MulticoreTSNE (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\CSY\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CSY\\AppData\\Local\\Temp\\pip-install-m980ovr7\\MulticoreTSNE\\setup.py'"'"'; __file__='"'"'C:\\Users\\CSY\\AppData\\Local\\Temp\\pip-install-m980ovr7\\MulticoreTSNE\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\CSY\AppData\Local\Temp\pip-wheel-mekidrn8'
       cwd: C:\Users\CSY\AppData\Local\Temp\pip-install-m980ovr7\MulticoreTSNE\
  Complete output (46 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.7
  creating build\lib.win-amd64-3.7\MulticoreTSNE
  copying MulticoreTSNE\__init__.py -> build\lib.win-amd64-3.7\MulticoreTSNE
  creating build\lib.win-amd64-3.7\MulticoreTSNE\tests
  copying MulticoreTSNE\tests\test_base.py -> build\lib.win-amd64-3.7\MulticoreTSNE\tests
  copying MulticoreTSNE\tests\__init__.py -> build\lib.win-amd64-3.7\MulticoreTSNE\tests
  running egg_info
  writing MulticoreTSNE.egg-info\PKG-INFO
  writing dependency_links to MulticoreTSNE.egg-info\dependency_links.txt
  writing requirements to MulticoreTSNE.egg-info\requires.txt
  writing top-level names to MulticoreTSNE.egg-info\top_level.txt
  reading manifest file 'MulticoreTSNE.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'MulticoreTSNE.egg-info\SOURCES.txt'
  running build_ext
  cmake version 3.17.3

  CMake suite maintained and supported by Kitware (kitware.com/cmake).
  -- Building for: NMake Makefiles
  -- The CXX compiler identification is unknown
  CMake Error at CMakeLists.txt:1 (PROJECT):
    The CMAKE_CXX_COMPILER:

      cl

    is not a full path and was not found in the PATH.

    To use the NMake generator with Visual C++, cmake must be run from a shell
    that can use the compiler cl from the command line.  This environment is
    unable to invoke the cl compiler.  To fix this problem, run cmake from the
    Visual Studio Command Prompt (vcvarsall.bat).

    Tell CMake where to find the compiler by setting either the environment
    variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
    to the compiler, or to the compiler name if it is in the PATH.


  -- Configuring incomplete, errors occurred!
  See also "C:/Users/CSY/AppData/Local/Temp/pip-install-m980ovr7/MulticoreTSNE/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
  See also "C:/Users/CSY/AppData/Local/Temp/pip-install-m980ovr7/MulticoreTSNE/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeError.log".

  ERROR: Cannot generate Makefile. See above errors.
  ----------------------------------------
  ERROR: Failed building wheel for MulticoreTSNE
  Running setup.py clean for MulticoreTSNE
Failed to build MulticoreTSNE
Installing collected packages: MulticoreTSNE, palantir
    Running setup.py install for MulticoreTSNE ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\CSY\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CSY\\AppData\\Local\\Temp\\pip-install-m980ovr7\\MulticoreTSNE\\setup.py'"'"'; __file__='"'"'C:\\Users\\CSY\\AppData\\Local\\Temp\\pip-install-m980ovr7\\MulticoreTSNE\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\CSY\AppData\Local\Temp\pip-record-43liyyy6\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\CSY\anaconda3\Include\MulticoreTSNE'
         cwd: C:\Users\CSY\AppData\Local\Temp\pip-install-m980ovr7\MulticoreTSNE\
    Complete output (46 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\MulticoreTSNE
    copying MulticoreTSNE\__init__.py -> build\lib.win-amd64-3.7\MulticoreTSNE
    creating build\lib.win-amd64-3.7\MulticoreTSNE\tests
    copying MulticoreTSNE\tests\test_base.py -> build\lib.win-amd64-3.7\MulticoreTSNE\tests
    copying MulticoreTSNE\tests\__init__.py -> build\lib.win-amd64-3.7\MulticoreTSNE\tests
    running egg_info
    writing MulticoreTSNE.egg-info\PKG-INFO
    writing dependency_links to MulticoreTSNE.egg-info\dependency_links.txt
    writing requirements to MulticoreTSNE.egg-info\requires.txt
    writing top-level names to MulticoreTSNE.egg-info\top_level.txt
    reading manifest file 'MulticoreTSNE.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'MulticoreTSNE.egg-info\SOURCES.txt'
    running build_ext
    cmake version 3.17.3

    CMake suite maintained and supported by Kitware (kitware.com/cmake).
    -- Building for: NMake Makefiles
    -- The CXX compiler identification is unknown
    CMake Error at CMakeLists.txt:1 (PROJECT):
      The CMAKE_CXX_COMPILER:

        cl

      is not a full path and was not found in the PATH.

      To use the NMake generator with Visual C++, cmake must be run from a shell
      that can use the compiler cl from the command line.  This environment is
      unable to invoke the cl compiler.  To fix this problem, run cmake from the
      Visual Studio Command Prompt (vcvarsall.bat).

      Tell CMake where to find the compiler by setting either the environment
      variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
      to the compiler, or to the compiler name if it is in the PATH.


    -- Configuring incomplete, errors occurred!
    See also "C:/Users/CSY/AppData/Local/Temp/pip-install-m980ovr7/MulticoreTSNE/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
    See also "C:/Users/CSY/AppData/Local/Temp/pip-install-m980ovr7/MulticoreTSNE/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeError.log".

    ERROR: Cannot generate Makefile. See above errors.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\CSY\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CSY\\AppData\\Local\\Temp\\pip-install-m980ovr7\\MulticoreTSNE\\setup.py'"'"'; __file__='"'"'C:\\Users\\CSY\\AppData\\Local\\Temp\\pip-install-m980ovr7\\MulticoreTSNE\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\CSY\AppData\Local\Temp\pip-record-43liyyy6\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\CSY\anaconda3\Include\MulticoreTSNE' Check the logs for full command output.

About running Palantir using cisTopic object

Hello. I would like to run Palantir using cisTopic object by following the methods described under "Pseudotime Inference" from Ma et al., 2020 (Volume 183, Issue 4, 12 November 2020, Pages 1103-1116.e20). Where could I find a detailed method of this section of the journal article? If possible, may I have a detailed method for running Palantir using cisTopic object?

Thank you for your help.

Access Denied h5 files

Hello,

I tried accessing the replica files but getting access denied.

May you please have a look,

Thanks

Installation problem: failed building wheel for llvmlite

I have been facing multiple issues with the installation of Palantir. Currently, I have created a virtual environment, and I am trying to get the package installed within.

python 2.9
pip 20.3.3
Linux machine

Since I was getting an error "Failed building wheel for llvmlite", I tried to install it separately, using: "easy_install llvmlite.
And this worked! (image here)
image

Error I am facing:

image

image

image

image

image

Make rpy2 as an optional dependency

rpy2 is only necessary for plotting gene expression trends. Thus, rpy2 should be optional and installation prompted if the user attempts plotting expression trends.

cell cycle correction

hi,

Firstly, Palantir is a really great tool. thanks for making it!
I was wondering if the input to Palantir is the cell-cycle corrected data?
Also, in the comparison of Palantir to other methods in your jupiter notebooks, does the input anndata file of Human CD34+ bone marrow cells (where X is filtered, normalized matrix) include cell cycle correction. If palantir does use cell cycle corrected data, how much does this impact the results?

also, on a separate note, for some reason I cannot get Palantir to run when k (in the NN-graph) is around 10-15knn. Palantir completes the 'run' even as low as knn=5, but something happens in the knn= 10-15 range. Is this something you have experienced? I can share some error messages after I test it out a bit more myself.
Thanks a ton
Shobi

unable to repeat the results in multiple runs

Hi,

I just found in every single run without changing parameters, the diffusion map will be different, even though I set random.seed(100) (if that is the function of random.seed).

Any suggestion how to avoid this? Or just some bug produced in my own case?

Thanks!

Don’t install things in setup.py

This is not how you do it and can seriously annoy people. I for one am happy I didn’t blindly install this to be bitten by this misbehavior. Specify dependecies as dependencies (install_requires) instead.

call(['pip3', 'install', 'git+https://github.com/jacoblevine/PhenoGraph.git'])

Tutorial .h5ad file

Thanks for creating this great tool! I wanted to learn how to use Palantir and downloaded this repo, and tried running the tutorial, but ran into issues.
First, the tutorial's code uses an .h5ad file with instructions that the file is in the data folder of the GitHub repo, but I can't seem to find it, only the corresponding .csv file. So, instead, I tried using this .csv file to read in the raw data, but ran into this issue below:

`---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in
----> 1 palantir.preprocess.log_transform(ad)

~/opt/anaconda3/envs/palantir_env/lib/python3.8/site-packages/palantir/preprocess.py in log_transform(data, pseudo_count)
41 """
42 if type(data) is sc.AnnData:
---> 43 data.X.data = np.log2(data.X.data + pseudo_count) - np.log2(pseudo_count)
44 else:
45 return np.log2(data + pseudo_count)

TypeError: unsupported operand type(s) for +: 'memoryview' and 'float'`

I'm not too sure what this means, and would appreciate further guidance. I also thought it might be helpful to perhaps have the .h5ad file referenced in the tutorial uploaded to this repository as well? Thanks!

Is there a way to set the alpha parameter in the diffusion map?

Hi! Great package! Especially great kernel and multispace scaling!

I wonder if there is a way to set the alpha parameter when runni.ng run_diffusion_maps, as one may wish to get the Laplace-Beltrami operator to perform dimensionality reduction with, or do so in a Fokker-Planck fashion. I'm trying to perform some tests on how this could affect the embedding results.

Besides, is any way to implement this kernel with faster diffusion maps implementations, such as PyDiffMap or DMaps?

save fig in palantir.plot.plot_gene_expression

Hi,
I am trying to save figure in high resolution.

For

fig, ax = palantir.plot.plot_tsne(tsne)
fig.savefig('test.png',dpi=1200)

this worked for me.

However, not for

fig, ax=palantir.plot.plot_gene_expression(imp_df, tsne, ['gene'])
fig.savefig('group.png',dpi=1200)

AttributeError Traceback (most recent call last)
in
----> 1 fig.savefig('group.png',dpi=1200)

AttributeError: 'NoneType' object has no attribute 'savefig'

Any suggestion?
Thanks!

Value error: Did not find adata.var['highly_variable'] when it is actually present

I am using palantir and scanpy for trajectory inference in single-cell RNA-seq dataset.
There is some issue with computing Palantir diffusion maps.

  1. It gives me an error that is did not find adata.var['highly_variable'] when it is already present.
  2. It gives an error, that 'n_components' is not a valid argument, when it is.

Python 3.7.3 (default, Mar 27 2019, 22:11:17) [GCC 7.3.0]
Linux-3.10.0-1127.18.2.el7.x86_64-x86_64-with-redhat-7.8-Maipo
16 logical CPU cores, x86_64

palantir version 1.0.0

image

PackageNotInstalledError: The R package "gam" is not installed.

Hi,
Even though I have installed "gam" in R, I still face this issue: "PackageNotInstalledError: The R package "gam" is not installed " when I try to determine the gene expression trends. Would it be possible to use "pygam" instead of "gam" from R?

Thanks,
Zeinab

How to plot pr_res result in scanpy? Or how to export right embedding from adata to palantir.plot.plot_palantir_results

Hi team, sorry for the simple question. But I can't find the answer in the issues.
I get the pr_res by following code (I don't know how to get the right cell ID, but I copy one of the cells from the cluster of my interest)

early_cell = 'CATCCCACATGGGTTT-1-day0'
pr_res = sc.external.tl.palantir_results(
    adata,
    early_cell=early_cell,
    ms_data='X_palantir_multiscale',
    num_waypoints=500,
)

I didn't find the API in scanpy to plot pr_res, then I import Palantir and

tsne = adata.obsm['X_tsne']
tsne1 = pd.DataFrame({'obs_names':pd.Series(adata.obs_names,index =adata.obs_names),
                             'X_tsne-0':tsne[:,0],'X_tsne-1':tsne[:,1]})
del tsne1['obs_names']
palantir.plot.plot_palantir_results(pr_res,tsne=tsne1)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~/miniconda3/envs/py3.7/lib/python3.7/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   3079             try:
-> 3080                 return self._engine.get_loc(casted_key)
   3081             except KeyError as err:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'x'

The above exception was the direct cause of the following exception:

KeyError                                  Traceback (most recent call last)
<ipython-input-36-9dd0a87af803> in <module>
----> 1 palantir.plot.plot_palantir_results(pr_res,tsne=tsne1)

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/palantir/plot.py in plot_palantir_results(pr_res, tsne)
    345     ax = plt.subplot(gs[0:2, 1:3])
    346     c = pr_res.pseudotime[tsne.index]
--> 347     ax.scatter(tsne.loc[:, "x"], tsne.loc[:, "y"], s=3, cmap=matplotlib.cm.plasma, c=c)
    348     normalize = matplotlib.colors.Normalize(vmin=np.min(c), vmax=np.max(c))
    349     cax, _ = matplotlib.colorbar.make_axes(ax)

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/pandas/core/indexing.py in __getitem__(self, key)
    887                     # AttributeError for IntervalTree get_value
    888                     return self.obj._get_value(*key, takeable=self._takeable)
--> 889             return self._getitem_tuple(key)
    890         else:
    891             # we by definition only have the 0th axis

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/pandas/core/indexing.py in _getitem_tuple(self, tup)
   1058     def _getitem_tuple(self, tup: Tuple):
   1059         with suppress(IndexingError):
-> 1060             return self._getitem_lowerdim(tup)
   1061 
   1062         # no multi-index, so validate all of the indexers

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/pandas/core/indexing.py in _getitem_lowerdim(self, tup)
    805                 # We don't need to check for tuples here because those are
    806                 #  caught by the _is_nested_tuple_indexer check above.
--> 807                 section = self._getitem_axis(key, axis=i)
    808 
    809                 # We should never have a scalar section here, because

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/pandas/core/indexing.py in _getitem_axis(self, key, axis)
   1122         # fall thru to straight lookup
   1123         self._validate_key(key, axis)
-> 1124         return self._get_label(key, axis=axis)
   1125 
   1126     def _get_slice_axis(self, slice_obj: slice, axis: int):

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/pandas/core/indexing.py in _get_label(self, label, axis)
   1071     def _get_label(self, label, axis: int):
   1072         # GH#5667 this will fail if the label is not present in the axis.
-> 1073         return self.obj.xs(label, axis=axis)
   1074 
   1075     def _handle_lowerdim_multi_index_axis0(self, tup: Tuple):

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/pandas/core/generic.py in xs(self, key, axis, level, drop_level)
   3721         if axis == 1:
   3722             if drop_level:
-> 3723                 return self[key]
   3724             index = self.columns
   3725         else:

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/pandas/core/frame.py in __getitem__(self, key)
   3022             if self.columns.nlevels > 1:
   3023                 return self._getitem_multilevel(key)
-> 3024             indexer = self.columns.get_loc(key)
   3025             if is_integer(indexer):
   3026                 indexer = [indexer]

~/miniconda3/envs/py3.7/lib/python3.7/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   3080                 return self._engine.get_loc(casted_key)
   3081             except KeyError as err:
-> 3082                 raise KeyError(key) from err
   3083 
   3084         if tolerance is not None:

KeyError: 'x'

Issue with eigen vector numbers in multiscale space function

Hi,

First of all thank you for this tool, it works very nicely to uncover putative trajectories! I also experiemented using UMAP instead of t-SNE, which lead to similar interesting results as well!

But it seems there is an issue with the multiscale space function, it sometimes outputs an empty ms_data when automatic selection of n_eig is performed. In case I use a defined n_eigs, choosing any value will lead to a ms_data that will always have one less dimension than the parameter, so using n_eig=1 will also lead to an empty dataset.

By doing a quick look at the code I found what would explain what I am seeing:
use_eigs = list(range(1, n_eigs))
Having a 1 means that it obviously ignore the first column of Eigenvalues in the next lines. Is there a reason why we are ignoring it?

Thanks in advance for your help!

Louis

palantir.presults.PResults.load error

I tried to load the saved results from palantir, and got many errors. I am able to load with pkl but it is not a palantir result class.

---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
<ipython-input-4-62407a65f141> in <module>
----> 1 pr_res=palantir.presults.PResults.load('../data/palantir.pkl')

~/miniconda3/envs/scrna/lib/python3.7/site-packages/palantir/presults.py in load(cls, pkl_file)
     62             data["_entropy"],
     63             data["_branch_probs"],
---> 64             data["_waypoints"],
     65         )
     66         return presults

~/miniconda3/envs/scrna/lib/python3.7/site-packages/palantir/presults.py in __init__(self, pseudotime, entropy, branch_probs, waypoints)
     19 
     20         # Initialize
---> 21         self._pseudotime = (pseudotime - pseudotime.min()) / (
     22             pseudotime.max() - pseudotime.min()
     23         )

~/miniconda3/envs/scrna/lib/python3.7/site-packages/pandas/core/generic.py in stat_func(self, axis, skipna, level, numeric_only, **kwargs)
  11213             return self._agg_by_level(name, axis=axis, level=level, skipna=skipna)
  11214         return self._reduce(
> 11215             f, name, axis=axis, skipna=skipna, numeric_only=numeric_only
  11216         )
  11217 

~/miniconda3/envs/scrna/lib/python3.7/site-packages/pandas/core/series.py in _reduce(self, op, name, axis, skipna, numeric_only, filter_type, **kwds)
   3864         otherwise delegate to the object.
   3865         """
-> 3866         delegate = self._values
   3867 
   3868         if axis is not None:

~/miniconda3/envs/scrna/lib/python3.7/site-packages/pandas/core/generic.py in __getattr__(self, name)
   5270             return object.__getattribute__(self, name)
   5271         else:
-> 5272             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5273                 return self[name]
   5274             return object.__getattribute__(self, name)

... last 1 frames repeated, from the frame below ...

~/miniconda3/envs/scrna/lib/python3.7/site-packages/pandas/core/generic.py in __getattr__(self, name)
   5270             return object.__getattribute__(self, name)
   5271         else:
-> 5272             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5273                 return self[name]
   5274             return object.__getattribute__(self, name)

RecursionError: maximum recursion depth exceeded

publication cell types

I was trying to retrieve the data from the Nature Biotechnology paper. The data directory contains the expression values and the tSNE coordinates. However, I cannot locate the cell type labels (as shown in Fig. 1a or Fig. 2b). Where can I find those?

error on Run diffusion maps (KeyError: 'distances')

Hi,
I am trying to use Palantir for mass cytometry data. I started first to reproduce the example data that you provided, however, I faced this error message:
dm_res = palantir.utils.run_diffusion_maps(pca_projections, n_components=5)

KeyError Traceback (most recent call last)
in
1 # Run diffusion maps
----> 2 dm_res = palantir.utils.run_diffusion_maps(pca_projections, n_components=5 ,knn=30, n_jobs=-1, alpha=0)

~/.local/lib/python3.7/site-packages/palantir/utils.py in run_diffusion_maps(data_df, n_components, knn, n_jobs, alpha)
41 temp = sc.AnnData(data_df.values)
42 sc.pp.neighbors(temp, n_pcs=0, n_neighbors=knn)
---> 43 kNN = temp.uns['neighbors']['distances']
44
45 # Adaptive k

KeyError: 'distances'

could you please help me to figure out what is going wrong?

Thanks in advance,
Zeinab

ValueError: Bin edges must be unique:

I was ran these codes and got error:

sc.pp.normalize_per_cell(C2)
palantir.preprocess.log_transform(C2)
sc.pp.highly_variable_genes(C2, n_top_genes=1000, flavor='cell_ranger')


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-30-8125ec15df52> in <module>
----> 1 sc.pp.highly_variable_genes(C2, n_top_genes=1000, flavor='cell_ranger')

/opt/conda/lib/python3.8/site-packages/scanpy/preprocessing/_highly_variable_genes.py in highly_variable_genes(adata, layer, n_top_genes, min_disp, max_disp, min_mean, max_mean, span, n_bins, flavor, subset, inplace, batch_key)
    424 
    425     if batch_key is None:
--> 426         df = _highly_variable_genes_single_batch(
    427             adata,
    428             layer=layer,

/opt/conda/lib/python3.8/site-packages/scanpy/preprocessing/_highly_variable_genes.py in _highly_variable_genes_single_batch(adata, layer, min_disp, max_disp, min_mean, max_mean, n_top_genes, n_bins, flavor)
    242         from statsmodels import robust
    243 
--> 244         df['mean_bin'] = pd.cut(
    245             df['means'],
    246             np.r_[-np.inf, np.percentile(df['means'], np.arange(10, 105, 5)), np.inf],

/opt/conda/lib/python3.8/site-packages/pandas/core/reshape/tile.py in cut(x, bins, right, labels, retbins, precision, include_lowest, duplicates, ordered)
    271             raise ValueError("bins must increase monotonically.")
    272 
--> 273     fac, bins = _bins_to_cuts(
    274         x,
    275         bins,

/opt/conda/lib/python3.8/site-packages/pandas/core/reshape/tile.py in _bins_to_cuts(x, bins, right, labels, precision, include_lowest, dtype, duplicates, ordered)
    397     if len(unique_bins) < len(bins) and len(bins) != 2:
    398         if duplicates == "raise":
--> 399             raise ValueError(
    400                 f"Bin edges must be unique: {repr(bins)}.\n"
    401                 f"You can drop duplicate edges by setting the 'duplicates' kwarg"

ValueError: Bin edges must be unique: array([          -inf, 1.00000000e-12, 1.00000000e-12, 5.40105948e-04,
       1.00438703e-03, 1.97046941e-03, 3.51440884e-03, 6.46164417e-03,
       1.23855204e-02, 2.44226694e-02, 5.05443168e-02, 9.71072304e-02,
       1.71948684e-01, 2.66962457e-01, 3.84024115e-01, 5.42443170e-01,
       7.61077264e-01, 1.11170306e+00, 1.84908313e+00, 9.83359179e+00,
                  inf]).
You can drop duplicate edges by setting the 'duplicates' kwarg

can I transfer cell identity from Seurat to Palantir

Dear Palantir team,
I used Seurat to cluster and label the identity of my cells, and would love to use your tool to do trajectory analysis. I'm wondering is there anyway to transfer the cell identity information from Seurat to Palantir? Thanks!

Bug computing gene expression trends

Hi! I'm trying to use Palantir to compute pseudotime and gene expression trends. Yet, I'm facing the following bug, which seems to be due to the deprecation of some syntax used in the code.


gene_trends = palantir.presults.compute_gene_trends( pr_res, df[genes])
Alveolar type 1
findfont: Font family ['Raleway'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Raleway'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Raleway'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Raleway'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Lato'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Raleway'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Lato'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Lato'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Lato'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Raleway'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Lato'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Raleway'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Lato'] not found. Falling back to DejaVu Sans.
findfont: Font family ['Lato'] not found. Falling back to DejaVu Sans.
/usr/local/lib/python3.8/dist-packages/palantir/presults.py:169: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
  pd.DataFrame(np.array([x, y]).T[use_inds, :], columns=["x", "y"])
/usr/local/lib/python3.8/dist-packages/palantir/presults.py:169: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
  pd.DataFrame(np.array([x, y]).T[use_inds, :], columns=["x", "y"])
joblib.externals.loky.process_executor._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/joblib/externals/loky/process_executor.py", line 431, in _process_worker
    r = call_item()
  File "/usr/local/lib/python3.8/dist-packages/joblib/externals/loky/process_executor.py", line 285, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/dist-packages/joblib/_parallel_backends.py", line 595, in __call__
    return self.func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/joblib/parallel.py", line 252, in __call__
    return [func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/joblib/parallel.py", line 252, in <listcomp>
    return [func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/palantir/presults.py", line 169, in _gam_fit_predict
    pd.DataFrame(np.array([x, y]).T[use_inds, :], columns=["x", "y"])
ValueError: could not broadcast input array from shape (37449,2) into shape (37449)
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/lib/python3.8/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "/usr/local/lib/python3.8/dist-packages/palantir/presults.py", line 134, in compute_gene_trends
    res = Parallel(n_jobs=n_jobs)(
  File "/usr/local/lib/python3.8/dist-packages/joblib/parallel.py", line 1042, in __call__
    self.retrieve()
  File "/usr/local/lib/python3.8/dist-packages/joblib/parallel.py", line 921, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "/usr/local/lib/python3.8/dist-packages/joblib/_parallel_backends.py", line 542, in wrap_future_result
    return future.result(timeout=timeout)
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 432, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
ValueError: could not broadcast input array from shape (37449,2) into shape (37449)

I'm running python 3.8 on a Linux system and analyzing 37,449 cells. I want to get the gene expression trends for three different terminal states I identified.

Any insights on this from the developers?

EDIT: The bug happens only if passing more than one gene. Calling palantir.presults.compute_gene_trends(pr_res, df['GENE']) works fine.

Segmentation fault when running "run_palantir"

I am getting the following error when I run the run_palantir command: pr_res = palantir.core.run_palantir(ms_data, start_cell, num_waypoints=600)

TerminatedWorkerError: A worker process managed by the executor was unexpectedly terminated. This could be caused by a segmentation fault while calling the function or by an excessive memory usage causing the Operating System to kill the worker. The exit codes of the workers are {SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6), SIGABRT(-6)}

I was getting an empty ms data frame so I manually specified n_eigs.

Thank you!

Update tutorial

  • Using anndata and starting from an anndata object
  • Preprocessing update
  • Force directed layouts

palantir.presults.compute_gene_trends: Segmentation fault (core dumped)

/usr/local/lib/python3.6/site-packages/joblib/externals/loky/backend/semaphore_tracker.py:198: UserWarning: semaphore_tracker: There appear to be 6 leaked semaphores to clean up at shutdown
len(cache))

When I run palantir.presults.compute_gene_trends in Scanpy, it has segmentation fault, and it made me out of the python environment.

unable to calculate differentiation potential

Hi, Palantir team

Very nice tool!

I am using my own data to run Palantir.
After I run palantir.plot.plot_palantir_results(pr_res, tsne), I did not get differentiation potential value, is this due to some disconnection on tsne projection of data? Or I use wrong mapping?(I am very fresh on python code)

start_cell='mda_day35_AGGGTGAAGACGCAAC'
pr_res = palantir.core.run_palantir(ms_data, start_cell, num_waypoints=500)
mapping = pd.Series(index=['mylin'])
mapping['mylin'] = pr_res.branch_probs.columns.difference(mapping.values)[0]
mapping = pd.Series(mapping.index, index=mapping)
pr_res.branch_probs.columns = mapping[pr_res.branch_probs.columns]
palantir.plot.plot_palantir_results(pr_res, tsne)

The results of palantir.plot.plot_palantir_results(pr_res, tsne) is shown below, all entropy is zero:
image

Any suggestion?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.