Install mirror MacOSX

From wubrowse wiki
Jump to: navigation, search

Environment

  • This instruction assume you are running Mac OSX 10.10 Yosemite. Also assume your username was dli, which you should adjust to your username.
  • Also if you find any problem with this instruction, please kindly let us know, either through Google plus group or Facebook group.

Requirements

  1. install Xcode from App Store (https://itunes.apple.com/us/app/xcode/id497799835?mt=12)
  2. install Apache and MySQL (there are lots of online tutorial, like this one http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/)
  3. R for gene plot funtion (http://www.r-project.org/)

Enable CGI support

  • edit Apache config file /etc/apache2/httpd.conf
    • uncomment this line:
LoadModule cgi_module libexec/apache2/mod_cgi.so
    • find following section, change 'Options None' make the setting looks like:
  <Directory "/Library/WebServer/CGI-Executables">
      AllowOverride None
      Options Indexes MultiViews FollowSymLinks ExecCGI
      Require all granted
 </Directory>
  • restart Apache
sudo apachectl restart

create directory structure

  • create folder for temporary files, go to apache folder
cd /Library/WebServer
sudo chown -R dli *
mkdir /Library/WebServer/Documents/t
mkdir /srv/epgg/data/trash
sudo chown _www:_www  /Library/WebServer/Documents/t /srv/epgg/data/trash
sudo ln -s /srv/epgg/data/trash /usr/lib/
  • create a place for data
mkdir -p /srv/epgg/data/data/subtleKnife/seq
  • example data for human genome hg19
cd /srv/epgg/data/data/subtleKnife/seq
curl -O http://epgg-test.wustl.edu/installdata/hg19.gz
curl -O http://epgg-test.wustl.edu/installdata/hg19.gz.tbi
mkdir -p /srv/epgg/data/data/subtleKnife/hg19
mkdir -p /srv/epgg/data/data/subtleKnife/hg19/config
mkdir -p /srv/epgg/data/data/subtleKnife/hg19/session
  • download tracks configuration for hg19
cd /srv/epgg/data/data/subtleKnife/hg19/config
curl -O http://epgg-test.wustl.edu/installdata/hg19/tracks.json
  • hg19 default tracks
cd /srv/epgg/data/data/subtleKnife/hg19
curl -O http://epgg-test.wustl.edu/installdata/hg19/refGene.gz
curl -O http://epgg-test.wustl.edu/installdata/hg19/refGene.gz.tbi
curl -O http://epgg-test.wustl.edu/installdata/hg19/rmsk_all.gz
curl -O http://epgg-test.wustl.edu/installdata/hg19/rmsk_all.gz.tbi
  • change session folder own to Apache user and group (_www)
sudo chown _www:_www /srv/epgg/data/data/subtleKnife/hg19/session

manipulate database

  • mysql command for adding an account 'hguser' with password 'hguser'
mysql> GRANT ALL ON *.* TO 'hguser'@'localhost' IDENTIFIED BY 'hguser' WITH GRANT OPTION;
Query OK, 0 rows affected (0.07 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)
  • create database for hg19
mysql> create database hg19;
Query OK, 1 row affected (0.06 sec)
  • download database files and load them
mkdir browserLoad
cd browserLoad
curl -O http://epgg-test.wustl.edu/installdata/hg19/sql.tgz
tar zxvf sql.tgz
cd hg19/
cat load.sql | mysql -u hguser -p hg19
cd /srv/epgg/data/wubrowser/config/hg19
cat makeDb.sql ../sessionUtils.sql | mysql -u hguser -p hg19

build browser code

  • create a place putting the code
sudo mkdir -p /srv/epgg/data
sudo chown dli /srv/epgg/data/
cd /srv/epgg/data/

build samtools

curl -O  https://cgs.wustl.edu/~xzhou/samtools-legacy.tgz
tar zxvf samtools-legacy.tgz 
cd samtools-legacy
make
  • validate samtools works
./samtools view http://vizhub.wustl.edu/hubSample/hg19/bam1.bam

build tabix

curl -O https://cgs.wustl.edu/~xzhou/tabix-lidaof.tgz
tar zxvf tabix-lidaof.tgz 
cd tabix-lidaof
make
  • validate tabix works
./tabix -f http://vizhub.wustl.edu/hubSample/hg19/refGene.gz chr7:27053199-27373567
  • get browser code
mkdir wubrowse/
cd wubrowse/
curl -O http://epigenomegateway.wustl.edu/info/source/wubrowse.v39.tgz
tar zxvf wubrowse.v39.tgz 
    • need edit the C code, adjust web server home folder like following:
vi subtleKnife.c
  #define trashDir "/usr/lib/trash"
  #define WWWT "/Library/WebServer/Documents/browser/t"
  #define BINdir "."
  #define Mysqlserver "localhost"
  #define Mysqluser "hguser"
  #define Mysqlpswd "hguser"
    • also edit this file
vi postdeposit.c
 #define WWWT "/Library/WebServer/Documents/browser/t"
    • run following command to get the parameters how mysql configured on your system
mysql_config --libs
  (my output) -L/usr/local/mysql/lib -lmysqlclient   -lpthread
mysql_config --include
  (my output)-I/usr/local/mysql/include
    • create a make script
vi make.sh
    • add following cotents:
gcc -O -g  -Wall -Wformat -Wimplicit -Wreturn-type -Wuninitialized -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -DCOLOR32 -D_USE_KURL -Wall -Wformat -Wimplicit -Wreturn-type -I/srv/epgg/data/tabix-lidaof -I/srv/epgg/data/samtools-legacy -I/usr/local/mysql/include -o subtleKnife.o -c subtleKnife.c
gcc -O2 -g  -Wall -Wformat -Wimplicit -Wreturn-type -Wuninitialized -o subtleKnife subtleKnife.o -pthread -L/usr/local/mysql/lib -lmysqlclient -L/srv/epgg/data/tabix-lidaof -L/srv/epgg/data/samtools-legacy -lbam -ltabix -lz -lm -lpthread -ldl -L/usr/local/lib -lcurl
gcc postdeposit.c -o postdeposit
  • run following link command (important)
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
  • move CGI binary to cgi folder
mv subtleKnife postdeposit /Library/WebServer/CGI-Executables/
  • create the browser folder and copy related file to the folder
mkdir /Library/WebServer/Documents/browser
mv *.js index.html style.css images/ /Library/WebServer/Documents/browser/
  • copy treeoflife file for display organism tree
cd /srv/epgg/data/wubrowser/config
cp treeoflife /srv/epgg/data/data/subtleKnife/

Mirror yosemite.png

Supporting bigWig and bigBed

Archive

  • the following uses UCSC kent source for bigWig support

bigWig track support

  • need to get UCSC kent source tree for supporting bigWig tracks
 mkdir ucsc
 cd ucsc/
  • get samtabix
 git clone http://genome-source.cse.ucsc.edu/samtabix.git samtabix
 cd samtabix/
 make
  • get UCSC kent source code
 cd ..
 git clone  http://genome-source.soe.ucsc.edu/kent.git
  • before compile, need setup few environment variables in your configuration file
 vi ~/.bash_profile
    • add following (for example)
 # variables for UCSC
 export MACHTYPE=`uname -m`
 export MYSQLLIBS="-L/usr/local/mysql/lib -lmysqlclient   -lpthread"
 export MYSQLINC=/usr/local/mysql/include
 export USE_SAMTABIX=1
 export SAMTABIXDIR=/Users/dli/ucsc/samtabix
 export USE_SSL=1
  
  • make these effect and compile the library
 source ~/.bash_profile
 cd kent/src
 make libs
  • compile bwquery tool for accessing bigWig
cd /srv/epgg/data
ln -s /Users/dli/ucsc/kent/src/inc .
ln -s /Users/dli/ucsc/kent/src/lib .
cd wubrowser/bwquery/
make
  • testing bwquery, the output should be in bwOutput.txt file
./bwquery http://vizhub.wustl.edu/hubSample/hg19/sample.bigWig chr7 27053199 27373567 20 bwOutput.txt 1
  • move the binary to cgi folder
mv bwquery /Library/WebServer/CGI-Executables/

notes

  • basename function might not working on EI captain
  • mkdir function for linux C might not working on EI captain