Installation¶
Pegasus works with Python 3 only (Python 3.5 or above).
Linux¶
The installation has been tested on Ubuntu (18.04 and 19.04).
Prerequisites¶
First, install the following dependencies by:
sudo apt install build-essential cmake libxml2-dev zlib1g-dev wget
Next, you can install Pegasus system-wide by PyPI (see Linux Install via PyPI), or within a Miniconda environment (see Linux Install via Miniconda).
To use the Force-directed-layout (FLE) embedding feature, you’ll need Java. You can either install Oracle JDK, or install OpenJDK which is included in Ubuntu official repository:
sudo apt install default-jdk
Install via PyPI¶
First, install Python 3 and pip tool for Python 3:
sudo apt install python3 python3-pip
Now install Pegasus via pip:
pip3 install pegasuspy
There are optional packages that you can install:
mkl: This package improves math routines for science and engineering applications:
pip3 install mkl
fitsne: This package is to calculate t-SNE plots using a faster algorithm FIt-SNE:
sudo apt install libfftw3-dev pip3 install fitsne
leiden: This package provides Leiden clustering algorithm, besides the default Louvain algorithm in Pegasus:
pip3 install leidenalg
Install via Miniconda¶
You can also choose to install pegasus in a dedicated Conda environment without affecting your OS settings.
Use the following commands to install a Miniconda on your system:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh . export CONDA_PATH=/home/foo bash Miniconda3-latest-Linux-x86_64.sh -p $CONDA_PATH/miniconda3 mv Miniconda3-latest-Linux-x86_64.sh $CONDA_PATH/miniconda3 source ~/.bashrc
Feel free to change /home/foo
to your own directory on handling Miniconda.
In addition, remember to type yes
when asked if you wish the installer to initialize Miniconda3 by running conda init.
Create a conda environment for pegasus. This tutorial uses
pegasus
as the environment name, but you are free to choose your own:conda create -n pegasus -y pip
Enter
pegasus
environment by activating:source activate pegasus
(Optional) Install the following dependency if you want mkl to for optimized math routines:
conda install -y -c anaconda numpy
Install pegasus:
pip install pegasuspy
(Optional) You can install the following optional features:
fitsne: Generate t-SNE plot by a faster algorithm FIt-SNE:
sudo apt install libfftw3-dev pip install fitsne
leiden: Leiden clustering algorithm:
pip install leidenalg
macOS¶
Prerequisites¶
First, install Homebrew by following the instruction on its website: https://brew.sh/. Then install the following dependencies:
brew install cmake libxml2 curl libomp
And install macOS command line tools:
xcode-select --install
Next, you can install Pegasus system-wide by PyPI (see macOS Installation via PyPI), or within a Miniconda environment (see macOS Installation via Miniconda).
To use the Force-directed-layout (FLE) embedding feature, you’ll need Java. You can either install Oracle JDK, or install OpenJDK via Homebrew:
brew cask install java
Install via PyPI¶
You need to install Python first:
brew install python3
Starting from macOS Mojave (i.e. 10.14), python-igraph, one of the dependencies of Pegasus, needs to set the following environment variable before installation:
export MACOSX_DEPLOYMENT_TARGET=10.14 pip3 install python-igraph
You should change 10.14
to your macOS version number. For example, 10.15
is the number for Catalina.
Now install Pegasus:
pip3 install pegasuspy
There are optional packages that you can install:
mkl: This package improves math routines for science and engineering applications:
pip3 install mkl
fitsne: This package is to calculate t-SNE plots using a faster algorithm FIt-SNE. First, you need to install its dependency fftw:
brew install fftw
Then install fitsne by:
pip3 install fitsne
leiden: This package provides Leiden clustering algorithm, besides the default Louvain algorithm in Pegasus:
pip3 install leidenalg
Install via Miniconda¶
Use the following commands to install a Miniconda on your system:
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh export CONDA_PATH=/Users/foo bash Miniconda3-latest-MacOSX-x86_64.sh -p $CONDA_PATH/miniconda3 mv Miniconda3-latest-MacOSX-x86_64.sh $CONDA_PATH/miniconda3
Feel free to change /Users/foo
to your own directory on handling Miniconda.
Create a conda environment for pegasus. This tutorial uses
pegasus
as the environment name, but you are free to choose your own:conda create -n pegasus -y pip
Enter
pegasus
environment by activating:conda activate pegasus
(Optional) Install the following dependency if you want mkl to for optimized math routines:
conda install -y -c anaconda numpy
For macOS 10.14 or later: for these macOS versions, you need to set the following environment variable before installing Pegasus:
export MACOSX_DEPLOYMENT_TARGET=10.15
where 10.15
is the version number for macOS Catalina. You should change it to your own OS version. For example, 10.14
is for macOS Mojave.
Install pegasus:
pip install pegasuspy
(Optional) You can install the following optional features:
fitsne: Generate t-SNE plot by a faster algorithm FIt-SNE:
conda install -y -c conda-forge fftw pip install fitsne
leiden: Leiden clustering algorithm:
pip install leidenalg
Development Version¶
To install Pegasus development version directly from its GitHub respository, please do the following steps:
Install prerequisite libraries as mentioned in above sections.
Install Git. See here for how to install Git.
Use git to fetch repository source code, and install from it:
git clone https://github.com/klarman-cell-observatory/pegasus.git cd pegasus pip install -e .
where -e
option of pip
means to install in editing mode, so that your Pegasus installation will be automatically updated upon modifications in source code.