Skip to content

Commit

Permalink
more progress on the inside side of Render; passes all regression tes…
Browse files Browse the repository at this point in the history
…ts; work on Render::HTML needs to start
  • Loading branch information
lstein committed Feb 14, 2007
1 parent 06ab714 commit 3a24ac2
Show file tree
Hide file tree
Showing 12 changed files with 595 additions and 71 deletions.
4 changes: 2 additions & 2 deletions cgi-bin/gbrowse_img.PLS
Expand Up @@ -45,7 +45,7 @@ print OUT "use lib '$OPTIONS{LIB}';\n" if defined $OPTIONS{LIB};
# In the following, perl variables are not expanded during extraction.

print OUT <<'!NO!SUBS!';
# $Id: gbrowse_img.PLS,v 1.30 2005-12-09 22:19:09 mwz444 Exp $
# $Id: gbrowse_img.PLS,v 1.31 2007-02-14 23:54:39 lstein Exp $
use strict;
use CGI qw(param redirect header start_html end_html
Expand Down Expand Up @@ -269,7 +269,7 @@ elsif ($image_class =~ /SVG/) {
} else {
print_cached (
$newpagecache,
header('image/svg-xml'),
header('image/svg+xml'),
$img->svg
);
}
Expand Down
18 changes: 18 additions & 0 deletions conf/plugins/TestFinder.pm
@@ -0,0 +1,18 @@
package Bio::Graphics::Browser::Plugin::TestFinder;

use strict;
use warnings;
use base 'Bio::Graphics::Browser::Plugin';

sub name { 'TypeFinder'}

# return all objects of type 'motif'
sub find {
my $self = shift;
my $db = $self->database;
my $query = $self->page_settings->{name} or return;
my @features = $db->features(-type=>$query);
return \@features;
}

1;
26 changes: 11 additions & 15 deletions lib/Bio/Graphics/Browser/Plugin.pm
@@ -1,5 +1,5 @@
package Bio::Graphics::Browser::Plugin;
# $Id: Plugin.pm,v 1.14 2006-08-21 15:36:32 sheldon_mckay Exp $
# $Id: Plugin.pm,v 1.15 2007-02-14 23:54:39 lstein Exp $
# base class for plugins for the Generic Genome Browser

=head1 NAME
Expand Down Expand Up @@ -382,21 +382,18 @@ described in this section.
=over 4
=item $features = $self->find($segment);
=item $features = $self->find();
The find() method will be passed a Bio::Das::SegmentI segment object,
as described earlier for the dump() method. Your code should search
the segment for features of interest, and return an arrayref of
Bio::SeqFeatureI objects (see L<Bio::SeqFeatureI>). These synthetic
feature objects should indicate the position, name and type of the
features found.
The find() method is called to search for features of interest. It
should return an arrayref of Bio::SeqFeatureI objects (see
L<Bio::SeqFeatureI>). These synthetic feature objects should indicate
the position, name and type of the features found.
Depending on the type of find you are performing, you might search the
preexisting features on the segment for matches, or create your own
features from scratch in the way that the annotator plugins do. You
may choose to ignore the passed segment and perform the search on the
entire database, which you can obtain using the database() method
call.
Depending on the type of find you are performing, you might search for
preexisting features on the currently named segment for matches, or
create your own features from scratch in the way that the annotator
plugins do. In most cases you'll do the search on the entire
database, which you can obtain using the database() method call.
To create features from scratch I suggest you use either
Bio::Graphics::Feature, or Bio::SeqFeature::Generic to generate the
Expand All @@ -412,7 +409,6 @@ case, a gene ontology term:
sub find {
my $self = shift;
my $segment = shift; # we ignore this!
my $config = $self->configuration;
my $query = $config->{query} or return undef; # PROMPT FOR INPUT
my $database = $self->database;
Expand Down
6 changes: 3 additions & 3 deletions libnew/Bio/Graphics/Browser.pm
@@ -1,5 +1,5 @@
package Bio::Graphics::Browser;
# $Id: Browser.pm,v 1.3 2007-01-05 22:34:04 lstein Exp $
# $Id: Browser.pm,v 1.4 2007-02-14 23:54:39 lstein Exp $
# Globals and utilities for GBrowse and friends

use strict;
Expand Down Expand Up @@ -137,7 +137,7 @@ sub url_fetch_max_size { shift->setting(general=>'url_fetch_max_size') }
sub session_driver { shift->setting(general=>'session driver') || 'driver:file;serializer:default' }
sub session_args {
my $self = shift;
my %args = shellwords($self->setting(general=>'session_args'));
my %args = shellwords($self->setting(general=>'session args'));
return \%args if %args;
my ($url,$path) = $self->tmpdir('sessions');
return {Directory=>$path};
Expand Down Expand Up @@ -204,7 +204,7 @@ sub update_data_source {
}

## methods for dealing with the session
sub new_session {
sub session {
my $self = shift;
my $id = shift;
return Bio::Graphics::Browser::Session->new($self->session_driver,
Expand Down
12 changes: 12 additions & 0 deletions libnew/Bio/Graphics/Browser/DataSource.pm
Expand Up @@ -367,4 +367,16 @@ sub make_link {
croak "Do not call make_link() on the DataSource. Call it on the Render object";
}

# this is an aggregator-aware way of retrieving all the named types
sub _all_types {
my $self = shift;
my $db = shift;
return $self->{_all_types} if exists $self->{_all_types}; # memoize
my %types = map {$_=>1} (
(map {$_->get_method} eval {$db->aggregators}),
(map {$self->label2type($_)} $self->labels)
);
return $self->{_all_types} = \%types;
}

1;

0 comments on commit 3a24ac2

Please sign in to comment.