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.
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
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 install
ing 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.
git clone https://github.com/arq5x/poretools
cd poretools
python setup.py install
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.
- Go to your EC2 concole console.aws.amazon.com/ec2 and click "Launch Instance"
- Search community AMIs for "poretools" or by the ID: ami-4c0ec424.
- Select and launch the AMI on a t2.micro instance.