This is a simple install script for building a standalone version of Genoscores, from source, in a user home directory.
#!/bin/bash
#
#######################################################################################################
#
# Repeatable installation harness for Genoscores, using the dependency details
# documented here: https://genoscores.cphs.mvm.ed.ac.uk/quickstart#Download-and-install-the-package
#
# You MUST supply the genoscores_api.tar.gz file YOURSELF. It is not available to download publicly.
#
# Original author: John.Snowdon@Newcastle.ac.uk
# August 2024
#
#######################################################################################################
# These are the only variables that need to be set per-user:
# This is where genoscore and all the supporting tools (plink, bedtools, etc) will live
MYPATH=$HOME/genoscore
# The path to the genoscores source file, which you must supply yourself...
GENOSCORES_TARBALL=$HOME/genoscores_0.93.0.9000.api.tar.gz
# Set to 1 to enable, or 0 to skip a section
# The first time you run the installer you will want to run all sections...
BUILD_BEDTOOLS=1
BUILD_LIFTOVER=1
BUILD_PLINK=1
BUILD_RLIBS=1
BUILD_GENOSCORES=1
##############################################################################
# NOTHING IS USER-EDITABLE BELOW THIS LINE
##############################################################################
################################################
#
# Set up installation tree
#
mkdir -p $MYPATH
mkdir -p $MYPATH/bin
mkdir -p $MYPATH/zip
mkdir -p $MYPATH/src
if [ -d $MYPATH ]
then
cd $MYPATH
else
echo "ERROR! Unable to create $MYPATH"
exit 1
fi
echo "Standalone Genoscores installer for Rocket HPC"
echo "=============================================="
echo ""
echo "NOTE!!! ALL TOOLS WILL BE INSTALLED UNDER $MYPATH/bin"
echo ""
echo "If you want to change this location, change the variable MYPATH"
echo "at the top of this script."
echo ""
echo "The path you set should be added to your existing PATH environment variable."
echo "For example, at the end of your .bashrc file add:"
echo "PATH="'$PATH'":$MYPATH/bin"
echo "export PATH"
echo ""
echo "After this install has completed, you must then load the R module:"
echo "module load MariaDB/10.6.4-GCC-11.2.0"
echo "module load R/4.3.1-foss-2022b"
echo ""
echo "... and in an interactive R session, register genoscores as follows:"
echo 'library("genoscores")'
echo "initialise.genoscores()"
echo ""
echo "For further documentation on genoscores, see: https://genoscores.cphs.mvm.ed.ac.uk/quickstart"
echo ""
echo "[Press return to continue]"
echo ""
read
#################################################
#
# Download and build bedtools
#
if [ "$BUILD_BEDTOOLS" = "1" ]
then
echo ""
echo ""
echo "################### BEDTOOLS ########################"
echo ""
cd zip
wget -nc https://github.com/arq5x/bedtools2/releases/download/v2.30.0/bedtools-2.30.0.tar.gz
cd ..
cd src
tar xzf ../zip/bedtools-2.30.0.tar.gz
if [ -d bedtools2 ]
then
cd bedtools2
make -j2 DESTDIR=$MYPATH/bin install
cd ..
else
echo ""
echo "ERROR! Unable to find bedtools source tree"
exit 1
fi
cd ..
cd bin
if [ -d usr ]
then
cp -v usr/local/bin/* .
rm -rf usr
else
echo ""
echo "ERROR! Unable to find bedtools install tree"
exit 1
fi
cd ..
fi
#################################################
#
# Install liftover
#
if [ "$BUILD_LIFTOVER" = "1" ]
then
echo ""
echo ""
echo "################## LIFTOVER ##########################"
echo ""
cd bin
wget -nc http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/liftOver
if [ -s liftOver ]
then
chmod -v u+x liftOver
else
echo ""
echo "ERROR! Unable to find downloaded liftover binary!"
exit 1
fi
cd ..
cd zip
wget -nc http://hgdownload.cse.ucsc.edu/goldenPath/hg18/liftOver/hg18ToHg19.over.chain.gz
if [ -s hg18ToHg19.over.chain.gz ]
then
gzip -f -d hg18ToHg19.over.chain.gz
else
echo ""
echo "ERROR! Unable to find downloaded liftover chain file!"
exit 1
fi
if [ -s hg18ToHg19.over.chain ]
then
cp -v hg18ToHg19.over.chain ../bin
fi
cd ..
fi
###################################################
#
# Install plink
#
if [ "$BUILD_PLINK" = "1" ]
then
echo ""
echo ""
echo "################## PLINK #############################"
echo ""
cd zip
wget -nc https://zzz.bwh.harvard.edu/plink/dist/plink-1.07-x86_64.zip
cd ..
if [ -s zip/plink-1.07-x86_64.zip ]
then
cd bin
unzip ../zip/plink-1.07-x86_64.zip
cp -v plink-1.07-x86_64/plink plink-1.07-x86_64/test.map plink-1.07-x86_64/test.ped .
rm -rf plink-1.07-x86_64
cd ..
else
echo ""
echo "ERROR! Unable to find downloaded zip of plink!"
exit 1
fi
fi
##############################################
#
# Install R libraries
#
if [ "$BUILD_RLIBS" = "1" ]
then
echo ""
echo ""
echo "################# R LIBRARIES #########################"
echo ""
module purge
# MariaDB is needed for the R::RMariaDB library to build
module load MariaDB/10.6.4-GCC-11.2.0
module load R/4.3.1-foss-2022b
Rscript -e 'install.packages(c("RMariaDB", "Rcpp", "bigmemory", "corrplot", "data.table","doParallel", "foreach", "ggplot2", "gtools", "httr", "jsonlite", "RColorBrewer", "yaml", "BH", "RcppEigen"), repos = "http://cran.r-project.org")'
# The current version of 'Matrix' needs R >= 4.4 ... which we don't have on Rocket
# This is the last version of 'Matrix' which will compile for R <= 4.3 ...
Rscript -e 'install.packages("https://cran.r-project.org/src/contrib/Archive/Matrix/Matrix_1.6-5.tar.gz", repos=NULL, type="source")'
fi
###############################################
#
# Install genoscores package
#
if [ "$BUILD_GENOSCORES" = "1" ]
then
echo ""
echo ""
echo "################# GENOSCORES ###########################"
echo ""
if [ -s $GENOSCORES_TARBALL ]
then
# Load the necessary software modules
module purge
module load MariaDB/10.6.4-GCC-11.2.0
module load R/4.3.1-foss-2022b
# Install the tarball
R CMD INSTALL $GENOSCORES_TARBALL
# Test we can import the library
Rscript -e 'library("genoscores")'
else
echo "ERROR! Could not find: $GENOSCORES_TARBALL"
echo ""
echo "Please make sure that you have set the correct path and filename of"
echo "the Genoscores install tarball in the GENOSCORES_TARBALL variable at"
echo "the top of this script."
exit 1
fi
fi