Skip to content

Commit

Permalink
Issue_33 and 31 fix
Browse files Browse the repository at this point in the history
A fix related to #33 and #31
  • Loading branch information
awnimo committed May 20, 2020
1 parent 6d80708 commit 91f301b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
15 changes: 14 additions & 1 deletion README.md
Expand Up @@ -11,15 +11,24 @@ 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:

$> pip uninstall palantir

4. If you would like to determine gene expression trends, please install <a href="https://cran.r-project.org"> R <a> programming language and the R package <a href="https://cran.r-project.org/web/packages/gam/">GAM </a>. 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))

Expand Down Expand Up @@ -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.
4 changes: 3 additions & 1 deletion setup.py
Expand Up @@ -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",
Expand Down
12 changes: 9 additions & 3 deletions src/palantir/utils.py
Expand Up @@ -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
"""

Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion 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"

0 comments on commit 91f301b

Please sign in to comment.