Bio::DB::SoapEUtilities FetchAdaptor
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvs
Summary
Bio::DB::SoapEUtilities::FetchAdaptor - Conversion of Entrez SOAP messages to BioPerl objects
Package variables
No package variables defined.
Included modules
Bio::Root::Root
Inherit
Bio::Root::Root
Synopsis
 $fac = Bio::DB::SoapEUtilities->new();
$soap_result = $fac->efetch( -db => 'protein', -id => 2597988 );
$adp = Bio::DB::SoapEUtilities::FetchAdaptor(
-result => $soap_result,
-type => 'seq'
);
while ( $gb_seq = $adp->next_obj ) {
# do stuff
}
Description
FetchAdaptor is the base class of a system, modeled after
Bio::SeqIO, to parse SOAP responses from the NCBI Entrez efetch
utility into germane BioPerl objects.
The user will rarely need to instantiate a FetchAdaptor with
Bio::DB::SoapEUtilities::Result object as in the /SYNOPSIS. It
usually suffices to use the -auto_adapt parameter in the factory
run() method:
 my $fac = Bio::DB::SoapEUtilities->new();
my $taxio = $fac->efetch(-db => 'taxonomy', -id => 1394)->run(-auto_adapt=>1);
my $sp = $taxio->next_species; # Bio::Species objects
my $seqio = $fac->efetch(-db => 'protein', -id => 730439)->run(-auto_adapt=>1);
my $seq = $seqio->next_seq; # Bio::Seq::RichSeq objects
Methods
newDescriptionCode
_initializeDescriptionCode
_load_adaptorDescriptionCode
obj_classDescriptionCode
next_objDescriptionCode
rewindDescriptionCode
resultDescriptionCode
typeDescriptionCode
Methods description
newcode    nextTop
 Title   : new
Usage : my $obj = new Bio::DB::SoapEUtilities::FetchAdaptor();
Function: Builds a new Bio::DB::SoapEUtilities::FetchAdaptor object
Returns : an instance of Bio::DB::SoapEUtilities::FetchAdaptor
Args : named arguments
-som => $soap_som_object (soap message)
-type => $type ( optional, forces loading of $type adaptor )
_initialize()codeprevnextTop
 Title   : _initialize
Usage :
Function:
Returns :
Args :
_load_adaptor()codeprevnextTop
 Title   : _load_adaptor
Usage :
Function: loads a FetchAdaptor subclass
Returns :
Args : adaptor type (subclass name)
obj_class()codeprevnextTop
 Title   : obj_class
Usage : $adaptor->obj_class
Function: Returns the fully qualified BioPerl classname
of the objects returned by next_obj()
Returns : scalar string (class name)
Args : none
next_obj()codeprevnextTop
 Title   : next_obj
Usage : $obj = $adaptor->next_obj
Function: Returns the next parsed BioPerl object from the
adaptor
Returns : object of class obj_class()
Args : none
rewind()codeprevnextTop
 Title   : rewind
Usage :
Function: Rewind the adaptor's iterator
Returns :
Args : none
result()codeprevnextTop
 Title   : result
Usage :
Function: contains the SoapEUtilities::Result object
Returns : Bio::DB::SoapEUtilities::Result object
Args : none
type()codeprevnextTop
 Title   : type
Usage :
Function: contains the fetch type of this adaptor
Returns :
Args :
Methods code
newdescriptionprevnextTop
sub new {
    my ($class,@args) = @_;
    $class = ref($class) || $class;
    if ($class =~ /.*?::FetchAdaptor::(\S+)/) {
	my $self = $class->SUPER::new(@args);
	$self->_initialize(@args);
	return $self;
    }
    else {
	my %args = @args;
	my $result = $args{'-result'} || $args{'-RESULT'};
	$class->throw("Bio::DB::SoapEUtilities::Result argument required") unless $result;
	$class->throw("RESULT argument must be a Bio::DB::SoapEUtilities::Result object") unless
	ref($result) eq 'Bio::DB::SoapEUtilities::Result';
	# identify the correct adaptor module to load using Result info
my $type ||= $result->fetch_type; $class->throw("Can't determine fetch type for this result") unless $type; # $type ultimately contains a FetchAdaptor subclass
return unless( $class->_load_adaptor($type, $result) ); return "Bio::DB::SoapEUtilities::FetchAdaptor::$type"->new(@args); }
}
_initializedescriptionprevnextTop
sub _initialize {
    my $self = shift;
    my @args = @_;
    my ($result, $type) = $self->_rearrange([qw( RESULT TYPE )], @args);
    $self->throw("Bio::DB::SoapEUtilities::Result argument required") unless $result;
    $self->throw("RESULT argument must be a Bio::DB::SoapEUtilities::Result object") unless
	ref($result) eq 'Bio::DB::SoapEUtilities::Result';
    $self->{'_type'} = $type || $result->fetch_type;
    $self->{'_result'} = $result;
    1;
}
_load_adaptordescriptionprevnextTop
sub _load_adaptor {
    my ($class, $type, $result) = @_;
    return unless $type;
    # specials
for ($result->fetch_type) { $_ eq 'seq' && do { $_[1] = $type = 'species' if $result->fetch_db and $result->fetch_db eq 'taxonomy'; last; }; # else, leave $type alone
} my $module = "Bio::DB::SoapEUtilities::FetchAdaptor::".$type; my $ok; eval { $ok = $class->_load_module($module); }; for ($@) { /^$/ && do { return $ok; }; /Can't locate/ && do { $class->throw("Fetch adaptor for '$type' not found"); }; do { # else
$class->throw("Error in fetch adaptor for '$type' : $@"); }; }
}
obj_classdescriptionprevnextTop
sub obj_class {
 shift->throw_not_implemented
}
next_objdescriptionprevnextTop
sub next_obj {
 shift->throw_not_implemented
}
rewinddescriptionprevnextTop
sub rewind {
 shift->throw_not_implemented
}
resultdescriptionprevnextTop
sub result {
 shift->{'_result'}
}
typedescriptionprevnextTop
sub type {
 shift->{'_type'}
}
General documentation
SEE ALSOTop
Bio::DB::SoapEUtilities, FetchAdaptor subclasses
FEEDBACKTop
Mailing ListsTop
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to
the Bioperl mailing list. Your participation is much appreciated.
  bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
SupportTop
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.org
rather than to the module maintainer directly. Many experienced and
reponsive experts will be able look at the problem and quickly
address it. Please include a thorough description of the problem
with code and data examples if at all possible.
Reporting BugsTop
Report bugs to the Bioperl bug tracking system to help us keep track
of the bugs and their resolution. Bug reports can be submitted via
the web:
  http://redmine.open-bio.org/projects/bioperl/
AUTHOR - Mark A. JensenTop
Email maj -at- fortinbras -dot- us
APPENDIXTop
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _