GBrowse

 view release on metacpan or  search on metacpan

docs/developer_notes/README.rearchitecture  view on Meta::CPAN

$data_source  = $globals->create_data_source($dsn);

Get the value of an option in a section name ('general' by default):

$setting = $globals->setting('section name' => 'value');

Examples of using setting():

$label = $globals->setting($data_sources[0] => 'description');
$path  = $globals->setting($data_sources[0] => 'path');

Find the new data source based on CGI path information and/our the
'source' parameter. This will return the current source if the
requested new source is invalid.

 $dsn = $globals->update_data_source($session);

The globals file lists all the data sources as well as browser-wide
globals. Some of the globals, such as the stylesheet path, can be
overridden by specific data sources. Others can't. This needs to be
determined on a case-by-case basis and the logic for this should be
embedded in Bio::Graphics::Browser::Render.

To simplify organization, there will be two top-level paths, one for
config files, and one for htdocs files. If any path configs are given
as relative paths, then these top-level paths are used to make them
absolute.

Note that for efficiency's sake, the Bio::Graphics::Browser object may
be cached and reused, provided that its config file hasn't been
updated.

[GENERAL]
# path globals
config base   = /etc/gbrowse
htdocs base   = /var/www/htdocs/gbrowse
stylesheet    = /absolute/path or ./relative/to/docs_base
icons         = /absolute/path or ./relative/to/docs_base
plugins       = /absolute/path or ./relative/to/config_base
languages     = /absolute/path or ./relative/to/config_base

# the default DSN
default source = HUM77

# session globals
session settings = settings

# other globals
max_segment = 5000000
global1 = setting1
global2 = setting2

# subsequent stanzas are data sources
[HUM77]
description  = Human Build 77
path         = /etc/gbrowse/hum77.conf

[MouseV3]
description  = Mouse Test database
path         = /var/htdocs/gbrowse/conf/mouse_test.conf
hide         = 1   # hide from popup menu
restrict     =     ## additional authentication options?

=================================================================

3) Bio::Graphics::Browser::Session

This object is responsible for persistent per-user settings. It is
created by the Bio::Graphics::Browser object based on the session
configuration globals. It has the following methods, all of which are
in the current Bio::Graphics::Browser::PageSettings object:

Create new session from provided arguments:

 $session = Bio::Graphics::Browser::Session->new(@args);

Flush to disk or database:

 $session->flush;

Return per-session ID:

 $id = $session->id;

Retrieve a hash of persistent page settings:

 $session->page_settings;

Get or set the data source DSN:

 $dsn =  $session->source([$new_dsn]);

=================================================================

4) Bio::Graphics::Browser::DataSource

This is the data-source specific configuration. It is identical to the
Bio::Graphics::BrowserConfig package that is currently defined inside
Bio/Graphics/Browser.pm.

It supports the methods:

 labels()
 overview_tracks()
 regionview_tracks()
 karyotype_tracks()
 authorized()
 label2type()
 type2label()
 style()
 semantic_setting()
 semantic_label()
 etc.

Note that for efficiency's sake, the
Bio::Graphics::Browser::DataSource objects may be cached and reused,
provided that their corresponding config files have not been updated.

ADDED 5/4/07 -- I think that the DataSource should be able to manage a
cache of database objects. The syntax is:



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