Created
May 30, 2016 20:43
-
-
Save ckandoth/a7bb6b79964926ed4263b0c869d97a96 to your computer and use it in GitHub Desktop.
Set up Ensembl v84 REST API on CentOS 6.7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# GOAL: Set up a local instance of Ensembl's database and REST API | |
# If I don't already have sudo rights, then first login as root with `su`, and type `visudo` to | |
# edit `/etc/sudoers`, and uncomment this line in that file: | |
# %wheel ALL=(ALL) ALL | |
# This allows any user in group `wheel` to use `sudo`. Add myself to the `wheel` group using: | |
# usermod -a -G wheel kandoth | |
# Also set `SELINUX=disabled` in `/etc/selinux/config`, because its a PITFA. | |
# Run `reboot` and login again, to set changes above, before proceeding with commands below. | |
# Update all apps: | |
sudo yum update -y | |
# Install some bare essentials: | |
sudo yum install -y epel-release | |
sudo yum groupinstall -y 'Development Tools' | |
sudo yum install -y cmake vim R perl-devel python-devel zlib-devel bzip2-devel expat-devel libxml2-devel openssl-devel mysql-devel | |
# Make a folder where we can set up perl and cd into it: | |
export PERLBASE=/opt/common/CentOS_6-dev/perl | |
mkdir -p $PERLBASE | |
cd $PERLBASE | |
# Download and untar latest source tarball into subfolder src: | |
wget -P src http://www.cpan.org/src/5.0/perl-5.24.0.tar.gz | |
tar -zxf src/perl-5.24.0.tar.gz | |
# Configure and build: | |
cd perl-5.24.0 | |
./Configure -des -Dprefix=/opt/common/CentOS_6-dev/perl/perl-5.24.0 -Dotherlibdirs=/opt/common/CentOS_6-dev/perl/perl-5.24.0/lib/perl5 | |
make && make install | |
cd .. | |
# Override the system Perl with this Perl: | |
export PATH=$PERLBASE/perl-5.24.0/bin:$PATH | |
# Install dependencies for Ensembl and other tools we use: | |
curl -L http://cpanmin.us | /opt/common/CentOS_6-dev/perl/perl-5.24.0/bin/perl - --notest -l /opt/common/CentOS_6-dev/perl/perl-5.24.0 App::cpanminus JSON::Parse XML::Parser XML::Simple Encode DBD::mysql LWP LWP::Protocol::https Archive::Extract Archive::Tar Archive::Zip CGI DBI Time::HiRes Statistics::R Statistics::Lite Tie::Autotie Tie::IxHash Log::Log4perl FindBin::Real Getopt::Long Catalyst::Runtime Catalyst::Devel List::Util Test::XML::Simple Test::XPath IO::String Bio::Perl | |
# Force delete the older List::Util so that the one installed above by cpanm is used instead: | |
rm -rf /opt/common/CentOS_6-dev/perl/perl-5.24.0/lib/{,5.24.0/x86_64-linux/}{List,auto/List} | |
# Download Ensembl's git tools, and add it to PATH: | |
cd src | |
git clone https://github.com/Ensembl/ensembl-git-tools.git | |
export PATH=$PERLBASE/src/ensembl-git-tools/bin:$PATH | |
# Install all the Ensembl Perl APIs using the git ensembl command: | |
git ensembl --clone api | |
# Clone and build tabix, then install the Perl module: | |
git clone https://github.com/samtools/tabix.git | |
(cd tabix && make) | |
(cd tabix/perl && perl Makefile.PL && make && make install) | |
# Add tabix to PATH and have LD_LIBRARY_PATH point to its libs: | |
export PATH=$PERLBASE/src/tabix:$PATH | |
export LD_LIBRARY_PATH=$PERLBASE/src/tabix | |
# Set up environment as described in the basic installation instructions. | |
PERL5LIB=$PERLBASE/src/ensembl/modules | |
PERL5LIB=${PERL5LIB}:$PERLBASE/src/ensembl-compara/modules | |
PERL5LIB=${PERL5LIB}:$PERLBASE/src/ensembl-funcgen/modules | |
PERL5LIB=${PERL5LIB}:$PERLBASE/src/ensembl-io/modules | |
PERL5LIB=${PERL5LIB}:$PERLBASE/src/ensembl-variation/modules | |
export PERL5LIB | |
# Install Bio::DB::HTS::Faidx which needs htslib libraries: | |
git clone https://github.com/samtools/htslib.git | |
(cd htslib && make) | |
export HTSLIB_DIR=$PERLBASE/src/htslib | |
cpanm --notest -l /opt/common/CentOS_6-dev/perl/perl-5.24.0 Bio::DB::HTS::Faidx | |
# Clone and install ensembl-rest: | |
git clone https://github.com/Ensembl/ensembl-rest.git | |
cd ensembl-rest | |
cpanm --installdeps --notest . | |
perl Makefile.PL | |
cd .. | |
# Make sure we can ping the ensembl server: | |
perl ensembl/misc-scripts/ping_ensembl.pl | |
# Make a copy of the server config, and point it to the useastdb: | |
cp ensembl-rest/ensembl_rest.conf.default ensembl-rest/ensembl_rest.conf | |
perl -i -pe 's/ensembldb/useastdb/' ensembl-rest/ensembl_rest.conf | |
# Point the server to the config, and startup: | |
export ENSEMBL_REST_CONFIG=$PERLBASE/src/ensembl-rest/ensembl_rest.conf | |
nohup perl ensembl-rest/script/ensembl_rest_server.pl > ensembl_rest_server.log 2>&1 & | |
# Test that we can ping the REST service: | |
curl -L http://172.21.75.56:3000/info/ping?content-type=application/json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment