This repository contains setup instructions, maintenance scripts and links to data for setting up a GBrowse instance on Ubuntu.
From a bare Ubuntu 14 image Gbrowse can be installed very easily. To install everything
sudo apt-get install gbrowse gbrowse-calign gbrowse-data libbio-samtools-perl apache2
Then configure Apache to run cgi scripts
sudo ln -s /etc/apache2/mods-available/cgid.load /etc/apache2/mods-enabled/
sudo ln -s /etc/apache2/mods-available/cgid.conf /etc/apache2/mods-enabled/
sudo service apache2 restart
And for speed enable fast-cgi
sudo apt-get install libapache2-mod-fastcgi
After this is done you should be able to access the tutorial by browsing to http://hostname/gbrowse2
Under this setup the key directories are little different from those mentioned in tutorials
Original | New | Purpose |
---|---|---|
/var/www/gbrowse2 | /usr/share/gbrowse/htdocs | html files |
/var/lib/gbrowse2/databases | /var/lib/gbrowse/databases | databases |
/etc/gbrowse2 | /etc/gbrowse | gbrowse conf |
So that we can easily admin the server we change the ownership of the gbrowse conf and data directories. In the original setup these are owned by root. By keeping the group unchanged these files will still be accessible to apache.
sudo chown -R ubuntu /var/lib/gbrowse
sudo chown -R ubuntu /etc/gbrowse
The GBrowse tutorial on Authentication provides the main details on how to do this but some crucial details are missing.
The most important is that we need to fix an issue with the ubuntu install which does not set a value for wwwuser in the config. This can be fixed as follows;
sudo perl -e 'use GBrowse::ConfigData;GBrowse::ConfigData->set_config(wwwuser => "www-data");GBrowse::ConfigData->write;'
Then create the users database
gbrowse_metadb_config
Check that the db has permissions for www-data. If not change its group and ownership to www-data
Then create a new user
sudo gbrowse_create_account iracooke
Finally, in order to restrict access to a particular database place this at the top
[GENERAL]
restrict = require valid-user
Properly Format gff files
An essential thing is to take heed of this note from the manual
It is very important to have a full-length entry (such as the one for ctgA) for each reference sequence mentioned in the first column of the GFF3 file. However, the reference sequence can have any source and type you choose. Commonly used types are "clone", "chromosome" and "contig."
Since programs like Augustus don't include these entries by default it will be necessary to add them.
Now create the sqlite file by ingesting a gff3 as follows. For a large file this can take a long time (several hours)
bp_seqfeature_load -c -a DBI::SQLite -d 'genes.sqlite' soft_coral_151022.UTRon.rename.gff3
In order to enable tracks relating to the genome sequence itself we also need a db for that
bp_seqfeature_load -c -a DBI::SQLite -d 'scaffolds.sqlite' scaffold8.fa
In the conf file specify the sqlite adaptor and the actual sqlite file for genes and scaffolds
[genes:database]
db_adaptor = Bio::DB::SeqFeature::Store
db_args = -adaptor DBI::SQLite
-dsn /var/lib/gbrowse/databases/lobophytum_pauciflorum/genes.sqlite
[scaffolds:database]
db_adaptor = Bio::DB::SeqFeature::Store
db_args = -adaptor DBI::SQLite
-dsn /var/lib/gbrowse/databases/lobophytum_pauciflorum/scaffolds.sqlite
sudo apt-get install build-essential libpng12-dev libssl-dev
wget wget http://hgdownload.soe.ucsc.edu/admin/exe/userApps.v310.src.tgz
tar -zxvf userApps.v310.src.tgz
cd userApps/kent/src/
# in inc/common.mk replace `CFLAGS=` line with `CFLAGS=-fPIC`
make
cd ..
sudo -i
export MACHTYPE=x86_64
export KENT_SRC=`pwd`
cpan Bio::DB::BigWig
For basic logging see the apache error log at /var/log/apache2/error.log
bp_seqfeature_load -c -f -a DBI::SQLite -d ~/gbrowse/FH.sqlite your-assembly.fasta your-maker.gff
First install the blat executables
cd /usr/local/bin
sudo wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/blat/blat
sudo wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/blat/gfClient
sudo wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/blat/gfServer
sudo wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/faToTwoBit
sudo chmod a+x blat gfClient gfServer faToTwoBit
Index the genome
cd /var/lib/gbrowse/databases/lobophytum_pauciflorum/
faToTwoBit soft-coral_genome-assembly151022.fa soft-coral_genome-assembly151022.2bit
mv soft-coral_genome-assembly151022.2bit /var/lib/gbrowse/twobit/
cd /var/lib/gbrowse/twobit/
nohup gfServer -log=gfServer.log start localhost 17781 *.2bit &
Thanks for the tutorial! One small remark. I think because of the fastcgi the url path changes from (tutorial url) cgi-bin/gbrowse2/gbrowse// to fgb2/gbrowse//
At least it took me a bit to find the correct url path to the datasets