Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
  • 3 commits
  • 7 files changed
  • 0 commit comments
  • 1 contributor
View
161 cgi-bin/gbrowse_details
@@ -266,91 +266,94 @@ sub print_features {
"Length",
$f->length);
- if ($f->can('hit') && (my $hit = $f->hit)) {
- # try to correct for common GFF2 error of indicating a -/- alignment
- # using a (-) src strand and a hit_start > hit_end
- my $bug = $f->strand < 0 && $f->hit->strand < 0;
+ eval {
+ local $^W = 0;
+ if ($f->can('hit') && (my $hit = $f->hit)) {
+ # try to correct for common GFF2 error of indicating a -/- alignment
+ # using a (-) src strand and a hit_start > hit_end
+ my $bug = $f->strand < 0 && $f->hit->strand < 0;
+ $string .= $self->print_multiple($f,
+ $options,
+ 'Query',
+ $hit->seq_id);
+ $string .= $self->print_multiple(
+ $f->hit,
+ $options,
+ 'Matches',
+ $hit->seq_id.':'.$hit->start.'..'.$hit->end.
+ ($hit->strand >= 0 ? ' (+)':' (-)')
+ );
+ $string .= $self->print_multiple($f,
+ $options,
+ '',
+ $self->print_matches($f,$hit,$bug));# if $subf;
+
+ }
+
$string .= $self->print_multiple($f,
- $options,
- 'Query',
- $hit->seq_id);
- $string .= $self->print_multiple(
- $f->hit,
- $options,
- 'Matches',
- $hit->seq_id.':'.$hit->start.'..'.$hit->end.
- ($hit->strand >= 0 ? ' (+)':' (-)')
+ $options,
+ "Score",
+ $f->score) if $f->can('score') && defined $f->score;
+
+ my %attributes = $f->attributes if $f->can('attributes');
+
+ for my $a (sort grep {!/Hit/} keys %attributes) {
+ $string .= $self->print_multiple($f,
+ $options,
+ $a,
+ $f->attributes($a));
+ }
+
+ $string .= $self->print_multiple($f,
+ $options,
+ 'primary_id',
+ $f->primary_id) if $f->can('primary_id');
+
+ $string .= $self->print_multiple($f,
+ $options,
+ 'gbrowse_dbid',
+ $f->gbrowse_dbid) if $f->can('gbrowse_dbid');
+
+ $string .= TR({-valign=>'top',-class=>'databody'},
+ th({-height=>3},''),
+ td({-height=>3},'')
);
- $string .= $self->print_multiple($f,
- $options,
- '',
- $self->print_matches($f,$hit,$bug));# if $subf;
- }
-
- $string .= $self->print_multiple($f,
- $options,
- "Score",
- $f->score) if $f->can('score') && defined $f->score;
-
- my %attributes = $f->attributes if $f->can('attributes');
-
- for my $a (sort grep {!/Hit/} keys %attributes) {
- $string .= $self->print_multiple($f,
- $options,
- $a,
- $f->attributes($a));
- }
-
- $string .= $self->print_multiple($f,
- $options,
- 'primary_id',
- $f->primary_id) if $f->can('primary_id');
-
- $string .= $self->print_multiple($f,
- $options,
- 'gbrowse_dbid',
- $f->gbrowse_dbid) if $f->can('gbrowse_dbid');
+ # try to sort features with hits so that hit is in order.
+ # But, subfeatures don't always have the hit, so check for
+ # that too
+ my @subfeatures = $f->get_SeqFeatures;
+ if ($f->can('hit') && $f->hit && $subfeatures[0] && $subfeatures[0]->hit) {
+ @subfeatures = sort {$a->hit->start <=> $b->hit->start} @subfeatures;
+ } else {
+ @subfeatures = sort {$a->start <=> $b->start} @subfeatures;
+ }
+
+ my $subtable = $self->print_multiple($f,
+ $options,
+ 'Parts',
+ $self->print_features(\@subfeatures,$subf+1)
+ ) if @subfeatures;
- $string .= TR({-valign=>'top',-class=>'databody'},
- th({-height=>3},''),
- td({-height=>3},'')
- );
+ $string .= $subtable || ''; # prevent uninit variable warning
+ $string .= CGI::end_table();
- # try to sort features with hits so that hit is in order.
- # But, subfeatures don't always have the hit, so check for
- # that too
- my @subfeatures = $f->get_SeqFeatures;
- if ($f->can('hit') && $f->hit && $subfeatures[0] && $subfeatures[0]->hit) {
- @subfeatures = sort {$a->hit->start <=> $b->hit->start} @subfeatures;
- } else {
- @subfeatures = sort {$a->start <=> $b->start} @subfeatures;
+ if ($subtable or $subf==0) {
+ if ($f->length > MAX_DNA) {
+ $string .= "<b><i>Sequence display limited to ".MAX_DNA." bases</i></b>";
+ } else {
+ my $dna = $self->get_seq($f);
+ $dna = $dna->seq if ref $dna; # compensate for API changes
+ $string .= $self->print_dna($f,
+ $dna,
+ $f->start,
+ $f->strand,
+ \@subfeatures,
+ $subf+1) if $dna;
+ }
+ }
}
-
- my $subtable = $self->print_multiple($f,
- $options,
- 'Parts',
- $self->print_features(\@subfeatures,$subf+1)
- ) if @subfeatures;
-
- $string .= $subtable || ''; # prevent uninit variable warning
- $string .= CGI::end_table();
-
- if ($subtable or $subf==0) {
- if ($f->length > MAX_DNA) {
- $string .= "<b><i>Sequence display limited to ".MAX_DNA." bases</i></b>";
- } else {
- my $dna = $self->get_seq($f);
- $dna = $dna->seq if ref $dna; # compensate for API changes
- $string .= $self->print_dna($f,
- $dna,
- $f->start,
- $f->strand,
- \@subfeatures,
- $subf+1) if $dna;
- }
- }
- }
+ }
return $string;
}
View
2  htdocs/js/controller.js
@@ -730,7 +730,7 @@ var GBrowseController = Class.create({
Controller.get_remaining_tracks(track_keys,time_out*decay,decay,time_key)
} ,time_out);
} else {
- var area = $$('area');
+ var area = $$('area[inline!=1]');
area.invoke('observe', 'mousedown', Controller.feature_callback);
area.invoke('observe', 'mouseover', Controller.feature_callback);
Controller.idle();
View
10 lib/Bio/Graphics/Browser2/Action.pm
@@ -674,17 +674,17 @@ sub ACTION_autocomplete_user_search {
sub ACTION_get_feature_info {
my $self = shift;
my $q = shift;
- my $etype = CGI::unescape($q->param('event_type')) or croak;
- my $track = CGI::unescape($q->param('track')) or croak;
- my $dbid = CGI::unescape($q->param('dbid')) or croak;
- my $fid = CGI::unescape($q->param('feature_id')) or croak;
+ defined(my $etype = CGI::unescape($q->param('event_type'))) or croak;
+ defined(my $track = CGI::unescape($q->param('track'))) or croak;
+ defined(my $dbid = CGI::unescape($q->param('dbid'))) or croak;
+ defined(my $fid = CGI::unescape($q->param('feature_id'))) or croak;
+ $fid or return (204,'text/plain','nothing at all');
my $state = $self->state;
local $state->{dbid} = $dbid;
my $search = $self->render->get_search_object();
my $features = $search->search_features({-name=>"id:$fid"});
return (204,'text/plain','nothing at all') unless @$features;
my ($mime_type,$payload) = $self->render->feature_interaction($etype,$track,$features->[0]);
- warn "$mime_type => $payload";
return (200,$mime_type,$payload);
}
View
16 lib/Bio/Graphics/Browser2/DataSource.pm
@@ -1342,7 +1342,23 @@ sub get_section_from_label {
return 'region';
}
return 'detail'
+}
+
+=head2 $boolean = $source->use_inline_imagemap($label=>$length)
+
+Given a track label and length (for semantic zooming) return true
+if we should generate an inline clickable imagemap vs one in which
+the actions are generated by Ajax callbacks
+=cut
+
+sub use_inline_imagemap {
+ my $self = shift;
+ my ($label,$length) = @_;
+ my $inline = $self->semantic_fallback_setting($label=>'inline imagemaps',$length);
+ return $inline if defined $inline;
+ my $db = $self->open_database($label,$length) or return 1;
+ return !$db->can('get_feature_by_id');
}
1;
View
1  lib/Bio/Graphics/Browser2/Region.pm
@@ -198,7 +198,6 @@ sub get_whole_segment {
sub search_db {
my $self = shift;
my $args = shift;
- warn join ' ',%$args;
my ($features);
if (my $name = $args->{-search_term}) {
$name =~ tr/a-zA-Z0-9|.'"_*?: ;+-\/\#\[\]//cd; # remove rude/naughty characters
View
40 lib/Bio/Graphics/Browser2/Render.pm
@@ -4265,10 +4265,10 @@ sub snapshot_manager {
sub feature_interaction {
my $self = shift;
my ($event_type,$label,$feature) = @_;
- warn "$event_type, $label, $feature";
my $source = $self->data_source;
my $settings = $self->state;
- my $tips = $source->global_setting('balloon tips') && $settings->{'show_tooltips'};
+ my $tips = $source->global_setting('balloon tips') && $settings->{'show_tooltips'};
+ my $renderer = $self->get_panel_renderer($self->segment);
if ($tips) {
my $sticky = $source->setting($label,'balloon sticky');
@@ -4277,7 +4277,7 @@ sub feature_interaction {
my $stick = defined $sticky ? $sticky : $event_type eq 'mousedown';
$stick ||= 0;
my ($balloon_style,$balloon_action)
- = $self->balloon_tip_setting($event_type eq 'mousedown' ? 'balloon click' : 'balloon hover',$label,$feature);
+ = $renderer->balloon_tip_setting($event_type eq 'mousedown' ? 'balloon click' : 'balloon hover',$label,$feature,undef,undef);
$balloon_action ||= $renderer->make_title($feature,undef,$label,undef)
if $source->global_setting('titles are balloons') && $event_type eq 'mouseover';
$balloon_style ||= 'GBubble';
@@ -4292,45 +4292,11 @@ sub feature_interaction {
}
}
- my $renderer = $self->get_panel_renderer($self->segment);
-
my $link = $renderer->make_link($feature,undef,$label,undef);
my $target = $renderer->make_link_target($feature,undef,$label,undef);
return ('text/plain',$target ? "window.open('$link','$target')" : "document.location='$link'") if $link;
return;
}
-sub balloon_tip_setting {
- my $self = shift;
- my ($option,$label,$feature) = @_;
- my $length = eval{$self->segment->length}||0;
- $option ||= 'balloon tip';
- my $source = $self->data_source;
- my $value = $source->semantic_setting($label=>$option,$length||0);
- $value = $source->code_setting('TRACK DEFAULTS' => $option) unless defined $value;
- $value = $source->code_setting('general' => $option) unless defined $value;
-
- return unless $value;
- my $val;
- my $balloon_type = $source->global_setting('balloon style') || 'GBubble';
-
- if (ref($value) eq 'CODE') {
- $val = eval {$value->($feature)};
- $source->_callback_complain($label=>$option) if $@;
- } else {
- $val = $source->link_pattern($value,$feature);
- }
-
- if ($val=~ /^\s*\[([\w\s]+)\]\s+(.+)/s) {
- $balloon_type = $1;
- $val = $2;
- }
- # escape quotes
- $val =~ s/'/\\'/g;
- $val =~ s/"/&quot;/g;
-
- return ($balloon_type,$val);
-}
-
sub tr {
my $self = shift;
my $lang = $self->language or return @_;
View
60 lib/Bio/Graphics/Browser2/RenderPanels.pm
@@ -1175,8 +1175,9 @@ sub make_map {
my $source = $self->source;
- my $flip = $panel->flip;
- my $length = $self->segment->length;
+ my $length = $self->segment->length;
+ my $settings = $self->settings;
+ my $flip = $panel->flip;
my ($track_dbid) = $source->db_settings($label,$length);
my $did_map;
@@ -1187,21 +1188,32 @@ sub make_map {
push @map, $self->make_centering_map(shift @$boxes,$flip,0,$first_box_is_scale);
}
+ return if $source->show_summary($label,$length,$settings);
my $inline = $source->use_inline_imagemap($label,$length);
+ warn "inline = $inline";
+ my $inline_options = {};
+ if ($inline) {
+ $inline_options = {tips => $source->global_setting('balloon tips') && $settings->{'show_tooltips'},
+ use_titles_for_balloons => $source->global_setting('titles are balloons'),
+ balloon_style => $source->global_setting('balloon style') || 'GBubble',
+ balloon_sticky => $source->semantic_fallback_setting($label,'balloon sticky',$length),
+ balloon_height => $source->semantic_fallback_setting($label,'balloon height',$length) || 300,
+ }
+ }
foreach my $box (@$boxes){
my $feature = $box->[0];
next unless $feature->can('primary_tag');
- my $attributes = $inline ? $self->make_imagemap_element_inline($feature,$panel,$label,$box->[5])
- : $self->make_imagemap_element_callback($feature);
+ my $attributes = $inline ? $self->make_imagemap_element_inline($feature,$panel,$label,$box->[5],$inline_options)
+ : $self->make_imagemap_element_callback($feature,$track_dbid);
$attributes or next;
my $fname = eval {$feature->display_name} || eval{$box->[0]->name} || 'unnamed';
my $ftype = $feature->primary_tag || 'feature';
$ftype = "$ftype:$fname";
my $line = join("\t",$ftype,@{$box}[1..4]);
- for my $att (keys %attributes) {
- next unless defined $attributes{$att} && length $attributes{$att};
- $line .= "\t$att\t$attributes{$att}";
+ for my $att (keys %$attributes) {
+ next unless defined $attributes->{$att} && length $attributes->{$att};
+ $line .= "\t$att\t$attributes->{$att}";
}
push @map, $line;
}
@@ -1210,9 +1222,8 @@ sub make_map {
sub make_imagemap_element_callback {
my $self = shift;
- my $feature = shift;
+ my ($feature,$dbid) = @_;
my $id = eval {CGI::escape($feature->primary_id || $feature->name)} or return;
- my $dbid = $track_dbid;
return {
dbid => $dbid,
fid => $id,
@@ -1222,30 +1233,30 @@ sub make_imagemap_element_callback {
sub make_imagemap_element_inline {
my $self = shift;
- my ($feature,$panel,$label,$box5) = @_;
+ my ($feature,$panel,$label,$track,$options) = @_;
+ my $tips = $options->{tips};
+ my $use_titles_for_balloons = $options->{use_titles_for_balloons};
+ my $balloon_style = $options->{balloon_style};
+ my $sticky = $options->{balloon_sticky};
+ my $height = $options->{balloon_height};
- my $href = $self->make_link($feature,$panel,$label,$box5);
- my $title = unescape($self->make_title($feature,$panel,$label,$box5));
- my $target = $self->make_link_target($feature,$panel,$label,$box5);
+ my $source = $self->source;
+ my $href = $self->make_link($feature,$panel,$label,$track);
+ my $title = unescape($self->make_title($feature,$panel,$label,$track));
+ my $target = $self->make_link_target($feature,$panel,$label,$track);
my ($mouseover,$mousedown,$style);
- if ($tips) {
+ if ($tips) {
#retrieve the content of the balloon from configuration files
# if it looks like a URL, we treat it as a URL.
my ($balloon_ht,$balloonhover) =
- $self->balloon_tip_setting('balloon hover',$label,$feature,$panel,$box5);
+ $self->balloon_tip_setting('balloon hover',$label,$feature,$panel,$track);
my ($balloon_ct,$balloonclick) =
- $self->balloon_tip_setting('balloon click',$label,$feature,$panel,$box5);
-
- my $sticky = $source->setting($label,'balloon sticky');
- my $height = $source->setting($label,'balloon height') || 300;
-
- if ($use_titles_for_balloons) {
- $balloonhover ||= $title;
- }
+ $self->balloon_tip_setting('balloon click',$label,$feature,$panel,$track);
- $balloon_ht ||= $source->global_setting('balloon style') || 'GBubble';
+ $balloonhover ||= $title if $use_titles_for_balloons;
+ $balloon_ht ||= $balloon_style;
$balloon_ct ||= $balloon_ht;
if ($balloonhover) {
@@ -1279,6 +1290,7 @@ sub make_imagemap_element_inline {
onmouseover => $mouseover,
onmousedown => $mousedown,
style => $style,
+ inline => 1,
);
return \%attributes;

No commit comments for this range

Something went wrong with that request. Please try again.