Bio::EnsEMBL::ExternalData::GO
GOAdaptor
Toolbar
Summary
HaplotypeAdaptor - DESCRIPTION of Object
GO database interface.
Package variables
Privates (from "my" definitions)
$reg = "Bio::EnsEMBL::Registry"
Included modules
Inherit
Synopsis
use Bio::EnsEMBL::DBSQL::DBAdaptor;
use Bio::EnsEMBL::ExternalData::GO::GOAdaptor;
$hapdb = Bio::EnsEMBL::DBSQL::DBAdaptor->new(
-user => 'ensro',
-dbname => 'haplotype_5_28',
-host => 'ecs3d',
-driver => 'mysql',
);
my $go_adtor = Bio::EnsEMBL::ExternalData::GO::GOAdaptor->new($godb);
my $term = $go_adtor->get_term({acc=>"GO:0005509"});
printf
"GO term; name=%s GO ID=%s\n\n",
$term->name(), $term->public_acc();
### You can add the GOAdaptor as an 'external adaptor' to the 'main'
### Ensembl database object, then use it as:
$ensdb = Bio::EnsEMBL::DBSQL::DBAdaptor->new( ... );
$ensdb->add_ExternalAdaptor('go', $go_adtor);
# then later on, elsewhere:
$go_adtor = $ensdb->get_ExternalAdaptor('go');
# also available:
$ensdb->list_ExternalAdaptors();
$ensdb->remove_ExternalAdaptor('go');
Description
This module is an entry point into a GO database.
The objects can only be read from the database, not written. (They are
loaded ussing a separate perl script).
For more info, see GO::AppHandle.pm
Methods
AUTOLOAD | No description | Code |
DESTROY | No description | Code |
_db_handle | No description | Code |
_ensdb | No description | Code |
adaptor | No description | Code |
db | No description | Code |
dbname | No description | Code |
driver | No description | Code |
fetch_GO_by_accession | No description | Code |
group | No description | Code |
host | No description | Code |
new | No description | Code |
port | No description | Code |
species | No description | Code |
Methods description
None available.
Methods code
sub AUTOLOAD
{ my $self = shift;
my @args = @_;
(my $function = $AUTOLOAD) =~ s/.*:://;
my $return;
eval {
no strict 'vars';
$return = $self->_db_handle->$function(@args);
};
return $return;
}
} |
sub DESTROY
{
my ($self) = @_;
if( $self->{'_db_handle'} ) {
$self->{'_db_handle'}->disconnect;
$self->{'_db_handle'} = undef;
}
}
1; } |
sub _db_handle
{
my ($self,$value) = @_;
if( defined $value) {$self->{'_db_handle'} = $value;}
return $self->{'_db_handle'}; } |
sub _ensdb
{
my ($self,$value) = @_;
if( defined $value) {$self->{'_ensdb'} = $value;}
return $self->{'_ensdb'};
}
} |
sub adaptor
{
my ($self,$value) = @_;
if( defined $value) {
$self->{'_adaptor'} = $value;
}
return $self->{'_adaptor'};
}
} |
sub db
{ my $self = shift;
return $self; } |
sub dbname
{ my ($self, $arg ) = @_;
( defined $arg ) &&
( $self->{_dbname} = $arg );
$self->{_dbname}; } |
sub driver
{ my($self, $arg ) = @_;
(defined $arg) &&
($self->{_driver} = $arg );
return $self->{_driver}; } |
sub fetch_GO_by_accession
{
my ($self,$value) = @_;
my $term = $self->_db_handle->get_term({acc=>$value});
}
} |
sub group
{ my ($self, $arg) = @_;
(defined $arg) &&
($self->{_group} = $arg );
return $self->{_group}; } |
sub host
{ my ($self, $arg ) = @_;
( defined $arg ) &&
( $self->{_host} = $arg );
$self->{_host};
}
} |
sub new
{ my($class,@args) = @_;
my $group = "go";
my $self = {};
bless $self, $class;
my ($db,$user,$pass,$host,$port,$driver,$species) =
rearrange([qw(
DBNAME
USER
PASS
HOST
PORT
DRIVER
SPECIES
)],@args);
if(!defined($species)){
$species = "MULTI";
}
if(defined($reg->get_alias($species,"no throw"))){
my $adap = $reg->get_DBAdaptor($species,$group);
if(defined($adap)){
return $adap;
}
}
if( ! $driver ) {
$driver = 'mysql';
}
if( ! $host ) {
$host = 'localhost';
}
if (! $port ) {
$port = 3306;
}
if(! $pass ) { $pass =''; }
my $dbh ; eval { $dbh= GO::AppHandle->connect(-dbname=>$db,-dbhost=>"$host:$port",-dbuser=>$user,($pass?(-dbauth=>$pass):())); };
throw("Could not connect to database $db user $user as a locator ($@)") unless $dbh;
$self->_db_handle($dbh);
$self->dbname($db);
$self->port($port);
$self->host($host);
$self->driver($driver);
$self->group($group);
$self->species($species);
$reg->add_DBAdaptor($species, $group, $self);
return $self;
} |
sub port
{ my ($self, $arg) = @_;
(defined $arg) &&
($self->{_port} = $arg );
return $self->{_port}; } |
sub species
{ my ($self, $arg) = @_;
(defined $arg) &&
($self->{_species} = $arg );
return $self->{_species}; } |
General documentation
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _