Install LIGER with R
Yichen Wang
2024-03-20
Source:vignettes/articles/installation.Rmd
installation.Rmd
Before setting up the “rliger” package, users should have R version 3.6.0 or higher.
LIGER is available on CRAN
To install the latest stable release, please run the following command in R console:
install.packages("rliger")
Besides, we now move the core implementation of iNMF related algorithms to a separate package RcppPlanc, with decent performance improvement. It must be installed for performing integration analysis. We currently host it on R-universe as we are actively submitting it to CRAN. Please run the following command in R console to install it.
install.packages("RcppPlanc", repos = "https://welch-lab.r-universe.dev")
Building from source
The developmental versions as well as source version of the previous versions are accessible from GitHub. To install the latest version from GitHub, please run the following command in R console:
if (!requireNamespace("devtools")) install.packages("devtools")
devtools::install_github("welch-lab/liger")
If you still need to work with the previous version (1.0.1):
devtools::install_github("welch-lab/liger", ref = "v1.0.1")
If you encounter issues when building from source, please see below sections for details about some dependencies.
Please note that version 2.0.0 is massively updated compared
to prior versions, and functions are not directly compatible with liger
objects created with the old versions which users might possess. Please
use readLiger()
to load old RDS files or
convertOldLiger()
to convert a loaded object into the
up-to-date structure. You might need to be careful when overwriting
existing analysis because we don’t provide methods to convert new the
structure backwards.
Compiler setup
Windows users will need to install Rtools which can be downloaded from CRAN. After downloading it, open the file and follow the prompt to install.
MacOS users will need Clang and gfortran, which can also be found on CRAN Mac Tools.
Installing HDF5 Library
HDF5 library is required for interacting with H5 files. It can be installed via the following commands.
System | Command |
---|---|
macOS (using Homebrew or Conda) |
brew install hdf5 or
conda install -c anaconda hdf5
|
Debian-based systems (including Ubuntu) | sudo apt-get install libhdf5-dev |
Systems supporting yum and RPMs | sudo yum install hdf5-devel |
Windows | Go to HDF5 website and download the proper installer |
Installing RcppPlanc
RcppPlanc is an extension R package built basing on Planc. We implemented highly optimized iNMF algorithm and its variants here for the new version upgrade. To install it from source:
devtools::install_github("welch-lab/RcppPlanc")
Please refer to RcppPlanc GitHub repository for detail and more support.
Installing FIt-SNE
For dimensionality reduction, we have options of UMAP and t-SNE. For UMAP, we depend on uwot which is readily scalable with large datasets. For t-SNE, we by default use Rtsne, which is not scalable for large datasets. We allow using another implementation of t-SNE, namingly FIt-SNE, for efficient computation. FIt-SNE is not distributed with the package or CRAN, thus users need to install it following steps below.
1. Install FFTW library.
Download FFTW from here. For UNIX like users, run the following command in terminal. The following commands in terminal show how to locally install the library of version 3.3.10 as this tutorial is written down. You can check their official website out if an update is available. You can simply replace the version number in the URL and the file name to update the installation.
cd FItSNE_local
curl ftp://ftp.fftw.org/pub/fftw/fftw-3.3.10.tar.gz -o fftw-3.3.10.tar.gz
tar -xvzf fftw-3.3.10.tar.gz
cd fftw-3.3.10
./configure --prefix=`pwd`
make
make install prefix=`pwd`
Here the FFTW library is installed in the directory where the source
code is located. You can change the part pwd
to any other
path (no quotes needed) or even remove the --prefix
token
to globally install the library if you do have the root access. A folder
lib
with files named by libfftw3*
must be
presented at current location.
2. Install FIt-SNE
We next download FIt-SNE from GitHub and compile the part we need for the R wrapper functionality.
cd ../ # back to FItSNE_local
git clone https://github.com/KlugerLab/FIt-SNE.git
cd FIt-SNE
g++ -std=c++11 -O3 src/sptree.cpp src/tsne.cpp src/nbodyfft.cpp -o bin/fast_tsne -pthread -L../fftw-3.3.10/lib -lfftw3 -lm
pwd
A folder bin
with a file named fast_tsne
must be presented at current location. The command pwd
shows the location to the binary and you will need the printed path for
the next step.
3. Run t-SNE with Flt-SNE
Now, we’ve had the binary compiled, and command pwd
shows the location to the binary. Then back to an R LIGER analysis, the
following command can be used to invoke the binary. Just simply pass a
string containing what pwd
shows to the argument
fitsnePath
in runTSNE()
function and switch
method = "fftRtsne"
.
ligerObj <- runTSNE(ligerObj, method = "fftRtsne", fitsnePath = "path/you/need/FItSNE_local/FIt-SNE")