Archive Ensembl HomeArchive Ensembl Home
Home > Help & Documentation

Installing and Running BioMart within Ensembl

Since the 0.6 version of BioMart, installation within external websites has become much harder as the code is not suited for such integrations without a number of post CVS checkout modifications. These you will find listed at the end.

Modifications to Ensembl code base

To enable BioMart in your checkout - include in your Plugins.pm directory the following line (directly above the EnsEMBL::Ensembl plugin line:

'EnsEMBL::Mart' => $SiteDefs::ENSEMBL_SERVERROOT.'/public-plugins/mart',

Considerations when running BioMart within Ensembl

NOTE: We do not run the BioMart application within the same Apache instances as the rest of the Ensembl site AND we use a secondary MySQL server for the BioMart databases.

There are a number of reasons for this - mainly due to the size of the Apache processes Mart produces (these are all 0.5G) and the number of tables in the Mart database. These both have adverse effects on the performance of the Ensembl website, so we have ring-fenced hardware specifically for running BioMart.

One solution is to use a reverse proxy to dispatch in-bound network traffic to a set of servers, while presenting a single interface to the caller (see Apache's mod-proxy documentation), and mod_rewrite to redirect users to the separate Mart machine.

  RewriteEngine     on
  ProxyPreserveHost On

# requests going to the server
  RewriteRule  ^/biomart/(martview.*)      http://your.mart.server/biomart/$1  [P,L]
  RewriteRule  ^/biomart/(martservice.*)   http://your.mart.server/biomart/$1  [P,L]
  RewriteRule  ^/biomart/(martresults.*)   http://your.mart.server/biomart/$1  [P,L]

# requests coming back from server
  ProxyPassReverse  / http://your.mart.server/

If you decide to do this, you also need to:

  • Remove EnsEMBL::Mart from Plugins.pm to remove Biomart from the Ensembl Webserver
  • Keep the changes as described below to achieve the Ensembl look'n'feel and temporary file management
  • Copy modules/EnsEMBL/Web/Document/HTML/ToolLinks.pm to your plugin and comment out the line:
    if ($ENV{'ENSEMBL_MART_ENABLED'}) {
    
    and the closing curly bracket two lines below it.

Changes to code post CVS checkout

cgi-bin/martresults.PLS

  • Delete the line [TAG:lib] (currently line 16)
  • Replace the following (near line 35)
    foreach(keys %$hash) {
      if($_ eq "background") {
        foreach my $param (keys %{$hash->{$_}}) {
          if($param eq "resultsDir1") {
            $background_dir = $hash->{$_}->{$param};
          }
        }
      }
    }
    $background_dir.='/';
      
    With:
    ## Let us do a nasty little hack (see BioMart.pm) to sensbily and
    ## in a working manner allow for heirarchical file saving to stop filesystems
    ## barfing really badly...
    $background_file =~ s/^[\.\\\/]+//;
    use Digest::MD5 qw(md5_hex);
    (my $background_directory = md5_hex($background_file) ) =~ s/^(\w)(\w\w).*$/$1\/$2/;
    my $background_dir = $hash->{'background'}{'resultsDir1'}.'/'.$background_directory.'/';
      

cgi-bin/martservices.PLS

  • Delete the line [TAG:lib] (currently line 12)

cgi-bin/martview.PLS

  • Delete the line [TAG:lib] (currently line 26)

conf/settings.conf

  • Replace the colour configuration with:
    colour_saturation0=#000000
    colour_saturation20=#efefef
    colour_saturation40=#fff9af
    colour_saturation60=#fff9af
    colour_saturation80=#ffffdd
    colour_saturation100=#ffffff
    
  • Set the exturl line to your server
  • Set an appropriate results dir: (resultsDir1 ), and set enable = yes
  • Set "subject" to "Your Ensembl BioMart results are ready" and "from" to "no-reply@your.domain.tld"
  • Set "expire" to "12h"

lib/BioMart/Web.pm

  • Replace
    my $background_file_hash = int(rand($background_file_dirCount)) + 1;
    with
    my $background_file_hash = 1;
    ## Hack (see martresults.PLS) to allow for heirarchical file saving 
    ## to stop filesystems barfing really badly...
    use Digest::MD5 qw(md5_hex);
    use File::Path;
    (my $background_directory = md5_hex( $background_file )) =~ s/^(\w)(\w\w).*$/$1\/$2/;
    $background_file_dir .= $background_directory.'/';
    mkpath( $background_file_dir, 0, 0777 );
    

conf/templates/custom

Copy the .tt files from public-plugins/mart/templates to biomart-perl/conf/templates/custom.