Bio::DB::SoapEUtilities::FetchAdaptor
species
Toolbar
Summary
Bio::DB::SoapEUtilities::FetchAdaptor::species - Fetch adaptor for
'taxonomy' efetch SOAP messages
Package variables
No package variables defined.
Included modules
Bio::Root::Root
Bio::Species
Inherit
Synopsis
Description
Returns an iterator over
Bio::Species objects:
my $fac = Bio::DB::SoapEUtilities->new;
my $taxio = $fac->efetch(-db => 'taxonomy', -id => 1394)->run(-auto_adapt=>1);
my $sp = $taxio->next_species;
$sp->binomial; # returns 'Bacillus caldolyticus'
To find out the object type returned:
$class = $seqio->obj_class; # $class is 'Bio::Species'
as for all
Bio::DB::SoapEUtilities::FetchAdaptor objects.
Methods
| _initialize | No description | Code |
| obj_class | No description | Code |
| next_species | No description | Code |
| next_obj | No description | Code |
| _read_species | No description | Code |
Methods description
None available.
Methods code
sub _initialize
{ my ($self, @args) = @_;
$self->SUPER::_initialize(@args);
$self->{'_obj_class'} = 'Bio::Species' ;
$self->{'_idx'} = 1;
1;} |
sub obj_class
{ shift->{'_obj_class'}} |
sub next_species
{ shift->next_obj } |
sub next_obj
{ my $self = shift;
my $stem = "//TaxaSet/[".$self->{'_idx'}."]";
my $som = $self->result->som;
return unless defined $som->valueof($stem);
my $get = sub { $som->valueof("$stem/".shift) };
my $toplev = $som->valueof("$stem");
my $get_tl = sub { $toplev->{ shift @_ } };
my $sp = _read_species($get_tl);
$self->warn("FetchAdaptor::species - parse error, no Bio::Species returned") unless $sp;
($self->{_idx})++;
return $sp;
}
1;
} |
| _read_species | description | prev | next | Top |
sub _read_species
{ my ($get) = @_;
my @unkn_names = ('other', 'unknown organism', 'not specified', 'not shown',
'Unspecified', 'Unknown', 'None', 'unclassified',
'unidentified organism', 'not supplied');
my @unkn_genus = ('unknown','unclassified','uncultured','unidentified');
my( $sub_species, $species, $genus, $sci_name, $common,
$abbr_name, $organelle);
$sci_name = $get->('ScientificName') || return;
my @class = split(/; /, $get->('Lineage'));
my $possible_genus = quotemeta($class[-1])
. ($class[-2] ? "|" . quotemeta($class[-2]) : '');
if ($sci_name =~ /^($possible_genus)/) {
$genus = $1;
($species) = $sci_name =~ /^$genus\s+(.+)/;
}
else {
$species = $sci_name;
}
if ($species && $species =~ /subsp\.|var\./) {
($species, $sub_species) = $species =~ /(.+)\s+((?:subsp\.|var\.).+)/;
}
my $src = $get->('ScientificName');
return unless ($species || $genus) and
!grep { $_ eq $src } @unkn_names;
push(@class, $sci_name);
@class = reverse @class;
my $make = Bio::Species->new();
$make->scientific_name($sci_name);
$make->classification(@class) if @class > 0;
$make->common_name( $get->('CommonName'));
$make->name('abbreviated', $abbr_name) if $abbr_name;
$make->organelle($organelle) if $organelle;
$make->ncbi_taxid( $get->('TaxId') );
$make->division( $get->('Division') );
return $make;
}
1;} |
General documentation
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
Please direct usage questions or support issues to the mailing list:
bioperl-l@bioperl.orgrather 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.
| AUTHOR - Mark A. Jensen | Top |
Email maj -at- fortinbras -dot- us
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _