Install mirror MacOSX

From wubrowse wiki
Jump to: navigation, search


  • 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.


  1. install Xcode from App Store (
  2. install Apache and MySQL (there are lots of online tutorial, like this one
  3. R for gene plot funtion (

Enable CGI support

  • edit Apache config file /etc/apache2/httpd.conf
    • uncomment this line:
LoadModule cgi_module libexec/apache2/
    • 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
  • 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
curl -O
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
  • hg19 default tracks
cd /srv/epgg/data/data/subtleKnife/hg19
curl -O
curl -O
curl -O
curl -O
  • 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)
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
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
tar zxvf samtools-legacy.tgz 
cd samtools-legacy
  • validate samtools works
./samtools view

build tabix

curl -O
tar zxvf tabix-lidaof.tgz 
cd tabix-lidaof
  • validate tabix works
./tabix -f chr7:27053199-27373567
  • get browser code
mkdir wubrowse/
cd wubrowse/
curl -O
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
    • 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


  • 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 samtabix
 cd samtabix/
  • get UCSC kent source code
 cd ..
 git clone
  • 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/
  • testing bwquery, the output should be in bwOutput.txt file
./bwquery chr7 27053199 27373567 20 bwOutput.txt 1
  • move the binary to cgi folder
mv bwquery /Library/WebServer/CGI-Executables/


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