GBrowse/GMap Mashup

The purpose of this code is to create a mash up of GBrowse data and Google Maps that displays diversity data of a feature in the locations that they were sampled.


This code was started as a modification of the gbrowse_details script.

Template Toolkit is used to generate the html for the page. The template is encased after the __DATA__ token.



PhyloGeoViz is a Google Maps/Population data mashup. It does the heavy lifting of displaying the diversity data on Google Maps. This means that PhyloGeoViz (or something functionally equivalent) is required for the gbrowse_gmap script to work.

Fortunately, PhyloGeoViz is freely available and easy to install.

PhyloGeoViz Web Sites

More detailed and up to date information on PhyloGeoViz is available at its web site, The code is available at .

PhyloGeoViz Installation

  • PHP

    PhyloGeoViz is a PHP application. Make sure PHP is installed and working on your server.

  • Get PhyloGeoViz Code

    PhyloGeoViz is available through Google. Simply download using Subversion (svn). From the Linux command line it looks like this:

      svn checkout phylogeoviz-read-only
  • Make a directory in your web server's document tree


      mkdir /var/www/html/phylogeoviz
      mkdir /usr/local/apache2/htdocs/phylogeoviz
  • Copy PhyloGeoViz

    Copy the contents of the phylogeoviz-read-only directory into the newly created directory:

      cp phylogeoviz-read-only/* /var/www/html/phylogeoviz/

PhyloGeoViz Configuration

In the top directory of your new PhyloGeoViz installation is a file called config.php. This is a php file where information is set to customize PhyloGeoViz.

Open it with your favorite editor.


  vim /var/www/html/phylogeoviz/config.php
  • $gmap_api_key

    To use Google Maps, a GMap API key must be supplied. As of writing, keys are freely available from Google at

    Set the $gmap_api_key to your new api key. As follows:


    Note: You must keep the quotes and the semicolon intact for it to work.

  • $popup_url

    Each PhyloGeoViz pie has a marker in the middle. Clicking on that pops up a window with information. If set $popup_url will be used as a base url to get html to fill the pop-up window. We want that to point to this (the gbrowse_gmap) script.

      $popup_url = "/cgi-bin/gb2/gbrowse_gmap/pop_demo?pop_name=";

    Note: You still must keep the quotes and the semicolon intact for it to work.

Test PhyloGeoViz

To check that the installation worked, go to your web site:


This will give you a page that says "Input Your Data".

Click the "Autofill some example data" link to get some example data and click "Draw Map!".

If a Google Map appears with several pie charts, then you have successfully installed Phylogeoviz.


To place the mashup in a balloon, simply add a modified version of the following to the track configuration.

  balloon click = http://localhost/cgi-bin/gbrowse_gmap/yeast_chr1?ref=$ref;start=$start;end=$end;name=$name;class=$class;balloon=1

Similarly, to set the mashup as a feature link add a modified version of the following to the track configuration.

  link = http://localhost/cgi-bin/gbrowse_gmap/yeast_chr1?ref=$ref;start=$start;end=$end;name=$name;class=$class;

Note that the only difference between the two URLs was the balloon option. The balloon option needs to be set to 1 if it will be popped up in a balloon.

The "yeast_chr1" portion should be replaced with the coorect data source.

Also, "localhost" should be changed to your url. A relative url may not work because Google ties the api key to a URL.

Current Data Requirements

  • Different Populations will have different track types.

  • Latitude and Longitude

    A track is identified as being a population if it has latitude and longitude values assigned in the configuration file.

  • Haplotypes

    Each haplotype of a population is stored as a feature with the "score" value deterimining its weight. The feature "name" is the haplotype name. For features to be considered as part of the same population group, they must all share the same start and end.

  • Start and end of all used features the same.

    Only features that have the same start and end as the chosen feature will be displayed. If a feature has a different start or end, it will be excluded.

  • SeqFeature::Store is being used.

    I'm pretty sure that this won't work for anything other than SeqFeature::Store. I haven't tested that assumption though. There should be a way to generalize this. The feature searching is where I'm conserned about it.

Example Data

  contig1       Contig  scaffold        1       793     .       .       .       Name=contig1
  contig1       POPA    SNP     50      50      8       .       .       ID=snp.POPA.contig1.50.AA;Name=AA
  contig1       POPA    SNP     50      50      4       .       .       ID=snp.POPA.contig1.50.AG;Name=AG
  contig1       POPB    SNP     50      50      1       .       .       ID=snp.POPB.contig1.50.AA;Name=AA
  contig1       POPB    SNP     50      50      4       .       .       ID=snp.POPB.contig1.50.AG;Name=AG
  contig1       POPB    SNP     50      50      5       .       .       ID=snp.POPB.contig1.50.NN;Name=NN
  contig1       POPC    SNP     50      50      3       .       .       ID=snp.POPC.contig1.50.AA;Name=AA
  contig1       POPC    SNP     50      50      2       .       .       ID=snp.POPC.contig1.50.AG;Name=AG

GMap API Key (Depricated)

Since this script is now using PhyloGeoViz for the GMap interactions, we no longer need the api key. I'm keeping this section of comments in case we ever need it again.

Interesting Methods

This method prints out the population details for the given feature. This is to be presented in a smallish popup balloon. It presents population information and creates links to GBrowse.

The reason that this is not it's own script is that it is just a small portion of the gbrowse_gmap project. I'm trying to minimize the file footprint of this project.