Skip to content
Snippets Groups Projects
Commit dbd88e32 authored by Ian Longden's avatar Ian Longden
Browse files

dnadb taken out of dbconnection

parent 8cfc4d03
No related branches found
No related tags found
No related merge requests found
......@@ -67,7 +67,11 @@ my $reg = "Bio::EnsEMBL::Registry";
-driver => 'mysql' );
Exmaple2 : $db = new Bio::EnsEMBL::DBSQL::DBAdaptor(
-species => 'Homo_sapiens',
-group => 'core');
-group => 'core'
-user => 'root',
-dbname => 'pog',
-host => 'caldy',
-driver => 'mysql');
Description: Constructor for DBAdaptor.
Returntype : Bio::EnsEMBL::DBSQL::DBAdaptor
Exceptions : none
......@@ -88,6 +92,7 @@ sub new {
rearrange([qw(SPECIES GROUP DBCONN DNADB)], @args);
if(defined($con)){
$self->dbc($con);
}
else{
......@@ -104,7 +109,7 @@ sub new {
$self->group($group);
}
Bio::EnsEMBL::Utils::ConfigRegistry::gen_load($self);
$self = Bio::EnsEMBL::Utils::ConfigRegistry::gen_load($self);
if(defined $dnadb) {
$self->dnadb($dnadb);
......@@ -113,35 +118,35 @@ sub new {
return $self;
}
=head2 new_fast
#=head2 new_fast
Arg [-CON]: Bio::EnsEMBL::DBSQL::DBConnection
# Arg [-CON]: Bio::EnsEMBL::DBSQL::DBConnection
Exmaple : $db = new Bio::EnsEMBL::DBSQL::DBAdaptor( -con => $dbc);
Description: Constructor for DBAdaptor.
Returntype : Bio::EnsEMBL::DBSQL::DBAdaptor
Exceptions : none
Caller : general
# Exmaple : $db = new Bio::EnsEMBL::DBSQL::DBAdaptor( -con => $dbc);
# Description: Constructor for DBAdaptor.
# Returntype : Bio::EnsEMBL::DBSQL::DBAdaptor
# Exceptions : none
# Caller : general
=cut
#=cut
sub new_fast{
my($class, @args) = @_;
my ( $con ) = rearrange([qw(CON)],@args);
#sub new_fast{
# my($class, @args) = @_;
# my ( $con ) = rearrange([qw(CON)],@args);
#call superclass constructor
my $self ={};
bless $self,$class;
unless($con && ref $con &&
$con->isa('Bio::EnsEMBL::DBSQL::DBConnection')) {
throw("$con passed is not of type Bio::EnsEMBL::DBSQL::DBConnection");
}
$self->dbc($con);
$self->species($con->species());
$self->group($con->group());
# #call superclass constructor
# my $self ={};
# bless $self,$class;
# unless($con && ref $con &&
# $con->isa('Bio::EnsEMBL::DBSQL::DBConnection')) {
# throw("$con passed is not of type Bio::EnsEMBL::DBSQL::DBConnection");
# }
# $self->dbc($con);
# $self->species($con->species());
# $self->group($con->group());
return $self;
}
# return $self;
#}
sub new_merged{
......@@ -171,10 +176,18 @@ sub new_merged{
=cut
sub dbc{
my ($self, $arg ) = @_;
( defined $arg ) &&
( $self->{_dbc} = $arg );
$self->{_dbc};
my $self = shift;
if(@_){
my $arg = shift;
if(defined($arg)){
if(!$arg->isa('Bio::EnsEMBL::DBSQL::DBConnection')){
throw("$arg is no a DBConnection\n");
}
}
$self->{_dbc} = $arg;
}
return $self->{_dbc};
}
=head2 db
......
......@@ -84,19 +84,12 @@ use Bio::EnsEMBL::Utils::Argument qw(rearrange);
which would otherwise keep open a lot of connections to the
database. Database connections are automatically reopened
when required.
Arg [DNADB] : (optional) Bio::EnsEMBL::DBSQL::DBConnection
The dbconnection to get the dna from.
Arg [SPECIES]: (optional) string
Name of the species to be labelled as.
Arg [GROUP]: (optional) string
Name of the group to be labelled as. (e.g. core, estgene, vega etc)
Example : $dbc = Bio::EnsEMBL::DBSQL::DBConnection->new
(-user => 'anonymous',
-dbname => 'homo_sapiens_core_20_34c',
-host => 'ensembldb.ensembl.org',
-driver => 'mysql'
-species => 'Homo Sapiens',
-group => 'core');
-driver => 'mysql');
Description: Constructor for a DatabaseConenction. Any adaptors that require
database connectivity should inherit from this class.
......@@ -111,16 +104,15 @@ use Bio::EnsEMBL::Utils::Argument qw(rearrange);
sub new {
my $class = shift;
my ($db,$host,$driver,$user,$password,$port, $inactive_disconnect, $dbconn, $dnadb) =
my ($db,$host,$driver,$user,$password,$port, $inactive_disconnect, $dbconn) =
rearrange([qw(DBNAME HOST DRIVER USER PASS PORT
DISCONNECT_WHEN_INACTIVE DBCONN DNADB)], @_);
DISCONNECT_WHEN_INACTIVE DBCONN )], @_);
my $self = {};
bless $self, $class;
if($dbconn) {
if($db || $host || $driver || $password || $port || $inactive_disconnect
|| $dnadb) {
if($db || $host || $driver || $password || $port || $inactive_disconnect) {
throw("Cannot specify other arguments when -DBCONN argument used.");
}
......@@ -183,9 +175,9 @@ sub new {
}
if(defined $dnadb) {
$self->dnadb($dnadb);
}
# if(defined $dnadb) {
# $self->dnadb($dnadb);
# }
return $self;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment