Skip to content

Instantly share code, notes, and snippets.

@lh3
Created October 7, 2016 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lh3/2485831fb54008211035d4a769b8732e to your computer and use it in GitHub Desktop.
Save lh3/2485831fb54008211035d4a769b8732e to your computer and use it in GitHub Desktop.
# OUTSIDE VM: launch an instance
gcloud compute instances create lh3test --machine-type n1-standard-1 --image-project ubuntu-os-cloud --image-family ubuntu-1604-lts
#
# INSIDE VM!!!
#
# install dependencies
sudo apt-get update
sudo apt-get install libboost-all-dev cmake libstdc++6 clang-3.8 cmake git-all python3 zlib1g-dev
# install htslib-1.3.1
wget -O- https://github.com/samtools/htslib/releases/download/1.3.1/htslib-1.3.1.tar.bz2 | tar -jxf -
cd htslib-1.3.1
./configure # octopus not working if --prefix=elsewhere is used
sudo make install
# compile octopus-0.1
wget -O- https://github.com/luntergroup/octopus/archive/v0.1-alpha.tar.gz | tar -zxf -
cd octopus-0.1-alpha/build
CC=clang-3.8 CXX=clang++-3.8 cmake .. # octopus recommended clang
CPATH=/usr/local/include/htslib make # to prevent compiling errors
# install octopus
mkdir -p $HOME/octopus-0.1_x64-linux/bin $HOME/octopus-0.1_x64-linux/lib
cp -a src/octopus $HOME/octopus-0.1_x64-linux/bin/ori-octopus
cd $HOME/octopus-0.1_x64-linux
ldd bin/ori-octopus|perl -ne 'print "$1\n" if /=> (\/\S+)/'|xargs -i echo cp {} lib|sh # copy dynamic libraries
cp /usr/local/lib/libhts.so.1 lib # somehow this is left out
cp /lib/x86_64-linux-gnu/ld-2.23.so bin/ld.so # the location of ld.so is distro dependent
# write the octopus launcher
echo '#!/bin/sh' > bin/octopus
echo 'root=`dirname $0`' >> bin/octopus
echo '$root/ld.so --library-path $root/../lib $root/ori-octopus $*' >> bin/octopus
chmod 755 bin/octopus
# package
cd .. && tar -jcf octopus-0.1_x64-linux.tar.bz2 octopus-0.1_x64-linux
# exit the VM
exit
# OUTSIDE VM: delete the instance
gcloud compute copy-files lh3test:octopus-0.1_x64-linux.tar.bz2 .
gcloud compute instances delete lh3test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment