SWAN Installation Charlie Xia 10/2/15 T UTORIAL AND T IPS FOR L INUX AND OSX #Note: copy/paste code from this slide maybe broken depending on PowerPoint. Copy friendly code at be found at README.rst:
2 2 Contents SWAN Requirements SWAN Requirements Overview [p3] Know your GCC compiler [p4] Know your R Installation [p5] Know CRAN and Bioconductor [p6] Ubuntu Setup C++ [p7] Setup R and devtools [p8] CentOS Setup C++ [p9] Setup R and devtools [p10] OSX Setup C++ [p11] Setup R and devtools [p12] SWAN Install and Test Install R dependencies [p13] Install SWAN [p14] Test single sample analysis [p15] Test case-control analysis [p16] Download and test using Virtual Machines [p17] Extra SWAN Reference & Resources [p19] Left flowchart: How to use this doc. Page number is in bracket [ ]
3 SWAN Requirements Overview (Tested Platforms) RequirementsTested Versions OS (OSX or Linux)Ubuntu ; CentOS 7; OS X (Yosemite) GCC (>4.3)4.8.4(apt-get); 4.8.3(yum); 4.7.4(macports); 4.7.4(homebrew) R (>3.1)3.2.2; 3.1.1; R devtools (any)1.9.1 R_LIBS_USER (if no sudoer) Only need to set R_LIBS_USER in your shell profile only if R's default is not working for you AND you have no permission to write to the system R lib AND CRAN Packages (all current versions) RcppArmadillo (source), Rcpp (source); BH, data.table, devtools, digest, hash, methods, optparse, parallel, plyr, robustbase, sets, stringr, zoo Bioconductor Packages (all current versions) Biobase, Biostrings, BSgenome, GenomeInfoDb, GenomicRanges, IRanges, Rsamtools Samtools (>0.1.19)0.1.19; 1.2 Note: SWAN may still be installable even if some of these versions are not met. Please consult the Wiki, FAQ and/or contact authors for help. You can also use SWAN with pre-installed virtual machines without installation.
4 Know Your C++ Environment $ gcc --version Determine your GCC version Tip: using GCC GCC is available on Ubuntu through apt-get and CentOS by yum. GCC is available on Mac OSX through either macports and homebrew. We have installed SWAN successfully with either macports or homebrew shipped GCC. Please see other slides for details. User should only use either macports or homebrew. You CANNOT mix use them. When use gcc on OS X systems, the best practice to switch R's compiler is set CC=gcc and CXX=g++ in the ~/.R/Makevars user configuration file A common error related to compiler is 'symbol not found' in linking. One most often cause of this is the libstdc++ or other library files corresponding to the compiler are not found. To fix, add paths containing proper libraries to the user's or system's $LD_LIBRARY_PATH.
5 Know Your R $ R –version Know R version R> Sys.getenv() #check R_LIBS_USER which is the default place for SWAN install Know R environmental variables NOTE: $R_LIBS_USER/swan/bin is default by SWAN to put binaries/scripts. R will generate a default R_LIBS_USER when you first try to install R packages without root permission. User has to know the path, however override it is NOT recommended, unless you know how. The path has to be consistent all the time from installation. or otherwise R packages installed can't be found by SWAN. You can always move the binaries/scripts other places AFTER installation and correspondingly update $SWAN_BIN and include it in your $PATH. Tip: $R_LIBS_USER
6 Know CRAN and Bioconductor R> local({r <- getOption("repos"); r["CRAN"] <- " options(repos=r)}) R> install.packages("package") Know Howto Install CRAN Packages Tip: Online Documents for R install.packages CRAN is the main package archive for the R community. Most R dependencies are here! Know Howto Install Bioconductor Packages Tip: Online Documents for R BiocLite Bioconductor is the main package archive for biologist R users. Most bio-related R dependencies are here! R> source(" R> biocLite("package")
7 Ubuntu – Setup C++ $ sudo apt-get install gcc-4.8 #other versions similar Install GCC Tip: Online tutorials install GCC on Ubuntu Ubuntu 14+ now ships with GCC 4.8. To upgrade GCC from earlier Ubuntu distros, see tutorials like this one:
8 Ubuntu - Setup R and devtools $ sudo apt-get install r-base-dev $ sudo apt-get -y build-dep libcurl4-gnutls-dev $ sudo apt-get -y install libcurl4-gnutls-dev $ sudo apt-get -y install libxml2-dev R> install.packages(“devtools”,dependencies=T) Install R and devtools on Ubuntu Tip: Online tutorials install R 3.2 on Ubuntu To use the latest R 3.2 versions you need to add some non official apt-get resource to the /etc/apt/sources.list. The tutorial #1 is very good and updated. You can use tutorial #2 and #3 as references needed, as they are with an older R version on-ubuntu/ r-on-ubuntu-14-04
9 CentOS – Setup C++ $ sudo yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c # other versions similar Install GCC Tip: Online tutorials install GCC on CentOS CentOS 7 ships with GCC 4.8. To upgrade GCC from earlier Cent OS distros, see tutorials like this one: x-on-centos
10 CentOS - Setup R and devtools $ sudo yum -y install epel-release $ sudo yum -y install R-core-devel $ sudo yum -y install libcurl-devel $ sudo yum -y install libxml2-devel $ sudo yum -y install openssl-devel R> install.packages(“devtools”,dependencies=T) Install R and devtools on CentOS Tip: Online tutorials install R 3.2 on CentOS To use the latest R 3.2 versions you need to use yum to install from the epel-release. yum is standard with CentOS 7. For older CentOS distros please find tutorials online for install yum and epel-release. Also has instructions for installation of its individual packages. and-additional-repositories-on-centos-and-red-hat 1.el7.x86_64.rpm.html
11 OSX – Setup C++ $ sudo port install gcc47 # if using macports $ brew install gcc-4.8 # if using homebrew #other gcc versions similar Install GCC Tip: switching C/C++ compilers: $ sudo port select gcc mp-gcc47 # selecting gcc & g for macports $ ln -s /usr/local/gcc-4.7 /usr/local/gcc # selecting gcc 4.7 for homebrew $ ln -s /usr/local/g++4.7 /usr/local/g++ # selecting g for homebrew $ echo -e "CC=gcc\nCXX=g++" > ~/.R/Makevars # note: save your own version first
12 OSX - Setup R and devtools Install R 3.2 and devtools on OSX Tip: Online resources to install R 3.1+ on OSX Download and Install R 3.2 for OSX from R> install.pakcages(“devtools”)
13 Install R Dependencies # First disable slow Tk/Tcl prompts of mirrors R> options(menu.graphics=FALSE) # Some Rcpp packages have to to installed from source, otherwise may cause 'segfault' R> install.packages(pkgs=c("Rcpp","RcppArmadillo"),type="source") # now if you have "-lgfortran" or "-lquadmath" not found problems from above commands, please see entry in FAQ for fix R> install.packages(pkgs=c("BH", "data.table", "devtools", "digest", "hash", "methods", "optparse", "parallel", "plyr", "robustbase", "sets", "stringr", "zoo")) # other CRAN packages R> source(" # Bioconductor R> biocLite("BiocUpgrade") # Upgrade your Bioc to latest compatible version of your R # now if you have "Error in unloadNamespace(package)" after "preparing package for lazy loading", please see entry in FAQ for fix R>biocLite(pkgs=c("Biobase", "Biostrings", "BSgenome", "GenomeInfoDb", "GenomicRanges", "I Ranges", "Rsamtools")) # other Bioconductor packages #Note: if during any of install.packages() and devtools::install_bitbucket(), R throws a write permission error, add option lib=Sys.getenv('R_LIBS_USER') to following function calls and try again. SWAN FAQ:
14 Install SWAN R> devtools::install_bitbucket("charade/swan",dependencies=T,clean=T) R> devtools::install_bitbucket("charade/swan",dependencies=T,clean=T, lib=sys.getenv('R_LIBS_USER')) #if you got permission error Install SWAN Looking for SWAN binaries in path after “SWAN Binaries can be found at:" in install log. See example screen shot below: Locate SWAN Install Samtools (optional) # if you don't have Samtools >0.19, go to the current Samtools webpage and install it:
15 Single Sample Analysis Pipeline # read the swan/README.rst for more instructions $ test> $SWAN_BIN/single.sh one >single.one.log One Sample One Lib Analysis Example $ test> $SWAN_BIN/single.sh two >single.two.log # We are giving two libs as example here, more libs can be handled the same # way by appending additional unmerged lib bam files to the "," separated list One Sample Multiple Libs Analysis Example Tip: where to download swan source and swan_test.tgz $ wget $ wget # unzip the downloaded swan source package into "swan" # change into "swan/test" and tar unzip the swan_test.tgz there # we are only testing functionalities of SWAN here, data has no scientific values
16 Paired Sample Analysis Pipeline # read the swan/README.rst for instructions $ test> $SWAN_BIN/paired.sh one >paired.one.log Two Sample One Lib Analysis Example $ test> $SWAN_BIN/paired.sh two >paired.two.log # We are giving two libs as example here, more libs can be handled the same # way by appending additional unmerged lib bam files to the "," separated list Two Sample Multiple Libs Analysis Example Tip: where to download swan source and swan_test.tgz $ wget $ wget # unzip the downloaded swan source package into "swan" # change into "swan/test" and tar unzip the swan_test.tgz there # we are only testing functionalities of SWAN here, data has no scientific values!
17 Download and Use Authors' Testing Virtual Machines #CentOS 7 #Ubuntu 14 Download Ubuntu/CentOS Virtual Machines with SWAN # go to the oracle VirtualBox downloads below. Download and install. # unzip, install, create a Linux machine and import the downloaded.vdi file to VirtualBox see youtube tutorial: Note: password of a VM username is ALWAYS username itself Install Oracle VirtualBox and Import.vdi VM
18 References Useful SWAN resources README: Homepage: FAQ: Manual: Examples: This doc: Author's complete Install steps from Clean Ubuntu, CentOS and OSX: Thank you for using SWAN!
19 Good GCC [p4] ? Good R and devtools package [p6-7] ? SWAN Requirements Overview [p3] Install R Dependencies [p13] Install SWAN and Samtools [p14] Testing your installation [p15-16] Have A Testing Machine ? Additional Resources [p18] Get A Virtual Machine Download [p18] Install/Upgrade GCC Ubuntu [p7] Y N N CentOS [p9]OS X [p11] Y Install/Upgrade R and devtools Ubuntu [p8]CentOS [p10]OS X [p12] Y N
20 Create Your Own Testing Virtual Machines # go to the oracle VirtualBox downloads below. Download and install. Download and Install Oracle VirtualBox # go to the ubuntu desktop downloads below. Download the Ubuntu iso file. Download Ubuntu DVD image # go to the CentOS desktop downloads below. Download the CentOS iso file. Download CentOS DVD image # Here are good youtube videos. #ubuntu 14 #CentOS 7 # For ease of use of CentOS, in "software selection" you need to select "Gnome Desktop" and its "Development Tools", "Gnome Applications", "Internet Applications" and "Office Suites" for GUI and turn on "network" in "Network and Hostname" during installation. Create Ubuntu/CentOS Virtual Machines
21 Download and Use Authors' Testing Virtual Machines #CentOS 7 #Ubuntu 14 Download Clean Ubuntu/CentOS Virtual Machines Download Ubuntu/CentOS Virtual Machines with R #CentOS 7 #Ubuntu 14 Download Ubuntu/CentOS Virtual Machines with SWAN # go to the oracle VirtualBox downloads below. Download and install. # unzip, install, create a Linux machine and import the downloaded.vdi file to VirtualBox see youtube tutorial: Note: password of a VM username is ALWAYS username itself Install Oracle VirtualBox and Import.vdi VM #CentOS 7 #Ubuntu 14