Difference between revisions of "AngieTest"

From genomewiki
Jump to: navigation, search
m (Polishing... formatting, shorthand to text.)
(Gutted contents to avoid dangling category reference.)
Line 1: Line 1:
This page contains detailed installation instructions for setting up [http://genome.ucsc.edu UCSC Genome Browser] comparative genomics track data and [[GBrowse]] [[GBrowse#Plugins|plugins]] to display them.  It assumes that you already have a working installation of [[GBrowse]] and [http://www.mysql.com/ mysql].
== Etc. ==
[[AngieTest|This page]] (but not [[Main_Page|this one]]) is for ''quick'' '''tests'''
== Prerequisites ==
=== etc. ===
* A working installation of [[GBrowse]] (see also [[GBrowse_Install_HOWTO.txt]])
* A working installation of [http://www.mysql.com/ MySQL http://www.mysql.com/]
**<span style="color: green">'''''formatting'''''</span>
* Plenty of disk space, ideally local to your server.
**#<nowiki>options [and] <stuff></nowiki>.
Disk space requirements vary depending on how many assemblies, alignments and types of tracks you would like to install. Things to consider:
  code here
* Temporary disk space for MySQL dump files used to load the database tables.
* MySQL server disk space requirements for database tables.
* If loading a Conservation track, permanent disk space for data files indexed by the MySQL database tables.
Here are some example approximate sizes for various tracks and organisms (note that each genome assembly usually has many Chain and Net tracks, and one Conservation track):
{| cellspacing="0" border="1"
!Track Description
!MySQL dump files
!MySQL table Data_length
!External files
|Worm-Worm Chain
|Worm-Worm Net
|Worm 5-way Conservation
|Human-Mammal Chain
|Human-Mammal Net
|Human 28-way Conservation
== UCSC naming conventions and other relevant subtleties ==
An understanding of UCSC conventions is not really a prerequisite, but will be quite helpful for understanding the installation process.
=== UCSC database names ===
UCSC builds a separate MySQL database of annotations for each genome assembly.  Each database contains at least one table for each "track" (set of annotations).  The database name begins with 2 or 6 letters indicating the species, followed by a sequence number which usually starts with 1 on the first assembly that UCSC processes. 
Jim Kent wrote the UCSC Genome Browser while working on the Human Genome Project, so all databases for the human genome start with "hg".  For example, hg18 is the database of annotations for the 18th assembly of the human genome displayed in the UCSC Genome Browser; the assembly itself is better known as NCBI Build 36. 
The next species added to the browser was mouse, and the first letters of its genus and species names were used: "mm" for Mus musculus.  That convention was followed for rat (rn), ''C. elegans'' (ce), ''D. melanogaster'' (dm) and several other species added before mid-2003.  Then, in order to avoid name clashes among the deluge of newly sequenced species, a new convention was established: when new species are added to the browser, we use the first three letters of the genus in lowercase, and first three letters of the species with the first letter capitalized (e.g. "bosTau" for ''Bos taurus'').
=== Chromosome naming ===
Most genome assemblies use sequence names for chromosomes that match chromosome designations in the literature -- for example, 1, 2, 3 for human, and I, II, III for worm.  UCSC prefixes those sequence names with "chr", to make it easier for its software to recognize chromosome sequence names.  UCSC's annotations for human refer to chr1, chr2, chr3 etc., and for worm, chrI, chrII, chrIII etc.
=== Naming of database tables for comparative genomics tracks ===
For assemblies that consist of a reasonably small number of sequences (e.g. a few dozen chromosomes or mapping groups, possibly with concatenated unplaced sequences in virtual "chromosomes"), a track's data may be split into per-sequence tables instead of kept in one main table.  This applies to the Chain tracks but not Net tracks, since Chain tracks contain much more data.  When split, table names for a track end with the same track name, prefixed by the sequence name and _.  For example, if a track named foo is split, its database tables are named chr*_foo (or using the MySQL wildcard, chr%\_foo).
On the other hand, if an assembly consists of thousands of separate unplaced sequences (e.g. WGS scaffolds), then it would kill MySQL to make one table per sequence for each split track.  Therefore, splitting does not apply to such assemblies, and a track named foo would have one table named foo.
Chain tracks use two different types of database table to efficiently store the usually quite large amounts of data.  The main tables are named chain''OtherDb'', and auxiliary "chainLink" tables are named chain''OtherDb''Link.  (Or, if split, chr*_chain''OtherDb'' and chr*_chain''OtherDb''Link.)
Chain and Net tracks contain pairwise alignments to a particular assembly of some other species' genome.  The database table names for those tracks include the UCSC database name for that other species' assembly.  For example, the chained alignments of UCSC's first ''D. ananassae'' build (the query) to UCSC's third ''D. melanogaster'' build (the target or reference) would be stored in the dm3 database, as the tables chr*_chainDroAna1 and chr*_chainDroAna1Link -- split because dm3 consists of a manageable number of chromosomes and concatenated unplaced sequences.  The corresponding netted chains would be stored in netDroAna1.
The Conservation track combines two data types: per-base conservation scores and multi-species alignments.  Both data types use not only database tables, but also external files, to store the data due to its massive size.
The scores are stored in UCSC's "wiggle" format, which utilizes both database tables and external files.  The database table is usually called phastCons''N''way where ''N'' is the number of aligned species including the reference.  The database references external files that contain binary compressed data.
The multi-species alignments are stored in external files in the MAF format; those files are indexed in the multiz''N''way database table.  The maf table refers to numeric IDs of the files; those numeric IDs and the actual file paths are stored in the extFile table.
The Conservation track will probably need a C extension for decent performance... describe that too!
=== Assembly and track meta-info ===
UCSC's names for databases and track tables are rather opaque by themselves, so we store information about them in separate tables.  Assembly databases are described by the dbDb table in the central database, hgcentral.  Each assembly database contains a trackDb table that describes all tracks in that database.
== Installation Overview ==
# Download MySQL table data from UCSC.
# Create mysql database and load tables.
#* If adding the Conservation track, also download external files and acceleration C code.
# Download the [[GBrowse#Plugins|GBrowse plugin]] and glyph modules (from where?  UCSC?  modENCODE?  bundled with GBrowse?)
# Install and configure plugin(s).
== Installation Details ==
=== Which UCSC database? ===
First, identify the UCSC database name that corresponds to the assembly version on which your GBrowse installation is built.  For example, WormBase version WS170 corresponds to UCSC database ce4.  This version correspondence is usually available on the assembly description page at http://genome.ucsc.edu/cgi-bin/hgGateway ; you might need to change the clade and genome in order to see your species of interest and its available assembly dates.  If you still aren't sure about the correspondence, ask mailto:genome@soe.ucsc.edu for assistance.
=== Which tables for my track(s) of interest? ===
These are the database tables required for each type of track:
{| cellspacing="0" border="1"
!Track type
!MySQL table(s)
|all tracks
|trackDb, hgcentral.dbDb
|chain''OtherDb'', chain''OtherDb''Link<br>or if split:<br>chr*_chain''OtherDb'', chr*_chain''OtherDb''Link
|multiz''N''way, extFile, multiz''N''wayFrames, multiz''N''waySummary, phastCons''N''way*
=== Download mysql dump files from UCSC ===
All UCSC Genome Browser data can be downloaded from [http://hgdownload.cse.ucsc.edu/ hgdownload.cse.ucsc.edu].  The HTTP, FTP and rsync protocols are supported.
For each database table $TABLE, there are two files: $TABLE.sql, which contains a CREATE statement for MySQL to create the table, and $TABLE.txt.gz, a gzip-compressed tab-separated text file with the contents of the table.  In these examples of how to fetch the data using different protocols, $TMPDIR is a local temporary storage directory, $DB is the database, and $TABLE is the table.  In practice, you will probably write a script that loops on multiple tables and possibly even multiple databases. 
# Example 1: use rsync to fetch .sql and .txt.gz files:
mkdir -p $TMPDIR/$DB
rsync -avP \
  rsync://hgdownload.cse.ucsc.edu/genome/goldenPath/$DB/database/$TABLE.{sql,txt.gz} \
gunzip $TMPDIR/$DB/$TABLE.txt.gz
# Example 2: use wget to fetch files using ftp:// or http:// :
mkdir -p $TMPDIR/$DB
wget -N -O $TMPDIR/$DB/$TABLE.sql \
wget -N -O $TMPDIR/$DB/$TABLE.txt.gz \
gunzip $TMPDIR/$DB/$TABLE.txt.gz
Also download the central database .sql, which creates and populates several assembly metadata tables. 
wget -N -O $TMPDIR/hgcentral.sql \
If you encounter any problems while fetching the files, contact mailto:genome-mirror@soe.ucsc.edu .  Please include which database and file(s), which version of downloading tool you were using, error messages if any, and any other relevant info.
=== Create and load the MySQL database ===
Having downloaded the necessary data files, create local MySQL database(s), ideally with the same names used by UCSC:
mysql -u root -pPassword < $TMPDIR/hgcentral.sql
mysql -u root -pPassword -e "create database $DB;"
Here is how to create and populate a single table.  In practice, you will most likely write a script that loops on $TABLE and possibly on $DB:
mysql $DB -u root -pPassword < $TABLE.sql
mysql $DB -u root -pPassword -e "load data local infile '$TMPDIR/$DB/$TABLE.txt' into table $TABLE"
=== Conservation track only: download external files ===
The Conservation track combines multiple alignments and per-base scores for multiple species.  This is a very large amount of data, and in order to access and display it quickly, the actual data are kept in external files, and the database tables simply index those files.  So, having installed the multiz''N''way and phastCons''N''way database tables, you can use mysql to determine what files are needed from UCSC.
Determine the files needed for multiz''N''way and phastCons''N''way by running by running these mysql commands:
select distinct(path) from extFile,multizNway where extFile.id = multizNway.extFile;
select distinct(file) from phastConsNway;
The paths all start with "/gbdb/", and can be downloaded from hgdownload.cse.ucsc.edu using the /gbdb/... path as follows, depending on your chosen protocol:
Ideally, create a local /gbdb/ and install the files in the same paths as referenced by the sql tables.  If that is not possible, replace the pathnames in the sql tables with your local paths to the corresponding files.
=== Download, install and configure the UCSC track plugin(s) ===
Obtain the GBrowse UCSC*.pm plugin files (where will these be distributed from?) and install then in GBrowse's Generic_Genome_Browser/conf/plugins/ directory.
Obtain the GBrowse ucsc_*.pm glyph files and install them in GBrowse's Generic_Genome_Browser/lib/Bio/Graphics/Glyph/ directory.
Conservation track only: download and compile C extension??
* Add the plugin names (UcscChain, UcscNet, and/or UcscConservation) to the GBrowse ''datasource''.conf plugins setting (see also [[GBrowse#Plugins]])
Add plugin settings like the following to ''datasource''.conf for each Ucsc plugin installed:
db = ce4
user = ''mysqlReadOnlyUser''
pass = ''mysqlReadOnlyUsersPassword''
seq_prefix = chr
split_prefix = chr
default_enable = chainCb3 chainCaeRem2
These are the supported plugin settings:
{| cellspacing="0" border="1"
{| cellspacing="0" border="1"
Line 209: Line 22:
|The name of a MySQL user that has permission to read <span style="font-family: Courier New;">db</span>.
|The name of a MySQL user that has permission to read <span style="font-family: Courier New;">db</span>.
|<span style="font-family: Courier New;">pass</span>
|The password for <span style="font-family: Courier New;">user</span>.
|<span style="font-family: Courier New;">seq_prefix</span>
|If the datasource has sequence names like I, II, III or 2L, 2R, 3L, set this to <span style="font-family: Courier New;">chr</span> so that they can be translated into UCSC's names: chrI, chrII, chrIII or chr2L, chr2R, chr3L etc.  This is usually the case.
|<span style="font-family: Courier New;">split_prefix</span>
|If all of the sequences in the datasource are chromosome names (not separate scaffolds, contigs etc), set this to <span style="font-family: Courier New;">chr</span> if <span style="font-family: Courier New;">seq_prefix</span> is <span style="font-family: Courier New;">chr</span>.
|<span style="font-family: Courier New;">default_enable</span>
|'''should be'''
|A whitespace-separated list of chain or net tracks to display by default.  E.g., <span style="font-family: Courier New;">chain''OtherDb1'' chain''OtherDb2''</span> in the UcscChain:plugin section, <span style="font-family: Courier New;">net''OtherDb1'' net''OtherDb2''</span> in the UcscNet:plugin section.  If not specified, all tracks will be displayed by default which could overwhelm the display.
|<span style="font-family: Courier New;">host</span>
|prob. not
|The machine on which the MySQL server, if not the same machine on which GBrowse runs.
|<span style="font-family: Courier New;">port</span>
|prob. not
|The port number used by the MySQL server, if not the same as MySQL's default.
|<span style="font-family: Courier New;">central_db</span>
|prob. not
|The name of the MySQL database in which the dbDb table is stored, if not the same as <span style="font-family: Courier New;">db</span>.
|<span style="font-family: Courier New;">central_user</span>
|prob. not
|The MySQL user for <span style="font-family: Courier New;">central_db</span>, if not the same as <span style="font-family: Courier New;">user</span>.
|<span style="font-family: Courier New;">central_pass</span>
|prob. not
|The password for <span style="font-family: Courier New;">central_user</span>, if not the same as <span style="font-family: Courier New;">pass</span>.
|<span style="font-family: Courier New;">central_host</span>
|prob. not
|The machine on which the MySQL server that serves up <span style="font-family: Courier New;">central_db</span>, if not the same as <span style="font-family: Courier New;">host</span>.
|<span style="font-family: Courier New;">central_port</span>
|prob. not
|The port number used by <span style="font-family: Courier New;">central_host</span>, if not the same as <span style="font-family: Courier New;">port</span>.
==== Re: category ====
=== Test GBrowse ===
Don't say <nowiki>[[Category:HOWTO]]</nowiki> because we don't have that category.
Reinstall GBrowse by running 'make install' in Generic_Genome_Browser/, watch for errors at the end of the GBrowse web server's error log file, and start using GBrowse.  Here is an example command to watch the log file that might work if you are using Apache:
tail -f /usr/local/apache/logs/error_log
In GBrowse, below the image, in the Tracks section, Analysis subsection, set the checkboxes by the UCSC plugin track names and click Update Image.  UCSC tracks should appear in the display.  If not, there may be no data in the current region; try viewing a region that contains an exon or gene.  Or the error log may contain a message that indicates what is missing.
== Performance tweaks ==
=== rsync mysql table binary files ===
If you have permissions to modify MySQL's binary files, and are investing significant effort into developing an automated regular update of track data, you may want to try rsyncing the binary files directly from UCSC.  That replaces the downloading of $TABLE.{sql,txt.gz} files and loading into MySQL. 
rsync -navP rsync://hgdownload.cse.ucsc.edu/mysql/$DB/$TABLE.\* \
=== Build C lib for Conservation plugin ===
Will this have to be part of the regular installation for Conservation???
== Bug Reports and Support Requests ==
Please send general questions and/or bug reports to mailto:genome@soe.ucsc.edu.  If your question is specifically about fetching data from hgdownload.cse.ucsc.edu, send to mailto:genome_mirror@soe.ucsc.edu. 
Copyright 2007, Angie Hinrichs mailto:angie@soe.ucsc.edu. Redistribution is welcome provided that acknowledgement of authorship is maintained.

Latest revision as of 19:13, 10 October 2007


This page (but not this one) is for quick tests


  • of
    • formatting
      1. options [and] <stuff>.
code here
setting required? description
db Yes The name of the MySQL database where UCSC tables have been loaded.
user Yes The name of a MySQL user that has permission to read db.

Re: category

Don't say [[Category:HOWTO]] because we don't have that category.