Please make sure to setup an R Personal Library on O2 to install packages locally.
Here you can find valuable information on how to install R packages requiring some external dependencies.
R package - igraph
# Load Modules module purge module load gcc/9.2.0 R/4.3.1 glpk/5.0 # Create ~/.R/Makevars mkdir ~/.R echo "CFLAGS+=-I/n/app/glpk/5.0-gcc-9.2.0/include" >> ~/.R/Makevars echo "CPPFLAGS+=-I/n/app/glpk/5.0-gcc-9.2.0/include" >> ~/.R/Makevars echo "LDFLAGS+=-L/n/app/glpk/5.0-gcc-9.2.0/lib" >> ~/.R/Makevars echo "CPATH+=/n/app/glpk/5.0-gcc-9.2.0/include" >> ~/.R/Makevars # Start R R # Install package install.packages('igraph')
R package - nloptr
You must use an R version compiled against GCC v9.2.0 and load the CMake module. For example:
# Load modules module purge module load gcc/9.2.0 R/4.2.1 cmake/3.22.2 # Start R R # Install package install.package('nloptr')
R package - Devtools
Load the git2 module if using an older R version (e.g., 4.0.1):
# Load modules module purge module load gcc/6.2.0 R/4.0.1 git2/1.1.0 # Start R R # Install pkg install.packages('devtools')
If using the R>=4.2.1 module, then it is not required to load the git2 module.
R package - Seurat
# Load Modules module purge module load gcc/9.2.0 R/4.3.1 geos/3.10.2 # Start R R # Install pkg install.packages('Seurat')
R packages - SF and Monocle3
# Load Modules module purge module load gcc/9.2.0 module load cmake/3.22.2 module load R/4.3.1 module load gdal/3.1.4 module load udunits/2.2.28 module load geos/3.10.2 # Export udunits variables export UDUNITS2_INCLUDE=/n/app/udunits/2.2.28-gcc-9.2.0/include export UDUNITS2_LIBS=/n/app/udunits/2.2.28-gcc-9.2.0/lib # Start R R # Install sf install.packages('sf', configure.args = "--with-geos-config=/n/app/geos/3.10.2-gcc-9.2.0/bin/geos-config") # Install Bioconductor install.packages("BiocManager") # Install Bioconductor pkgs BiocManager::install(c('BiocGenerics', 'DelayedArray', 'DelayedMatrixStats', 'limma', 'S4Vectors', 'SingleCellExperiment', 'SummarizedExperiment', 'batchelor', 'Matrix.utils')) # Install monocle3 devtools::install_github('cole-trapnell-lab/leidenbase') devtools::install_github('cole-trapnell-lab/monocle3')
R package - ACTIONet
This package is installed within a conda environment along with a local installation of R. Unfortunately, R is needed within a conda environment to avoid clash between the suitesparse and blas libraries.
Note - Installation takes around 3 hours
# Load modules module purge module load conda2/4.2.13 # $PWD install the renv environment in the current directory conda create --prefix $PWD/renv -y source activate $PWD/renv # Add channels conda config --add channels bioconda conda config --add channels conda-forge # Install suitesparse and other depedencies conda install -c conda-forge suitesparse -y conda install -c conda-forge "r-essentials>=4.1" -y conda install -c conda-forge "r-base>=4.1.2" -y conda install -c anaconda cmake -y conda install -c conda-forge r-hdf5r -y # Initiate R R # Install R pkg devtools install.packages("devtools") # Install ACTIONet # NOTE: When prompted to update the R pkgs, you must select [3] None! devtools::install_github("shmohammadi86/ACTIONet", ref = "R-devel")
R package - InferCNV
## Install JAGS # Setup Working Directory cd $HOME mkdir build_jags && cd build_jags # Download & Decompress JAGS wget -O JAGS-4.3.1.tgz https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Source/JAGS-4.3.1.tar.gz/download tar xzvf JAGS-4.3.1.tgz && cd JAGS-4.3.1 # Load modules module load gcc/9.2.0 R/4.2.1 # Export Variables export PKG_CONFIG_PATH=/n/app/openblas/0.3.19-gcc-9.2.0/lib/pkgconfig/:$PKG_CONFIG_PATH export LDFLAGS="-L/n/app/openblas/0.3.19-gcc-9.2.0/lib/" # Install JAGS mkdir $HOME/JAGS ./configure --prefix=$HOME/JAGS make -j 4 make install # Clean up; build_jags directory is no longer needed rm -r $HOME/build_jags # Add JAGS path to variables export LD_LIBRARY_PATH=$HOME/JAGS/lib:$LD_LIBRARY_PATH export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HOME/JAGS/lib/pkgconfig # Launch R R # Install R package install.packages("BiocManager") BiocManager::install("infercnv")
R package - Rmpi
The package must be installed using an sbatch job. For example:
1. Create an sbatch script with the following content
$ cat install-rmpi.slurm #!/bin/bash #SBATCH -p short #SBATCH -t 0-00:10 #SBATCH -c 1 #SBATCH --mem=1G # load modules module load gcc/9.2.0 R/4.2.1 openmpi/4.1.1 # install R package R -e "install.packages('Rmpi',repos='http://cran.us.r-project.org', configure.args = '--with-mpi=/n/app/openmpi/4.1.1')"
2. Submit script via the sbatch command
$ sbatch install-rmpi.slurm