BioPerl
view release on metacpan or search on metacpan
Bio/DB/GenBank.pm view on Meta::CPAN
);
}
# new is in NCBIHelper
# helper method to get db specific options
=head2 new
Title : new
Usage : $gb = Bio::DB::GenBank->new(@options)
Function: Creates a new genbank handle
Returns : a new Bio::DB::Genbank object
Args : -delay number of seconds to delay between fetches (3s)
NOTE: There are other options that are used internally. By NCBI policy, this
module introduces a 3s delay between fetches. If you are fetching multiple genbank
ids, it is a good idea to use get
=cut
=head2 get_params
Title : get_params
Usage : my %params = $self->get_params($mode)
Function: Returns key,value pairs to be passed to NCBI database
for either 'batch' or 'single' sequence retrieval method
Returns : a key,value pair hash
Args : 'single' or 'batch' mode for retrieval
=cut
sub get_params {
my ($self, $mode) = @_;
return defined $PARAMSTRING{$mode} ?
%{$PARAMSTRING{$mode}} : %{$PARAMSTRING{$DEFAULTMODE}};
}
# from Bio::DB::WebDBSeqI from Bio::DB::RandomAccessI
=head1 Routines Bio::DB::WebDBSeqI from Bio::DB::RandomAccessI
=head2 get_Seq_by_id
Title : get_Seq_by_id
Usage : $seq = $db->get_Seq_by_id('ROA1_HUMAN')
Function: Gets a Bio::Seq object by its name
Returns : a Bio::Seq object
Args : the id (as a string) of a sequence
Throws : "id does not exist" exception
=head2 get_Seq_by_acc
Title : get_Seq_by_acc
Usage : $seq = $db->get_Seq_by_acc($acc);
Function: Gets a Seq object by accession numbers
Returns : a Bio::Seq object
Args : the accession number as a string
Note : For GenBank, this just calls the same code for get_Seq_by_id().
Caveat: this normally works, but in rare cases simply passing the
accession can lead to odd results, possibly due to unsynchronized
NCBI ID servers. Using get_Seq_by_version() is slightly better, but
using the unique identifier (GI) and get_Seq_by_id is the most
consistent
Throws : "id does not exist" exception
=head2 get_Seq_by_gi
Title : get_Seq_by_gi
Usage : $seq = $db->get_Seq_by_gi('405830');
Function: Gets a Bio::Seq object by gi number
Returns : A Bio::Seq object
Args : gi number (as a string)
Throws : "gi does not exist" exception
=head2 get_Seq_by_version
Title : get_Seq_by_version
Usage : $seq = $db->get_Seq_by_version('X77802.1');
Function: Gets a Bio::Seq object by sequence version
Returns : A Bio::Seq object
Args : accession.version (as a string)
Note : Caveat: this normally works, but using the unique identifier (GI) and
get_Seq_by_id is the most consistent
Throws : "acc.version does not exist" exception
=head1 Routines implemented by Bio::DB::NCBIHelper
=head2 get_Stream_by_query
Title : get_Stream_by_query
Usage : $seq = $db->get_Stream_by_query($query);
Function: Retrieves Seq objects from Entrez 'en masse', rather than one
at a time. For large numbers of sequences, this is far superior
than get_Stream_by_[id/acc]().
Example :
Returns : a Bio::SeqIO stream object
Args : $query : An Entrez query string or a
Bio::DB::Query::GenBank object. It is suggested that you
create a Bio::DB::Query::GenBank object and get the entry
count before you fetch a potentially large stream.
=cut
=head2 get_Stream_by_id
Title : get_Stream_by_id
Usage : $stream = $db->get_Stream_by_id( [$uid1, $uid2] );
Function: Gets a series of Seq objects by unique identifiers
Returns : a Bio::SeqIO stream object
Args : $ref : a reference to an array of unique identifiers for
the desired sequence entries
=head2 get_Stream_by_acc
Title : get_Stream_by_acc
Usage : $seq = $db->get_Stream_by_acc([$acc1, $acc2]);
Function: Gets a series of Seq objects by accession numbers
Returns : a Bio::SeqIO stream object
Args : $ref : a reference to an array of accession numbers for
the desired sequence entries
( run in 0.968 second using v1.01-cache-2.11-cpan-39bf76dae61 )