Skip to content

Instantly share code, notes, and snippets.

@stephenturner
Last active August 29, 2015 14:04
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 stephenturner/5c849b63e382964f6046 to your computer and use it in GitHub Desktop.
Save stephenturner/5c849b63e382964f6046 to your computer and use it in GitHub Desktop.
Installing poretools without root

Installing poretools without root permission

I needed to install poretools, but the setup instructions assume you have sudo priviliges. After combing through 879868070879 posts on stack overflow, the R-help mailing list, serverfault, etc., I finally arrived at solution using the nuclear option. There may be a better way, but this worked for me.

R

First, nuke and rebuild your own R from source. First, remove your existing installation (as usual, rm -rf with caution...)

rm -rf ~/R

Download the latest R source, configure with --enable-R-shlib to build R as a shared library. Using --prefix=<path>, give it a path you have +w access to install to.

On my cluster, trial and error proved that running make twice would work after make failed the first time.

mkdir ~/R
cd R
PREFIX=$(pwd)

wget http://cran.rstudio.com/src/base/R-3/R-3.1.1.tar.gz
tar -zxvf R-3.1.1.tar.gz
cd R-3.1.1

./configure --prefix=$PREFIX --enable-R-shlib
make
make
make install

Install some packages:

options("repos" = c(CRAN = "http://cran.rstudio.com/"))
install.packages("codetools")
install.packages("MASS")
install.packages("ggplot2")

Make sure you're using this R:

echo "export PATH=$HOME/R/bin:$PATH" >> ~/.bashrc

Python

Nuke your old anaconda python:

rm -rf ~/anaconda

Download the latest anaconda python installer from http://continuum.io/downloads. The installer is a big shell script run it with bash (regardless of whether you use bash, zsh, etc.). Agree to the license, and let it append to your PATH by appending to your ~/.bashrc.

bash Anaconda-2.0.1-Linux-x86_64.sh

Apparently the readline library distributed with Anaconda is broken on Linux. Remove and re-install with pip.

conda remove readline
pip install readline

Now, you need rpy2 to provide a Python interface to the R language. Don't just go pip installing rpy2 - it won't work. You'll need to download the rpy2 source, and build it telling it where your R lives, like so:

wget --no-check-certificate https://pypi.python.org/packages/source/r/rpy2/rpy2-2.4.2.tar.gz
tar -zxvf rpy2-2.4.2.tar.gz
cd rpy2-2.4.2
export LDFLAGS="-Wl,-rpath,export LDFLAGS="-Wl,-rpath,${HOME}/R/lib64/R/lib"
python setup.py build --r-home ${HOME}/R/ install

Just for good measure, log out and log back into your shell.

Install & use poretools

git clone https://github.com/arq5x/poretools
cd poretools
python setup.py install

On AWS

Or save yourself the headache and get running on AWS in less than 10 seconds. I was able to plow through some basic analyses on several runs in a few minutes on a free-tier eligible t2.micro instance.

  1. Go to your EC2 concole console.aws.amazon.com/ec2 and click "Launch Instance"
  2. Search community AMIs for "poretools" or by the ID: ami-4c0ec424.
  3. Select and launch the AMI on a t2.micro instance.

poretools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment