diff --git a/README.md b/README.md
index f0edde0b..b6b801bd 100755
--- a/README.md
+++ b/README.md
@@ -11,7 +11,8 @@ Palantir is an algorithm to align cells along differentiation trajectories. Pala
$> pip install palantir
2. Palantir depends on a number of `python3` packages available on pypi and these dependencies are listed in `setup.py`
-All the dependencies will be automatically installed using the above commands
+
+ All the dependencies will be automatically installed using the above commands
3. To uninstall:
@@ -19,7 +20,15 @@ All the dependencies will be automatically installed using the above commands
4. If you would like to determine gene expression trends, please install R programming language and the R package GAM . You will also need to install the rpy2 module using
+ $> pip install .['PLOT_GENE_TRENDS']
+ OR,
$> pip install rpy2
+
+ In case of compiler error during installation of `rpy2`, try to link your compiler in `env`. Example:
+
+ $> env CC=/usr/local/Cellar/gcc/xxx/bin/gcc-x pip install .['PLOT_GENE_TRENDS']
+
+ where `x` should be replaced with the version numbers
5. Palantir can also be used with [**Scanpy**](https://github.com/theislab/scanpy). It is fully integrated into Scanpy, and can be found under Scanpy's external modules ([link](https://scanpy.readthedocs.io/en/latest/api/scanpy.external.html#external-api))
@@ -70,6 +79,10 @@ ____
Release Notes
-------------
+### Version 0.2.6
+
+ * A fix to [issue#33](https://github.com/dpeerlab/Palantir/issues/33) and [issue#31](https://github.com/dpeerlab/Palantir/issues/31)
+
### Version 0.2.5
* A fix related to [issue#28](https://github.com/dpeerlab/Palantir/issues/28). When identifying terminal states, duplicate values were generated instead of unique ones.
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 5c7ef5db..2006bf26 100755
--- a/setup.py
+++ b/setup.py
@@ -40,9 +40,11 @@
"matplotlib>=2.2.2",
"seaborn>=0.8.1",
"tzlocal",
- "rpy2>=3.0.2",
"scanpy",
],
+ extras_require={
+ 'PLOT_GENE_TRENDS': ["rpy2>=3.0.2"]
+ },
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
diff --git a/src/palantir/utils.py b/src/palantir/utils.py
index 4296900b..d3e533aa 100644
--- a/src/palantir/utils.py
+++ b/src/palantir/utils.py
@@ -22,11 +22,13 @@ def run_pca(data, n_components=300):
return pca_projections, pca.explained_variance_ratio_
-def run_diffusion_maps(data_df, n_components=10, knn=30, n_jobs=-1, alpha=0):
+def run_diffusion_maps(data_df, n_components=10, knn=30, alpha=0):
"""Run Diffusion maps using the adaptive anisotropic kernel
- :param data_df: PCA projections of the data or adjancency matrix
+ :param data_df: PCA projections of the data or adjacency matrix
:param n_components: Number of diffusion components
+ :param knn: Number of nearest neighbors for graph construction
+ :param alpha: Normalization parameter for the diffusion operator
:return: Diffusion components, corresponding eigen values and the diffusion operator
"""
@@ -36,7 +38,11 @@ def run_diffusion_maps(data_df, n_components=10, knn=30, n_jobs=-1, alpha=0):
print("Determing nearest neighbor graph...")
temp = sc.AnnData(data_df.values)
sc.pp.neighbors(temp, n_pcs=0, n_neighbors=knn)
- kNN = temp.uns["neighbors"]["distances"]
+ # maintaining backwards compatibility to Scanpy `sc.pp.neighbors`
+ try:
+ kNN = temp.uns["neighbors"]["distances"]
+ except KeyError:
+ kNN = temp.obsp['distances']
# Adaptive k
adaptive_k = int(np.floor(knn / 3))
diff --git a/src/palantir/version.py b/src/palantir/version.py
index 87fa5448..21a43d46 100644
--- a/src/palantir/version.py
+++ b/src/palantir/version.py
@@ -1,3 +1,3 @@
-__version__ = "0.2.5"
+__version__ = "0.2.6"
__author__ = "Manu Setty"
__author_email__ = "manu.talanki@gmail.com"