Skip to content

Commit

Permalink
* Fixed "no overloaded magic in Bio::DAS::Segment" error.
Browse files Browse the repository at this point in the history
* Made Menus and tabbed section labels larger (if you don't like, 
    edit htdocs/css/dropdown/default-theme.css).

* Moved track table into its own tabbed section.

* TrackFinder plugin now hilights the matches in the track table.
  • Loading branch information
lstein committed May 25, 2010
1 parent 78c689a commit 465327f
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 43 deletions.
4 changes: 4 additions & 0 deletions Changes
Expand Up @@ -5,6 +5,10 @@
* Fixed various bugs in the processing of SAM and BAM files.
* BAM parser now creates BigWig indexes if library is available.
* Fixed "no overloaded magic in Bio::DAS::Segment" error.
* Made Menus and tabbed section labels larger (if you don't like,
edit htdocs/css/dropdown/default-theme.css).
* Moved track table into its own tabbed section.
* TrackFinder plugin now hilights the matches in the track table.

2.08 Thu May 20 22:46:13 EDT 2010
* Added the ability to control the toggle state of each category and subcategory at
Expand Down
7 changes: 4 additions & 3 deletions TODO
@@ -1,12 +1,13 @@
* Fix all /gbrowse2 hard-coded instances.
* Document the REST API; in particular the action=list and action=scan commands.
* DAS Server support.
* Download underlying track data via single click on track title.
* Bring internationalization support up to date.
* Support for BigWig and remote BAM files.
* Share tracks via a LOCAL link rather than through gff3 bottleneck.
* Automatically load datasource .conf files from a special directory
* Turn off show/hide toggles for any section.
* Rewrite subtrack selection to allow subtracks to appear as a
separate selectable/sortable table.
* Introduce the idea of a sort order among subtracks.
* Put track selection table into a separate tab.

$Id: TODO,v 1.15 2006-12-02 21:34:26 lstein Exp $

2 changes: 2 additions & 0 deletions conf/languages/POSIX.pm
Expand Up @@ -149,6 +149,8 @@ END

TRACKS => 'Tracks',

SELECT_TRACKS => 'Select Tracks',

TRACK_SELECT => 'Search for Specific Tracks',

TRACK_NAME => 'Track name',
Expand Down
7 changes: 7 additions & 0 deletions conf/plugins/TrackFinder.pm
Expand Up @@ -83,6 +83,13 @@ sub filter_tracks {
return @result;
}

sub hilite_terms {
my $self = shift;
my $config = $self->configuration;
my @keywords = map {quotemeta($_)} shellwords $config->{keywords};
return @keywords;
}

1;

__END__
Expand Down
3 changes: 2 additions & 1 deletion htdocs/css/dropdown/default_theme.css
Expand Up @@ -64,7 +64,7 @@ ul.dropdown {
border-color: #f0f0f0 #666 #666 #f0f0f0;
background-color: #fff;
font-weight: bold;
font-size: 12px;
font-size: 14px;
}

ul.dropdown ul li {
Expand All @@ -79,6 +79,7 @@ ul.dropdown {


ul.dropdown *.dir {
font-size: 14px;
padding-right: 25px;
background-image: url(images/nav-arrow-down.png);
background-position: 95% 50%;
Expand Down
4 changes: 2 additions & 2 deletions htdocs/css/gbrowse_warm.css
Expand Up @@ -41,7 +41,7 @@ BODY { background-color: #F7FBFF;
.tabmenu_active { cursor: pointer;
color: black;
background-color: beige;
font-size: 10pt;
font-size: 11pt;
font-weight: bold;
font-family: sans-serif;
padding-top: 5px;
Expand All @@ -56,7 +56,7 @@ BODY { background-color: #F7FBFF;
}
.tabmenu_inactive { cursor: pointer;
color: blue;
font-size: 10pt;
font-size: 11pt;
background-color: transparent;
font-weight: bold;
font-family: sans-serif;
Expand Down
2 changes: 1 addition & 1 deletion htdocs/js/controller.js
Expand Up @@ -982,7 +982,7 @@ var Controller = new GBrowseController; // singleton
function initialize_page() {

// These statements initialize the tabbing
Controller.tabs = new TabbedSection(['main_page','custom_tracks_page','settings_page']);
Controller.tabs = new TabbedSection(['main_page','track_page','custom_tracks_page','settings_page']);

//event handlers
[page_title_id,visible_span_id,galaxy_form_id,search_form_objects_id].each(function(el) {
Expand Down
9 changes: 9 additions & 0 deletions lib/Bio/Graphics/Browser2/Plugin.pm
Expand Up @@ -601,6 +601,10 @@ configuration form methods with calls to the javascript routine
doPluginUpdate(). This causes GBrowse to update the plugin's
configuration and refresh the tracks table as a side effect.
=item @terms = $plugin->hilite_terms
Returns a list of terms to hilight in the tracks table, or empty if none.
=back
=head2 METHODS TO BE IMPLEMENTED IN FEATURE HILITERS
Expand Down Expand Up @@ -907,6 +911,11 @@ sub filter_tracks {
return @$tracks; # pass 'em all through
}

sub hilite_terms {
my $self = shift;
return;
}

sub pkg {
my $self = shift;
my $class = ref $self or return;
Expand Down
27 changes: 19 additions & 8 deletions lib/Bio/Graphics/Browser2/Render.pm
Expand Up @@ -706,24 +706,23 @@ sub render_body {

if ($region->feature_count > 1) {
$main_page .= $self->render_multiple_choices($features,$self->state->{name});
$main_page .= $self->render_toggle_track_table;
$main_page .= $self->render_select_track_link;
}

elsif (my $seg = $region->seg) {
$main_page .= $self->render_panels($seg,{overview => $source->show_section('overview'),
regionview => $source->show_section('region'),
detailview => $source->show_section('detail')});
$main_page .= $self->render_toggle_track_table;
$main_page .= $self->render_galaxy_form($seg);
}
else {
$main_page .= $self->render_toggle_track_table;
} else {
$main_page .= $self->render_select_track_link;
}

my $tracks = $self->render_tracks_section;
my $upload_share = $self->render_upload_share_section;
my $global_config = $self->render_global_config;

$output .= $self->render_tabbed_pages($main_page,$upload_share,$global_config);
$output .= $self->render_tabbed_pages($main_page,$tracks,$upload_share,$global_config);
$output .= $self->render_bottom($features);

$output .= $self->render_login_section;
Expand Down Expand Up @@ -754,6 +753,15 @@ sub render_login_section {
return $output;
}

sub render_select_track_link {
croak "implement in subclass";
}

sub render_tracks_section {
my $self = shift;
return $self->render_toggle_track_table;
}

sub render_upload_share_section {
croak "implement in subclass";
}
Expand Down Expand Up @@ -898,9 +906,12 @@ sub render_panels {
div({ -id => 'detail_panels', -class => 'track'},
$details_msg,
$scale_bar_html,
$panels_html
$panels_html,
),
div({-style=>'text-align:center'},
$clear_hilites,
$self->render_select_track_link
),
div({-style=>'text-align:right'},$clear_hilites),
div($self->html_frag('html4',$self->state))
)
) . $drag_script;
Expand Down
97 changes: 69 additions & 28 deletions lib/Bio/Graphics/Browser2/Render/HTML.pm
Expand Up @@ -74,19 +74,22 @@ sub render_error_div {

sub render_tabbed_pages {
my $self = shift;
my ($main_html,$custom_tracks_html,$settings_html) = @_;
my ($main_html,$tracks_html,$custom_tracks_html,$settings_html) = @_;
my $main_title = $self->tr('MAIN_PAGE');
my $tracks_title = $self->tr('SELECT_TRACKS');
my $custom_tracks_title = $self->tr('CUSTOM_TRACKS_PAGE');
my $settings_title = $self->tr('SETTINGS_PAGE');

my $html = '';
$html .= div({-id=>'tabbed_section', -class=>'tabbed'},
div({-id=>'tabbed_menu',-class=>'tabmenu'},
span({id=>'main_page_select'}, $main_title),
span({id=>'main_page_select'}, $main_title),
span({id=>'track_page_select'}, $tracks_title),
span({id=>'custom_tracks_page_select'},$custom_tracks_title),
span({id=>'settings_page_select'},$settings_title)
span({id=>'settings_page_select'}, $settings_title)
),
div({-id=>'main_page', -class=>'tabbody'}, $main_html),
div({-id=>'track_page', -class=>'tabbody'}, $tracks_html),
div({-id=>'custom_tracks_page',-class=>'tabbody'}, $custom_tracks_html),
div({-id=>'settings_page', -class=>'tabbody'}, $settings_html)
);
Expand Down Expand Up @@ -777,11 +780,14 @@ sub render_toggle_track_table {
my $self = shift;
my $html;

$html .= div({-style=>'font-weight:bold'},'<<',$self->render_select_browser_link('link'));

if (my $filter = $self->track_filter_plugin) {
$html .= $self->toggle({tight=>1},'track_select',div({class=>'searchtitle',
style=>"text-indent:2em;padding-top:8px"},$self->render_track_filter($filter)));
}
$html .= $self->toggle('Tracks',$self->render_track_table);
$html .= div({-style=>'text-align:center'},$self->render_select_browser_link('button'));

return $html;
}
Expand All @@ -803,6 +809,14 @@ sub render_track_table {

warn "potential tracks = @labels" if DEBUG;

my ($filter_active,@hilite);
if (my $filter = $self->track_filter_plugin) {
$filter_active++;
eval {@labels = $filter->filter_tracks(\@labels,$source)};
eval {@hilite = $filter->hilite_terms};
warn $@ if $@;
}

# add citation link and markup
my %labels;
for my $label (@labels) {
Expand All @@ -811,42 +825,41 @@ sub render_track_table {
if ($label =~ /^plugin:/) {
$labels{$label} = $key;
next;
}
}
elsif ($label =~ /^file:/){
$link = "?Download%20File=$key";
}
}
else {
$link = "?display_citation=$label";#;source=" . $settings->{source};
my $cit_txt = citation( $source, $label, $self->language ) || '';
if ( length $cit_txt > 100) {
$cit_txt =~ s/\<[^\>]+\>//g; # truncate and strip tags for preview
$cit_txt =~ s/(.{100}).+/$1/;
$cit_txt =~ s/\s+\S+$//;
$cit_txt =~ s/\'/\&\#39;/g;
$cit_txt =~ s/\"/\&\#34;/g;
$cit_txt .= '... <i>Click for more</i>';
}
$mouseover = "<b>$key</b>";
$mouseover .= ": $cit_txt" if $cit_txt;
}
$cit_txt =~ s/\<[^\>]+\>//g; # truncate and strip tags for preview
$cit_txt =~ s/(.{100}).+/$1/;
$cit_txt =~ s/\s+\S+$//;
$cit_txt =~ s/\'/\&\#39;/g;
$cit_txt =~ s/\"/\&\#34;/g;
$cit_txt .= '... <i>Click for more</i>';
}
$mouseover = "<b>$key</b>";
$mouseover .= ": $cit_txt" if $cit_txt;
}

my $balloon = $source->setting('balloon style') || 'GBubble';
my $balloon = $source->setting('balloon style') || 'GBubble';

my @args = ( -href => $link, -target => 'citation');
push @args, -style => 'Font-style: italic' if $label =~ /^(http|ftp|file):/;
push @args, -onmouseover => "$balloon.showTooltip(event,'$mouseover')" if $mouseover;
my @args = ( -href => $link, -target => 'citation');
push @args, -style => 'Font-style: italic' if $label =~ /^(http|ftp|file):/;
push @args, -onmouseover => "$balloon.showTooltip(event,'$mouseover')" if $mouseover;

# add hilighting if requested
for my $h (@hilite) {
$key =~ s!($h)!<span style="background-color:yellow">$1</span>!gi;
}

$labels{$label} = a({@args},$key);
$labels{$label} = a({@args},$key);
}

#my %labels = map {$_ => $self->label2key($_)} @labels;
my @defaults = grep {$settings->{features}{$_}{visible} } @labels;

if (my $filter = $self->track_filter_plugin) {
eval {@labels = $filter->filter_tracks(\@labels,$source)};
warn $@ if $@;
}

# Sort the tracks into categories:
# Overview tracks
# Region tracks
Expand Down Expand Up @@ -916,8 +929,10 @@ sub render_track_table {
-override => 1,
);
$table = $self->tableize(\@checkboxes,$category);
my $visible = exists $settings->{section_visible}{$id}
? $settings->{section_visible}{$id} : $c_default;
my $visible = $filter_active ? 1
: exists $settings->{section_visible}{$id}
? $settings->{section_visible}{$id}
: $c_default;

my ($control,$section)=$self->toggle_section({on=>$visible,nodiv => 1},
$id,
Expand Down Expand Up @@ -1192,6 +1207,32 @@ sub clear_highlights {
$self->tr('CLEAR_HIGHLIGHTING'));
}

sub render_select_track_link {
my $self = shift;
my $title = $self->tr('SELECT_TRACKS');
return button({-name=>$title,
-onClick => "Controller.select_tab('track_page')"
}
);

}
sub render_select_browser_link {
my $self = shift;
my $style = shift || 'button';

my $title = $self->tr('BACK_TO_BROWSER');
if ($style eq 'button') {
return button({-name=>$title,
-onClick => "Controller.select_tab('main_page')"
}
);
} elsif ($style eq 'link') {
return a({-href=>'javascript:void(0)',
-onClick => "Controller.select_tab('main_page')"},
$title);
}
}

sub render_upload_share_section {
my $self = shift;
return $self->is_admin
Expand Down

0 comments on commit 465327f

Please sign in to comment.