Setup quest
#!/bin/bash
# Daniel E. Cook
# Run with:
# curl https://gist.githubusercontent.com/danielecook/aed4a6fd53195fca7a3297f054d613c7/raw/quest_setup.sh | bash
# Reset
set -e
rm -rf ~/.linuxbrew
rm -rf ~/.cache
rm -rf ~/R
# Download linuxbrew
git clone https://github.com/Linuxbrew/brew.git ~/.linuxbrew
# Enable brew
PATH="$HOME/.linuxbrew/bin:$PATH"
# Initial run
brew tap homebrew/science
brew install samtools bcftools
brew install curl
brew install git
brew install pyenv
brew install autojump
brew install nextflow
brew install pigz
brew install igvtools
brew install vcfanno
brew install snpeff
brew install fastq-tools
brew install muscle
brew install pyenv-virtualenv
brew install tree
brew install picard-tools
brew install datamash
# Get sambamba
wget https://github.com/biod/sambamba/releases/download/v0.6.7/sambamba_v0.6.7_linux.tar.bz2
tar -vxjf sambamba_v0.6.7_linux.tar.bz2
chmod +x sambamba
mv sambamba ~/.linuxbrew/bin
# Update nextflow
nextflow self-update
# Setup SnpEff annotation database
#curl https://raw.githubusercontent.com/AndersenLab/wi-nf/16dac725c9615af5721088eee4ae415b4bd6f8cb/bin/setup_annotation_db.sh > setup_annotation_db.sh
#bash setup_annotation_db.sh WS261
# Replace bash profile
curl https://gist.githubusercontent.com/danielecook/aed4a6fd53195fca7a3297f054d613c7/raw/bash_profile.sh > ~/.bash_profile
source ~/.bash_profile
# Install R packages
mkdir -p ~/R/x86_64-pc-linux-gnu-library/3.3
echo "r <- getOption('repos'); r['CRAN'] <- 'http://cran.us.r-project.org'; options(repos = r);" > ~/.Rprofile \
&& Rscript -e 'install.packages(c("tidyverse", "data.table", "plyr", "cowplot", "ggmap", "ape", "devtools", "knitr", "rmarkdown"))' \
&& Rscript -e 'source("http://bioconductor.org/biocLite.R"); biocLite(c("phyloseq"))' \
&& Rscript -e 'devtools::install_github("andersenlab/cegwas")'
# Install a previous version of igraph; Newer versions cannot be installed on Quest apparently.
Rscript -e "require(devtools); install_version('igraph', version='1.0.1', repos='https://cran.rstudio.org/')"
# Install google cloud sdk
curl https://sdk.cloud.google.com > install.sh
bash install.sh --disable-prompts --install-dir=~/google-cloud-sdk
rm install.sh
# Setup Python Versions
pyenv install 2.7.11
pyenv install 3.6.0
pyenv global 2.7.11
pip install --upgrade pip
pip install --user setuptools
pip install -U numpy cython scipy
pip install -U gsutil gcloud vcf-kit
pip install -U https://github.com/AndersenLab/bam-toolbox/archive/0.0.3.tar.gz
# Setup Nextflow global configuration
mkdir -p ~/.nextflow
echo '''process {
module= "R/3.3.1"
executor = "pbs"
queue = "genomicsguest"
clusterOptions = "-A b1042 -l walltime=24:00:00 -e errlog.txt"
}
workDir = "/projects/b1042/AndersenLab/work"
tmpDir = "/projects/b1042/AndersenLab/tmp"
''' > ~/.nextflow/config
# VERSION 1
export HOMEBREW_EDITOR=nano
export PS1='\[\e[0;35m\][\h::\w] 😱 \[\e[m\] '
export PATH="$HOME/.linuxbrew/bin:~/google-cloud-sdk/bin:$PATH"
export MANPATH="$(brew --prefix)/share/man:$MANPATH"
export INFOPATH="$(brew --prefix)/share/info:$INFOPATH"
# Load modules
# module load bamtools/2.4.1
# module load bcftools/1.4-6 - messes with qstat
# module load samtools/1.6 - Don't load quest versions they are f'ed
module load bedtools/2.25.0
module load blast/2.4.0
module load bwa/0.7.15
module load parallel/20160922
module load picard/2.6.0
module load R/3.3.1
module load telseq/2.4.1
module unload bamtools/2.4.1
module load gcc/5.1.0
module load fastqc/0.11.5
# go work - Go to the working directoy. Copy the hash that nextflow outputs and this function
# will take you to that directory:
# gw 3f/6a21a5 --> /projects/b1042/AndersenLab/work/3f/6a21a5116106f5a4e993b1e9559d66/
gw() {
cd /projects/b1042/AndersenLab/work/$1*
}
rm_gw() {
rm -rf /projects/b1042/AndersenLab/work/$1*
}
# pyenv
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi
# Autojump
[ -f /home/dec211/.linuxbrew/etc/profile.d/autojump.sh ] && . /home/dec211/.linuxbrew/etc/profile.d/autojump.sh