Bio::EnsEMBL::DBSQL MergedAdaptor
SummaryPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Bio::EnsEMBL::DBSQL::MergedAdaptor
Package variables
Privates (from "my" definitions)
$reg = "Bio::EnsEMBL::Registry"
Included modules
Bio::EnsEMBL::Registry
Bio::EnsEMBL::Utils::Argument qw ( rearrange )
Bio::EnsEMBL::Utils::Exception qw ( throw warning deprecate )
Synopsis
  $merged_adaptor = new Bio::EnsEMBL::DBSQL::MergedAdaptor(
-species => "human",
-type => "Population"
);
Description
The MergedAdaptor object is merely a list of adaptors. AUTOLOAD is used
to call a subroutine on each adaptor and merge the results.
Methods
AUTOLOAD
No description
Code
DESTROY
No description
Code
add_adaptorDescriptionCode
add_listDescriptionCode
newDescriptionCode
printit
No description
Code
Methods description
add_adaptorcode    nextTop
  Example    : $MergedAdaptor->add_adaptor(@adaptors);
Description: adds an adaptor to the Merged adaptor list.
Returntype : none
Exceptions : none
Status : At Risk
: Under development
add_listcodeprevnextTop
  Example    : $MergedAdaptor->add_list(@adaptors);
Description: adds a list of adaptors to the Merged adaptor list.
Returntype : none
Exceptions : none
Status : At Risk
: Under development
newcodeprevnextTop
  Example      : $MergedAdaptor = new 
: Bio::EnsEMBL::DBSQL::MergedAdaptor(-species=> 'human', -type =>'Population', -groups => ['Sanger','Ensembl']);
Arg [SPECIES]: (optional) string
species name to get adaptors for
Arg [TYPE] : (optional) string
type to get adaptors for
Arg [GROUPS] : (optional) ref to list
Description: Creates a new MergedAdaptor Returntype : Bio::EnsEMBL::DBSQL::MergedAdaptor Exceptions : throws if species or type not specified Caller : general Status : At Risk : Under development
Methods code
AUTOLOADdescriptionprevnextTop
sub AUTOLOAD {
  my ($self,@args) = @_;
  my @array_return=();
  my $ref_return = undef;
  $AUTOLOAD =~ /^.*::(\w+)+$/ ;

  my $sub = $1;

  foreach my $adaptor (@{$self->{'list'}}) {
    my $ref;
    if($adaptor->can($sub)){
      $ref = $adaptor->$sub(@args);
      if( ref($ref) eq 'ARRAY' ) {
        push @array_return, @{$ref};
      } else {
        push @array_return, $ref;
      }
    }
    else{ # end of can
warn("In Merged Adaptor $adaptor cannot call sub $sub"); } } return\@ array_return;
}
DESTROYdescriptionprevnextTop
sub DESTROY {
}

1;
}
add_adaptordescriptionprevnextTop
sub add_adaptor {
  my ($self,$adaptor)=@_;

  if(!defined ($self->{'list'})){
    my @list =();
    push(@list,$adaptor);
    $self->{'list'}=\@ list;
  }
  else{
    push(@{$self->{'list'}},$adaptor);
  }
}
add_listdescriptionprevnextTop
sub add_list {
  my ($self, @arr) = @_;

  foreach my $adap (@arr){
    $self->add_adaptor($adap);
  }
}
newdescriptionprevnextTop
sub new {
  my ($class,@args) = @_;

  my $self ={};
  bless $self,$class;

  my ($species, $type, $groups) =
    rearrange([qw(SPECIES TYPE GROUPS)], @args);

  if(!defined($species)|| !defined($type)){
    die "Species and Type must be specified\n";
  }

  my @adaps;
  if (!defined ($groups)){
      #get all adaptors for that species and type
@adaps = @{$reg->get_all_adaptors(-species => $species, -type => $type)}; } else{ #get only specified adaptors for the particular groups
foreach my $group (@{$groups}){ push @adaps, $reg->get_adaptor($species,$group,$type); } } my @list =(); push(@list,@adaps); $self->{'list'}=\@ list; return $self;
}
printitdescriptionprevnextTop
sub printit {
  my ($self)=@_;

  foreach my $adaptor (@{$self->{'list'}}){
    print "printit $adaptor\t".$adaptor->db->group()."\n";
  }
}


use vars '$AUTOLOAD';
}
General documentation
LICENSETop
  Copyright (c) 1999-2009 The European Bioinformatics Institute and
Genome Research Limited. All rights reserved.
This software is distributed under a modified Apache license. For license details, please see /info/about/code_licence.html
CONTACTTop
  Please email comments or questions to the public Ensembl
developers list at <ensembl-dev@ebi.ac.uk>.
Questions may also be sent to the Ensembl help desk at <helpdesk@ensembl.org>.