BioPerl
view release on metacpan or search on metacpan
Bio/DB/SwissProt.pm view on Meta::CPAN
In order to make changes transparent we have host type (currently only
expasy) and location (default to Switzerland) separated out. This
allows the user to pick the closest Expasy mirror for running their
queries.
=head1 FEEDBACK
=head2 Mailing Lists
User feedback is an integral part of the evolution of this and other
Bioperl modules. Send your comments and suggestions preferably to one
of the Bioperl mailing lists. Your participation is much appreciated.
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
=head2 Support
Please direct usage questions or support issues to the mailing list:
I<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.
=head2 Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track
the bugs and their resolution. Bug reports can be submitted via the
web:
https://github.com/bioperl/bioperl-live/issues
=head1 AUTHOR - Jason Stajich
Email Jason Stajich E<lt>jason@bioperl.org E<lt>
Thanks go to Alexandre Gattiker E<lt>gattiker@isb-sib.chE<gt> of Swiss
Institute of Bioinformatics for helping point us in the direction of
the correct expasy scripts and for swissknife references.
Also thanks to Heikki Lehvaslaiho E<lt>heikki-at-bioperl-dot-orgE<gt>
for help with adding EBI swall server.
=head1 APPENDIX
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _
=cut
# Let the code begin...
package Bio::DB::SwissProt;
use strict;
use HTTP::Request::Common;
our $MODVERSION = '0.8.1';
use base qw(Bio::DB::WebDBSeqI);
# global vars
our $DEFAULTSERVERTYPE = 'ebi';
our $DEFAULTFORMAT = 'swissprot';
# our $DEFAULTIDTRACKER = 'http://www.expasy.ch';
# you can add your own here theoretically.
our %HOSTS = (
'expasy' => {
'default' => 'us',
'baseurl' => 'http://%s/cgi-bin/sprot-retrieve-list.pl',
'hosts' =>
{
'switzerland' => 'ch.expasy.org',
'canada' => 'ca.expasy.org',
'china' => 'cn.expasy.org',
'taiwan' => 'tw.expasy.org',
'australia' => 'au.expasy.org',
'korea' => 'kr.expasy.org',
'us' => 'us.expasy.org',
},
# ick, CGI variables
'jointype' => ' ',
'idvar' => 'list',
'basevars' => [ ],
},
'ebi' => {
'default' => 'uk',
'baseurl' => 'http://%s/Tools/dbfetch/dbfetch',
'hosts' => {
'uk' => 'www.ebi.ac.uk',
},
'jointype' => ',',
'idvar' => 'id',
'basevars' => [ 'db' => 'UniProtKB',
'style' => 'raw' ],
}
);
our %ID_MAPPING_DATABASES = map {$_ => 1} qw(
ACC+ID ACC ID UPARC NF50 NF90 NF100 EMBL_ID EMBL PIR UNIGENE_ID P_ENTREZGENEID
P_GI P_IPI P_REFSEQ_AC PDB_ID DISPROT_ID HSSP_ID DIP_ID MEROPS_ID PEROXIBASE_ID
PPTASEDB_ID REBASE_ID TCDB_ID 2DBASE_ECOLI_ID AARHUS_GHENT_2DPAGE_ID
ANU_2DPAGE_ID DOSAC_COBS_2DPAGE_ID ECO2DBASE_ID WORLD_2DPAGE_ID ENSEMBL_ID
ENSEMBL_PRO_ID ENSEMBL_TRS_ID P_ENTREZGENEID GENOMEREVIEWS_ID KEGG_ID TIGR_ID
UCSC_ID VECTORBASE_ID AGD_ID ARACHNOSERVER_ID BURULIST_ID CGD CYGD_ID
DICTYBASE_ID ECHOBASE_ID ECOGENE_ID EUHCVDB_ID FLYBASE_ID GENECARDS_ID
GENEDB_SPOMBE_ID GENEFARM_ID H_INVDB_ID HGNC_ID HPA_ID LEGIOLIST_ID LEPROMA_ID
LISTILIST_ID MAIZEGDB_ID MIM_ID MGI_ID MYPULIST_ID NMPDR ORPHANET_ID PHARMGKB_ID
PHOTOLIST_ID PSEUDOCAP_ID RGD_ID SAGALIST_ID SGD_ID SUBTILIST_ID TAIR_ID
TUBERCULIST_ID WORMBASE_ID WORMPEP_ID XENBASE_ID ZFIN_ID EGGNOG_ID OMA_ID
ORTHODB_ID BIOCYC_ID REACTOME_ID CLEANEX_ID GERMONLINE_ID DRUGBANK_ID
NEXTBIO_ID);
# new modules should be a little more lightweight and
# should use Bio::Root::Root
sub new {
Bio/DB/SwissProt.pm view on Meta::CPAN
Returns : A Bio::Seq object
Args : accession number (as a string)
Throws : "acc does not exist" exception
=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
=cut
=head2 get_Stream_by_acc
Title : get_Stream_by_acc
Usage : $seq = $db->get_Seq_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
Note : For GenBank, this just calls the same code for get_Stream_by_id()
=cut
=head2 get_Stream_by_batch
Title : get_Stream_by_batch
Usage : $seq = $db->get_Stream_by_batch($ref);
Function: Retrieves Seq objects from SwissProt 'en masse', rather than one
at a time. This is implemented the same way as get_Stream_by_id,
but is provided here in keeping with access methods of NCBI
modules.
Example :
Returns : a Bio::SeqIO stream object
Args : $ref : either an array reference, a filename, or a filehandle
from which to get the list of unique ids/accession numbers.
NOTE: deprecated API. Use get_Stream_by_id() instead.
=cut
*get_Stream_by_batch = sub {
my $self = shift;
$self->deprecated('get_Stream_by_batch() is deprecated; use get_Stream_by_id() instead');
$self->get_Stream_by_id(@_)
};
=head2 Implemented Routines from Bio::DB::WebDBSeqI interface
=cut
=head2 get_request
Title : get_request
Usage : my $url = $self->get_request
Function: returns a HTTP::Request object
Returns :
Args : %qualifiers = a hash of qualifiers (ids, format, etc)
=cut
sub get_request {
my ($self, @qualifiers) = @_;
my ($uids, $format) = $self->_rearrange([qw(UIDS FORMAT)],
@qualifiers);
if( !defined $uids ) {
$self->throw("Must specify a value for uids to query");
}
my ($f,undef) = $self->request_format($format);
my %vars = (
@{$HOSTS{$self->servertype}->{'basevars'}},
( 'format' => $f )
);
my $url = $self->location_url;
my $uid;
my $jointype = $HOSTS{$self->servertype}->{'jointype'} || ' ';
my $idvar = $HOSTS{$self->servertype}->{'idvar'} || 'id';
if( ref($uids) =~ /ARRAY/i ) {
# HTTP::Request automagically converts the ' ' to %20
$uid = join($jointype, @$uids);
} else {
$uid = $uids;
}
$vars{$idvar} = $uid;
return POST $url, \%vars;
}
=head2 postprocess_data
Title : postprocess_data
Usage : $self->postprocess_data ( 'type' => 'string',
'location' => \$datastr);
Function: process downloaded data before loading into a Bio::SeqIO
Returns : void
Args : hash with two keys - 'type' can be 'string' or 'file'
- 'location' either file location or string
reference containing data
=cut
# don't need to do anything
sub postprocess_data {
my ($self, %args) = @_;
return;
}
=head2 default_format
Title : default_format
Usage : my $format = $self->default_format
Function: Returns default sequence format for this module
Returns : string
Args : none
=cut
sub default_format {
return $DEFAULTFORMAT;
}
=head2 Bio::DB::SwissProt specific routines
=cut
=head2 servertype
Title : servertype
Usage : my $servertype = $self->servertype
$self->servertype($servertype);
Function: Get/Set server type
Returns : string
Args : server type string [optional]
=cut
sub servertype {
my ($self, $servertype) = @_;
( run in 0.993 second using v1.01-cache-2.11-cpan-39bf76dae61 )