GBrowse

 view release on metacpan or  search on metacpan

docs/pod/PLUGINS_HOWTO.pod  view on Meta::CPAN

=head1 NAME

Bio::Graphics::Browser::Plugin -- Base class for gbrowse plugins.

=head1 SYNOPSIS

     package Bio::Graphics::Browser::Plugin::MyPlugin;
     use Bio::Graphics::Browser::Plugin;
     use CGI ':standard';
     @ISA = 'Bio::Graphics::Browser::Plugin';

     # called by gbrowse to return name of plugin for popup menu
     sub name        { 'Example Plugin' }

     # called by gbrowse to return description of plugin
     sub description { 'This is an example plugin' }

     # called by gbrowse to return type of plugin
     sub type        { 'annotator' }

     # called by gbrowse to configure default settings for plugin
     sub config_defaults {
         my $self = shift;
         return {foo => $value1,
                 bar => $value2}
     }

     # called by gbrowse to reconfigure plugin settings based on CGI parameters
     sub reconfigure {
       my $self = shift;
       my $current = $self->configuration;
       $current->{foo} = $self->config_param('foo');
       $current->{bar} = $self->config_param('bar');
     }

     # called by gbrowse to create a <form> fragment for changing settings
     sub configure_form {
       my $self    = shift;
       my $current = $self->configuration;
       my $form = textfield(-name  => $self->config_name('foo'),
                            -value => $current->{foo})
                  .
                  textfield(-name  => $self->config_name('bar'),
                            -value => $current->{bar});
       return $form;
     }

     # called by gbrowse to annotate the DNA, returning features
     sub annotate {
        my $self     = shift;
        my $segment  = shift;
        my $config   = $self->configuration;
        # do something with the sequence segment
        my @features = do_something();
        return \@features;
     }

=head1 DESCRIPTION

This is the base class for Generic Genome Browser plugins. Plugins are
perl .pm files that are stored in the gbrowse.conf/plugins directory.
Plugins are activated in the gbrowse.conf/ configuration file by
including them on the list indicated by the "plugins" setting:

      plugins = BatchDumper FastaDumper GFFDumper
                OligoFinder RestrictionAnnotator

Site-specific plugins may be placed in one or more site-specific
directories and added to the plugin search path using the plugin_path
setting:

      plugin_path = /usr/local/gbrowse_plugins



( run in 0.531 second using v1.01-cache-2.11-cpan-364913b4093 )