3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
40 .
"dbname=homo_sapiens_core_19_34a;"
43 # $db is a database object
47 # Bio::EnsEMBL::DBLoader->new( $ENV{'ENSEMBL_DATABASE'} );
51 This system provides a
run-time loading of the database
for ensembl,
54 a) Only
"using" the database module which is required
for a
55 particular implementation
57 b) Providing a simple
string method to indicate where the database
58 is, allowing per sites defaults and other things as such
61 The
string is parsed as follows:
63 Before the / is the Perl database
object to load, after are the
64 parameters to pass to that database. The parameters are series of
65 key=values separated by semi-colons. These are passed as a hash to the
66 new method of the database
object
72 package Bio::EnsEMBL::DBLoader;
79 Arg [1] :
string $string
80 An Ensembl database locator
string.
81 Example : Bio::EnsEMBL::DBSQL::DBLoader->new(
"Bio::EnsEMBL::DBSQL::DBAdaptor/host=localhost;dbname=homo_sapiens_core_19_34a;user=ensro;"
82 Description: Connects to an Ensembl database
using the module specified in
84 Returntype : The module specified in the load
string is returned.
85 Exceptions : thrown
if the specified module cannot be instantiated or the
86 locator
string cannot be parsed
93 my ($class,$string) = @_;
96 $string =~ /(\S+?)\/([\S+\s*]+)/ || die
"Could not parse [$string] as a ensembl database locator. Needs database_module/params";
100 &_load_module($module);
101 my @param = split(/;/,$param);
102 foreach my $keyvalue ( @param ) {
103 $keyvalue =~ /(\S+?)=([\S*\s*]*)/ ||
do { warn(
"In loading $keyvalue, could not split into keyvalue for loading $module. Ignoring"); next; };
108 $hash{
"-$key"} = $value;
113 return "$module"->new(%hash);
119 my ($module,$load,$m);
121 $module =
"_<$modulein.pm";
122 $load =
"$modulein.pm";
125 return 1
if $main::{$module};
131 $load: cannot be found