Bio::EnsEMBL::ExternalData::GO GOAdaptor
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
HaplotypeAdaptor - DESCRIPTION of Object
  GO database interface.
Package variables
Privates (from "my" definitions)
$reg = "Bio::EnsEMBL::Registry"
Included modules
Bio::Annotation::DBLink
Bio::DBLinkContainerI
Bio::EnsEMBL::Registry
Bio::EnsEMBL::Root
Bio::EnsEMBL::Utils::Argument qw ( rearrange )
Bio::Root::Object
DBI
GO::AppHandle
Inherit
Bio::EnsEMBL::Root GO::AppHandle
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
AUTOLOADdescriptionprevnextTop
sub AUTOLOAD {
  my $self = shift;
  my @args = @_;
  (my $function = $AUTOLOAD) =~ s/.*:://;
  #print STDERR "Autoloading: $function via ", $self->_db_handle, "\n";
my $return; eval { no strict 'vars'; $return = $self->_db_handle->$function(@args); }; return $return; } # retrieve a GO accession using an accession ID (GO::NNNNNNN)
}
DESTROYdescriptionprevnextTop
sub DESTROY {
   my ($self) = @_;
   if( $self->{'_db_handle'} ) {
       $self->{'_db_handle'}->disconnect;
       $self->{'_db_handle'} = undef;
   }
}

1;
}
_db_handledescriptionprevnextTop
sub _db_handle {
  my ($self,$value) = @_;
  if( defined $value) {$self->{'_db_handle'} = $value;}
  return $self->{'_db_handle'};
}
_ensdbdescriptionprevnextTop
sub _ensdb {
  my ($self,$value) = @_;
  if( defined $value) {$self->{'_ensdb'} = $value;}
  
  return $self->{'_ensdb'};
}

# get/set handle on GO adaptor
}
adaptordescriptionprevnextTop
sub adaptor {
  my ($self,$value) = @_;
  if( defined $value) {
    $self->{'_adaptor'} = $value;
  }
  return $self->{'_adaptor'};
}

# set/get handle on GO database
}
dbdescriptionprevnextTop
sub db {
  my $self = shift;
  return $self;
}
dbnamedescriptionprevnextTop
sub dbname {
  my ($self, $arg ) = @_;
  ( defined $arg ) &&
    ( $self->{_dbname} = $arg );
  $self->{_dbname};
}
driverdescriptionprevnextTop
sub driver {
  my($self, $arg ) = @_;

  (defined $arg) &&
    ($self->{_driver} = $arg );
  return $self->{_driver};
}
fetch_GO_by_accessiondescriptionprevnextTop
sub fetch_GO_by_accession {
    my ($self,$value) = @_;
    my $term = $self->_db_handle->get_term({acc=>$value});
    
}

# set/get handle on ensembl database
}
groupdescriptionprevnextTop
sub group {
  my ($self, $arg) = @_;

  (defined $arg) && 
    ($self->{_group} = $arg );
  return $self->{_group};
}
hostdescriptionprevnextTop
sub host {
  my ($self, $arg ) = @_;
  ( defined $arg ) &&
    ( $self->{_host} = $arg );
  $self->{_host};
}


# evil....
}
newdescriptionprevnextTop
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; # success - we hope!
}
portdescriptionprevnextTop
sub port {
  my ($self, $arg) = @_;

  (defined $arg) && 
    ($self->{_port} = $arg );
  return $self->{_port};
}
speciesdescriptionprevnextTop
sub species {
  my ($self, $arg) = @_;

  (defined $arg) && 
    ($self->{_species} = $arg );
  return $self->{_species};
}
General documentation
CONTACTTop
 Tony Cox <avc@sanger.ac.uk>
APPENDIXTop
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _