#!/usr/bin/perl -w ################################################################### # Non-modperl users should change this variable if needed to point # to the directory in which the configuration files are stored. # $CONF_DIR = '/bio/argos/gmod/in01/conf/gbrowse.conf'; # ################################################################### $VERSION = 1.67; use lib '/bio/argos/gmod/in01/lib'; # $Id: gbrowse_img.PLS,v 1.27.4.8.2.10.2.1 2007/03/01 22:25:55 lstein Exp $ use strict; use CGI qw(param redirect header start_html end_html p h1 path_info escape img); use Bio::DB::GFF; use Bio::Graphics; use Bio::Graphics::Browser; use Bio::Graphics::Browser::Util; use Bio::Graphics::Browser::PluginSet; use Bio::Graphics::Browser::UploadSet; use Bio::Graphics::Browser::RemoteSet; use Bio::Graphics::Browser::PageSettings; use Text::Shellwords; use Digest::MD5 'md5_hex'; use Fcntl qw(:flock); use vars qw($CONFIG $VERSION $CONF_DIR $PLUGINS $UPLOADS $REMOTES); use constant MAX_SEGMENT => 1_000_000; use constant TOO_MANY_SEGMENTS => 500; use constant PANEL_GAP => 3; # call with following arguments: # source database source # type list of feature mnemonics # options track options, in format mnemonic+option+mnemonic+option... # name landmark or range to display, in format Name:start..stop # width desired width of image, in pixels (height cannot be set) # add a feature to superimpose on top of the image # in format: reference+type+name+start..stop,start..stop,start..stop # multiple "add" arguments are allowed # style stylesheet for added features # h_region region(s) to hilight # h_feat feature(s) to hilight $CONF_DIR = conf_dir($CONF_DIR); $CONFIG = open_config($CONF_DIR); # open_config() is exported from Util.pm unless (param()) { print header; print_usage(); exit 0; } # set the database source my $src = param('src') || param('source') || path_info(); $src =~ s!^/+!!; # get rid of leading / from path_info() $src =~ s!/+$!!; # get rid of trailing / from path_info() # Migrate from 1.56 way of specifying source to 1.57 way # This may cause a redirect and exit 0 at this point! redirect_legacy_url($src,'add','abs','list','style','options','type','width','grid','keystyle'); if ($src) { unless ($CONFIG->source($src)) { print header('text/plain'); print "Invalid source $src; you may not have permission to access this data source.\n"; exit 0; } } # self-documentation feature: dump out tab-delimited list of mnemonics and keys if (param('list')) { dump_sources() if param('list') eq 'sources'; dump_types() if param('list') eq 'types'; exit 0; } ## dgg here; cache of all this so dont regen slow images for each browser-back my ($pagecache,$newpagecache)= checkCachedPage('cachedir', CGI::query_string()); if ($pagecache) { if (open(CP,$pagecache)) { flock(CP,LOCK_SH); #warn "gbrowse_img cached: $pagecache\n" ; #if DEBUG; print ; flock(CP,LOCK_UN); close(CP); exit 0; } } # get all parameters my @landmarks = (param('name'), param('q')); # list of landmarks to display my @track_types = (param('type'), param('t')); # track types to turn on my @add_features = (param('add'), param('a')); # overlay features my @add_style = (param('style'), param('s')); # overlay features style my @options = (param('options'),param('o')); # various track options, such as bumping my $show_overview = param('overview'); # force an overview-style display my $width = param('width')||param('w'); # width of the image in pixels my $abs = param('abs'); # absolute rather than relative coordinates $abs = param('b') unless defined $abs; my $image_class = param('image_class') || param('format') || 'GD'; # image type my $keystyle = param('keystyle') || param('k') || 'between'; my $grid = param('grid'); my $noscale = param('noscale'); my $embed = param('embed')|| param('e'); # embedded in a frame my $flip = param('flip') || param('f'); # right<->left my $hitkey = param('key'); # key for hit track my $id = param('id'); my @h_region = param('h_region'); my @h_feat = param('h_feat'); $grid = 1 unless defined $grid; # default for backward compatibility $abs = 1 unless defined $abs; my $db = open_database($CONFIG); # Get the ID of the requested segment and error out if none provided @landmarks = infer_landmarks($db,\@add_features) if @add_features && !@landmarks; @landmarks or message("Must provide a 'name' parameter to specify region to display."); my @segments = segments($CONFIG,$abs,\@landmarks); # set the image width $CONFIG->width($width) if $width; # get options and visibility hash my ($options,$labels,$visible) = get_options(\@options,\@track_types); my $divider = $CONFIG->setting('unit_divider') || 1; my $max_segment = $CONFIG->setting('max segment')*$divider || MAX_SEGMENT; my $session = Bio::Graphics::Browser::PageSettings->new($CONFIG,$id); $session->source($src); my $page_settings = {features=>$visible,tracks=>$labels,id=>$session->id}; # plugin initialization - should be easier my @plugin_path = "$CONF_DIR/plugins"; unshift @plugin_path,shellwords($CONFIG->setting('plugin_path')) if $CONFIG->setting('plugin_path'); $PLUGINS = Bio::Graphics::Browser::PluginSet->new($CONFIG,$page_settings,@plugin_path) unless defined $PLUGINS; $PLUGINS->configure($db,$page_settings,$session); # uploaded files $UPLOADS = Bio::Graphics::Browser::UploadSet->new($CONFIG,$page_settings); $REMOTES = Bio::Graphics::Browser::RemoteSet->new($CONFIG,$page_settings); my ($img,$boxes,$panel,$tracks,$detailed_view); if (@segments > 1 or $show_overview or $segments[0]->length > $max_segment) { # summary view foreach (@segments) { $_->absolute(0) } if (@add_features) { my $list = add_features($labels,undef,\@add_features,\@add_style); @segments = $list->{add}->features; } my $images = $CONFIG->hits_on_overview_raw($db,\@segments,$visible,$hitkey); ($img,$boxes) = consolidate_images($images,$image_class); } else { # detailed view my $segment = $segments[0]; my $feature_list = {}; add_features($labels,$segment,\@add_features,\@add_style,$feature_list) if @add_features; external_features($segment,$feature_list); my $feature_hilighting = make_hilite_callback(\@h_feat); my $region_hilighting = make_postgrid_callback(\@h_region,$segment); ($img,$boxes,$panel,$tracks) = $CONFIG->image_and_map(segment => $segment, tracks => $labels, options => $options, feature_files => $feature_list||undef, label_scale => 1, image_class => $image_class, keystyle => $keystyle, do_map => 1, flip => $flip, noscale => $noscale, $feature_hilighting ? (hilite_callback => $feature_hilighting) : (), $region_hilighting ? (postgrid => $region_hilighting) : (), -truecolor => $CONFIG->setting('truecolor') || 0, -grid => $grid, ); $detailed_view++; } if ($embed) { my $url = $CONFIG->generate_image($img); my ($width,$height) = $img->getBounds; my $img = img({-src=>$url,-align=>'middle',-usemap=>'#hmap',-width=>$width, -height=>$height,-border=>0,-name=>'detailedView',-alt=>'detailed view'}); my $source = $CONFIG->source; my $map; if ($detailed_view) { my $ruler = shift @$boxes; $map = $CONFIG->make_map($boxes,0,$panel,$tracks); my $coords = join ',',@{$ruler}[1,2,3,4]; my $gbrowse = "../../gbrowse/$source/?name=$segments[0]"; # dgg; was "../gbrowse/$source?" my $rect = qq(); $map =~ s!!$rect!; } else { $map = my_make_map($boxes,$source,scalar @add_features); } $map =~ s/href/target="_top" href/g; # add appropriate target tags print_cached ( $newpagecache, header('text/html'),start_html(''),$img,$map,end_html() ); } #elsif ($image_class eq 'GD::SVG') { elsif ($image_class =~ /SVG/) { # This is a kludge to alert users that their system does not have # GD::SVG installed my ($version) = (0); eval { require GD::SVG; $version = $GD::SVG::VERSION; }; if ($@ || ! $version) { message('SVG output from GBrowse requires that the GD::SVG Perl module be installed. Please advise your system administrator of this error.'); } else { print_cached ( $newpagecache, header('image/svg+xml'), $img->svg ); } } elsif ($img->can('png')) { print_cached ( $newpagecache, header('image/png'), $img->png ); } else { print_cached ( $newpagecache, header('image/gif'), $img->gif ); } exit 0; sub message { my @msg = @_; print header(); print start_html, h1('Error'), p(@msg), end_html; exit 0; } sub get_options { my ($options,$track_types) = @_; # get the options my %options = shellwords(@$options); # set the track types to display. my @labels = shellwords(@$track_types); @labels = $CONFIG->default_labels unless @labels; # remove overview tracks @labels = grep {!/:overview$/} @labels; my %visible = map {$_ => {visible=>1}} @labels; return (\%options,\@labels,\%visible); } sub segments { my ($CONFIG,$abs,$landmarks) = @_; my $db = open_database($CONFIG); my $was = $db->absolute($abs) if $db->can('absolute'); my @segments = get_segments($db,@$landmarks); @segments or message("No matching regions found."); if ($abs) { $_->absolute(1) foreach @segments; } $db->absolute($was) if $db->can('absolute'); @segments; } sub get_segments { my ($db,@names) = @_; my @segments; for my $name (@names) { my $wildcard = $name =~ /[*?]/; my @matches = $CONFIG->name2segments($name,$db,undef,!$wildcard); push @segments,@matches; next unless $wildcard; $_->absolute(1) foreach @matches; } @segments; } sub external_features { my ($segment,$feature_file_list) = @_; my $rel2abs = coordinate_mapper($segment); # $DAS_SOURCES->annotate($segment,$feature_file,$rel2abs); for my $featureset ($PLUGINS,$UPLOADS,$REMOTES) { $featureset->annotate($segment,$feature_file_list,$rel2abs); } } sub add_features { my ($labels,$master_segment,$features,$styles,$feature_hash) = @_; my @features = @$features; my @styles = @$styles; my %mappers; my $master_mapper = coordinate_mapper($master_segment) if $master_segment; $mappers{$master_segment->ref} = $master_mapper if $master_mapper; my $feature_list = Bio::Graphics::FeatureFile->new(-smart_features => 1); my $fcount = 0; my $db = open_database($CONFIG); for my $f (@features) { my ($reference,$type,$name,@segments) = parse_feature_str($f); $mappers{$reference} ||= $master_mapper; unless ($mappers{$reference}) { my ($segment) = $CONFIG->name2segments($reference,$db) or next; my ($parent) = $db->segments($segment->abs_ref) or next; $mappers{$reference} = coordinate_mapper($parent) or next; } my ($ref,@parts) = $mappers{$reference}->($reference,@segments); next unless $ref; my $feature = Bio::Graphics::Feature->new( -ref => $ref||'', -type => $type||'', -name => $name||'', -strand => $parts[0][0]<=$parts[0][1] ? +1 : -1, -segments => \@parts ); $feature_list->{'visible'}->{$feature} = 1; $feature_list->add_feature($feature); } push @$labels,'add' unless grep {$_ eq 'add'} @$labels; foreach (@styles) { my ($type,@options) = shellwords($_); my %options = map {split /=/} @options; $feature_list->add_type($type=>\%options); } $feature_hash= {} unless(ref $feature_hash);## dgg; fix missing hash: $feature_hash->{add} = $feature_list; return $feature_hash; # dgg; caller expects valid return } # this generates the callback for highlighting "interesting" features sub make_hilite_callback { my $features = shift; return unless @$features; my %features; for my $f (@$features) { my ($name,$color) = split '@',$f; $color ||= 'yellow'; $features{$name} = $color; } return sub { my $feature = shift; my $color; # if we get here, we select the search term for highlighting return unless $feature->display_name; return $features{$feature->display_name}; } } # this generates the callback for highlighting a region sub make_postgrid_callback { my $h_regions = shift; my $segment = shift; my $ref = $segment->ref; my @h_regions; for my $r (@$h_regions) { my ($h_ref,$h_start,$h_end,$h_color) = $r =~ /^(?:(.+):)?(\d+)\.\.(\d+)(?:@(\S+))?/ or next; $h_ref ||= $ref; next unless $h_ref eq $ref; push @h_regions,[$h_start,$h_end,$h_color||'lightgrey']; } @h_regions or return; return sub { my $gd = shift; my $panel = shift; my $left = $panel->pad_left; my $top = $panel->top; my $bottom = $panel->bottom; for my $r (@h_regions) { my ($h_start,$h_end,$h_color) = @$r; my ($start,$end) = $panel->location2pixel($h_start,$h_end); $gd->filledRectangle($left+$start,$top,$left+$end,$bottom, $panel->translate_color($h_color)); } } } sub consolidate_images { my ($images,$image_class) = @_; my @gds = map {$images->{$_}[1]} sort keys %$images; unless ($gds[0]->can('copy')) { # workaround for GD::SVG my @refs = sort keys %$images; my $first = $images->{$refs[0]}; my ($gd,$boxes) = @{$first}[1,2]; return $gd,$boxes; } my $overall_height = 0; my $max_width = 0; for my $gd (@gds) { my ($width,$height) = $gd->getBounds; $overall_height += $height; $max_width = $width if $max_width < $width; } $overall_height += PANEL_GAP * (@gds-1); my $composite = "$image_class\:\:Image"->new($max_width,$overall_height); $composite->colorAllocate(255,255,255); my @boxes; my $offset = 0; for my $ref (sort keys %$images) { my ($gd,$boxes) = @{$images->{$ref}}[1,2]; my ($width,$height) = $gd->getBounds; $composite->copy($gd,0,$offset,0,0,$width,$height); # fix boxes for my $box (@$boxes) { $box->[2] += $offset; $box->[4] += $offset; $box->[6] = $ref; push @boxes,$box; } $offset += $height + PANEL_GAP; } ($composite,\@boxes); } sub my_make_map { my ($boxes,$source,$add_features) = @_; my $url = "../../gbrowse/$source/"; # dgg; was"../gbrowse/$source"; my $html = qq(\n); foreach (@$boxes){ my $feature = $_->[0]; my $ref = $_->[6]; # consolidate_images() sets this slot my ($refname, $version) = split /\sversion\s/i, $ref; my ($name,$start,$stop) = ($feature->display_id,$feature->start,$feature->end); my $href = $url . "?ref=$refname;start=$start;stop=$stop"; $href .= ";version=$version" if defined $version; $href .= ";add=".join "+",($refname,$feature->type,$feature->name, $feature->can('location_string') ? $feature->location_string : $feature->to_FTstring) if $add_features && $feature->isa('Bio::Graphics::Feature'); $html .= qq(\n); } $html .= "\n"; $html; } # IMPORTANT NOTE: this should be unified with gbrowse::coordinate_mapper() # but note that the two routines do NOT have identical functionality currently. sub coordinate_mapper { my $current_segment = shift or return; my $db = open_database(); my $absolute = $current_segment->absolute; my ($absref,$ref,$start,$stop) = ($current_segment->abs_ref, $current_segment->ref, $current_segment->start,$current_segment->stop); # what is this for? It seems silly # my $class = $absolute ? $current_segment->factory->refclass : $current_segment->class; # $current_segment = $db->segment(-name=>$current_segment->ref,-class=>$class); my %segments; my $closure = sub { my ($refname,@ranges) = @_; unless ($segments{$refname}) { my @segments = map { eval{$_->absolute(0)}; $_ # so that rel2abs works properly later } grep { $current_segment->overlaps($_) } get_segments($db,$refname); return unless @segments; $segments{$refname} = $segments[0]; } my $mapper = $segments{$refname}; my $absref = $mapper->abs_ref; my $ref = $current_segment->ref; my @abs_segs; if ($absref eq $refname) { @abs_segs = @ranges; } else { @abs_segs = map {[$mapper->rel2abs($_->[0],$_->[1])]} @ranges; } return ($mapper->abs_ref,@abs_segs) if $absolute; my $offset = $current_segment->start-1; my @rel_segs = map {[map {$offset + $_} $current_segment->abs2rel($_->[0],$_->[1])]} @abs_segs; # this inhibits mapping outside the displayed region foreach (@rel_segs) { return ($ref,@rel_segs) if $_->[0] <= $stop && $_->[1] >= $start; } return; }; return $closure; } sub dump_sources { print header('text/plain'); print "## Sources\n"; print join "\n",$CONFIG->sources,"\n"; } sub dump_types { print header('text/plain'); print "## Feature types for source ",$CONFIG->source,"\n"; my @labels = $CONFIG->labels; my %default = map {$_=>1} $CONFIG->default_labels; for my $l (@labels) { my $d = $default{$l} ? 'default' : ''; my $key = $CONFIG->setting($l=>'key')||''; print join("\t",$l,$key,$d),"\n"; } } sub infer_landmarks { my ($db,$features) = @_; my %refs; for my $f (@$features) { my ($ref,$type,$name,@segments) = parse_feature_str($f); my ($min,$max) = minmax(\@segments); $refs{$ref}{min} = $min if !defined $refs{$ref}{min} || $refs{$ref}{min} > $min; $refs{$ref}{max} = $max if !defined $refs{$ref}{max} || $refs{$ref}{max} < $max; } return map {"$_:$refs{$_}{min}..$refs{$_}{max}"} keys %refs; } sub minmax { my $segs = shift; my ($min,$max); my @coords = map {@$_} @$segs; for (@coords) { $min = $_ if !defined $min || $min > $_; $max = $_ if !defined $max || $max < $_; } ($min,$max); } sub checkCachedPage { #sub gd_cache_path my ($cache_name,@keys) = @_; my $cachetime= $CONFIG->setting(general=>'image cachetime') || $CONFIG->setting(general=>$cache_name); return unless($cachetime); my $signature = md5_hex(@keys); my ($uri,$path) = $CONFIG->tmpdir($CONFIG->source.'/'.$cache_name); #'cache_overview' $path= "$path/$signature"; #sub gd_cache_check return if param('nocache'); my $cache_file_mtime = (stat($path))[9] || 0; my $conf_file_mtime = $CONFIG->mtime; my $cache_expiry = $cachetime * 60*60; if ($cache_file_mtime && ($cache_file_mtime > $conf_file_mtime) && (time() - $cache_file_mtime < $cache_expiry)) { return ($path,$path); } else { return (undef,$path); # return missing/expired path for writing to } } sub print_cached { my $newpagecache = shift; if ($newpagecache) { if (open(CP,"+>$newpagecache")) { flock(CP,LOCK_EX); print CP @_; seek(CP,0,0); print ; flock(CP,LOCK_UN); close(CP); } } else { print @_; } } sub print_usage { print <<'END';

gbrowse_img - CGI script to generate genome images via the Generic Genome Browser

SYNOPSIS


  <img src="http://www.wormbase.org/db/seq/gbrowse_img/wormbase?name=mec-3;width=400">
Will generate this picture:
<a href="http://www.wormbase.org/db/seq/gbrowse_img?list=sources">list</a>
Will return this document: ## Sources fly yeast wormbase
<a href="http://www.wormbase.org/db/seq/gbrowse_img/wormbase?list=types">types</a>
Will return this document: ## Feature types for source wormbase tRNA tRNAs NG Named Genes default CG Curated genes default PG Predicted genes WABA Briggsae alignments (WABA) ESTB ESTs aligned by BLAT (best) ESTO ESTs aligned by BLAT (other) mRNAB mRNAs aligned by BLAT (best) mRNAO mRNAs aligned by BLAT (other) RNAi RNAi experiments EXPR Expression chip profiles WTP Worm Transcriptome Project genes SNP SNPs TcI Transposon Insertions

DESCRIPTION

This CGI script is an interface to the Generic Genome Browser for the purpose of retrieving dynamic images of a region of the genome. It can be used as the destination of an <img> tag like this:

<img src="http://www.wormbase.org/db/seq/gbrowse_img/wormbase?name=III:1..1000">

The script can also be used to superimpose one or more external features onto the display, for example for the purpose of displaying BLAST hits, an STS or a knockout in the context of the genome.

CGI arguments

The script recognizes the following CGI arguments, which can be passed either as GET or POST argument=value pairs. Argument pairs must be separated by semicolons (preferred) or by ampersands. Many of the options have one-letter aliases that can be used to reduce URL lengths.

ArgumentAliasDescription
name q genomic landmark or range
type t tracks to include in image
width w desired width of image
options o list of track options (compact, labeled, etc)
abs b display position in absolute coordinates
add a added feature(s) to superimpose on the image
style s stylesheet for additional features
keystylek where to place the image key
overview  force an overview-style display
flip f flip image left to right
grid   turn grid on (1) or off (0)
embed   generate full HTML for image and imagemap for use in an embedded frame
format   format for the image (use "SVG" for scaleable vector graphics)
list   get certain types of configuration information
source   database name

The arguments are explained in more detail here

name (Alias: q)
This argument specifies the region of the genome to be displayed. Several forms are recognized:
  • name=Landmark Display the landmark named "Landmark". Valid landmark names include chromosomes, contigs, clones, STSs, predicted genes, and any other landmark that the administrator has designated. Be careful when fetching large landmarks such as whole chromosomes!
  • name=Landmark:start..end Display the region between start and end relative to "Landmark".
  • name=Class:Landmark Display "Landmark", restricting to a particular class, such as "PCR_Product". The list of classes is under the control of the database administrator and is not yet available through this interface.
  • name=Class:Landmark:start..end As above, but restricted to the designated range.
If you use multiple name options, then this script will generate an overview image showing the position of each landmark. The alias "q" can be used to shorten the length of the URL.

type (Alias: t)
This argument lists the feature types to display. The value of this argument is a list of track names separated by spaces ("+" characters when URL-escaped). For example:

      <img src="http://www.wormbase.org/db/seq/gbrowse_img/wormbase?name=mec-3;
                   type=tRNA+NG+WABA+CG+ESTB">
      
Multiple type= arguments will be combined to form a single space-delimited list. The alias "t" can be used to shorten the length of the URL.

If the track name has a space in it, put quotes around the name:

            type="microbe tRNA"+NG+WABA+CG+ESTB
      

width (Alias: w)
Width of the desired image, in pixels.

options (Alias: o)
A space-delimited list ("+" characters when URL-escaped) of mnemonic/option pairs describing how features should be formatted. Options are integers from 0 to 3, where 0=auto, 1=compact, 2=expanded, 3=expanded and labeled. For example, to specify that the tRNA and NG tracks should always be expanded and labeled, but that the WABA track should be compact, use:

      options=tRNA+3+NG+3+WABA+1
      

The alias "o" can be used to shorten the length of the URL.

abs
Use absolute (chromosome) coordinates when displaying the image. An argument of abs=1 will turn on absolute coordinate addressing. An argument of abs=0 will use relative coordinate addressing (this is the default).

add (Alias: a)
Superimpose one or more additional features on top of the view. Features are specified as space ("+") delimited lists in the following format:

      add=Landmark+Type+Name+start..end,start..end,start..end
      
"Landmark" is the landmark name, "Type" is a descriptive type that will be printed in the image caption, "Name" is a name for the feature to be printed above it, and start..end is a comma-delimited list of ranges for discontinuous feature. Names that contain white space must be quoted, for example "BLAST hit". Note that this all has to be URL-escaped, so an additional feature named "Your Sequence", type "Blast Hit", that is located on chromosome III in a gapped range between 20000 and 22000, will be formatted as:

      add=III+%22Blast%20Hit%22+%22Your%20Sequence%22+20000..21000,21550..22000
      

One or both of the type and name can be omitted. If omitted, type will default to "Your Features" and the name will default to "Feature XX" where XX is an integer. This allows for a very simple feature line:

      add=III+20000..21000,21550..22000
      

Multiple add= arguments are allowed. The alias "a" can be used to shorten the length of the URL.

style
The style argument can be used to control the rendering of additional features added with "add". It is a flattened version of the style configuration sections described in this document For example, if you have added a "Blast Hit" annotation, then you can tell the renderer to use a red arrow for this glyph in this way: style=%22Blast%20Hit%22+glyph=arrow+fgcolor=red

keystyle (Alias: k)
Controls the positioning of the track key. One of "right", "left", "between" (default) or "bottom"

overview
Ordinarily the image will show the detail panel if the query region corresponds to a single region, and the overview panel if multiple regions match (or if a region that is too large to show matches). Setting overview=1 will force the overview to be shown in all cases.

flip (Alias: f)
Flip the image left to right. Arguments are 0=don't flip (default), and 1=flip.

embed
Generate image and a corresponding HTML imagemap in a form suitable for embedding into a frame.

format
Specify the format for the image file. Either "GD" (the default) or "GD::SVG" for scaleable vector graphics.

list
If this argument is present, it will cause the script to dump out various types of information in plain text form. Currently the two values for this argument are sources, to dump out the list of data sources, and types, to dump out the list of configured types. For list=sources, the script will return a simple text list of the data source names. For list=types, the script will return a three-column tab-delimited list giving the track names and feature types corresponding to the currently-selected data source. The format is as follows:

      Mnemonic <tab> Full description of feature <tab> [default]
      

The third column contains the word "default" if the track will be shown by default when no type argument is provided.

source
This argument specifies the database for the images. The list of sources can be found using list=sources.

h_feat
The name of a feature to highlight in the format feature_name@color_name". Example:
h_feat=SKT5@blue
You may omit "@color", in which case the highlight will default to yellow. You can specify multiple h_feat arguments in order to highlight several features with distinct colors.
h_region
The name of a region to highlight in a solid background color, in the format sequence_name:start..end@color_name". Example:
h_region=Chr3:200000..250000@wheat
You may omit "@color", in which case the highlighted region will default to lightgrey. You can specify multiple h_region arguments in order to highlight several regions with distinct colors.

Putting it all together, here's a working (very long) URL:

http://www.wormbase.org/db/seq/gbrowse_img/wormbase?name=B0001;add=B0001+pcr+pcr1+20000..333000;add=B0001+%22cool%20knockout%22+kn2+30000..20000,10000..5000;type=add+CG+WTP;style=pcr+glyph=primers;style=%22cool%20knockout%22+glyph=transcript2+bgcolor=orange;abs=1

If you wish to associate the image with an imagemap so that clicking on a feature takes the user to the destination configured in the gbrowse config file, you may do so by placing the URL in an <iframe> section and using the embed=1 flag:

<iframe src="http://localhost/cgi-bin/gbrowse_img/wormbase?name=B0001;embed=1" width="100%" height="250">
   <img src="http://localhost/cgi-bin/gbrowse_img/wormbase?name=B0001"/>
</iframe>

Placing an <img> tag inside the <iframe> tag arranges for older browsers that don't know about iframes to display the static image instead. You may need to adjust the width and height attributes in order to avoid browsers placing scrollbars around the frame.

KNOWN BUGS

The cookie that stores the configuration options for plugins does not transfer from gbrowse to gbrowse_img, so tracks generated by annotation plugins, such as the Restriction site annotator, will not display correctly when the image URL is generated on one machine and then viewed on another. Uploaded files will transfer correctly, however.

AUTHOR

Lincoln Stein lstein@cshl.org

Copyright (c) 2002-2004 Cold Spring Harbor Laboratory

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

For additional help, see The GMOD Project pages. END ; }