| 1 | # | ||
| 2 | # | ||
| 3 | # BioPerl module for Bio::DB::EMBL | ||
| 4 | # | ||
| 5 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||
| 6 | # | ||
| 7 | # Cared for by Heikki Lehvaslaiho <heikki-at-bioperl-dot-org> | ||
| 8 | # | ||
| 9 | # Copyright Jason Stajich | ||
| 10 | # | ||
| 11 | # You may distribute this module under the same terms as perl itself | ||
| 12 | |||
| 13 | # POD documentation - main docs before the code | ||
| 14 | |||
| 15 | =head1 NAME | ||
| 16 | |||
| 17 | Bio::DB::EMBL - Database object interface for EMBL entry retrieval | ||
| 18 | |||
| 19 | =head1 SYNOPSIS | ||
| 20 | |||
| 21 | use Bio::DB::EMBL; | ||
| 22 | |||
| 23 | $embl = Bio::DB::EMBL->new(); | ||
| 24 | |||
| 25 | # remember that EMBL_ID does not equal GenBank_ID! | ||
| 26 | $seq = $embl->get_Seq_by_id('HSFOS'); # EMBL ID | ||
| 27 | print "cloneid is ", $seq->id, "\n"; | ||
| 28 | |||
| 29 | # or changeing to accession number and Fasta format ... | ||
| 30 | $embl->request_format('fasta'); | ||
| 31 | $seq = $embl->get_Seq_by_acc('J02231'); # EMBL ACC | ||
| 32 | print "cloneid is ", $seq->id, "\n"; | ||
| 33 | |||
| 34 | # especially when using versions, you better be prepared | ||
| 35 | # in not getting what what want | ||
| 36 | eval { | ||
| 37 | $seq = $embl->get_Seq_by_version('J02231.1'); # EMBL VERSION | ||
| 38 | }; | ||
| 39 | print "cloneid is ", $seq->id, "\n" unless $@; | ||
| 40 | |||
| 41 | # or ... best when downloading very large files, prevents | ||
| 42 | # keeping all of the file in memory | ||
| 43 | |||
| 44 | # also don't want features, just sequence so let's save bandwidth | ||
| 45 | # and request Fasta sequence | ||
| 46 | $embl = Bio::DB::EMBL->new(-retrievaltype => 'tempfile' , | ||
| 47 | -format => 'fasta'); | ||
| 48 | my $seqio = $embl->get_Stream_by_id(['AC013798', 'AC021953'] ); | ||
| 49 | while( my $clone = $seqio->next_seq ) { | ||
| 50 | print "cloneid is ", $clone->id, "\n"; | ||
| 51 | } | ||
| 52 | |||
| 53 | =head1 DESCRIPTION | ||
| 54 | |||
| 55 | Allows the dynamic retrieval of sequence objects L<Bio::Seq> from the | ||
| 56 | EMBL database using the dbfetch script at EBI: | ||
| 57 | L<http://www.ebi.ac.uk/Tools/dbfetch/dbfetch>. | ||
| 58 | |||
| 59 | In order to make changes transparent we have host type (currently only | ||
| 60 | ebi) and location (defaults to ebi) separated out. This allows later | ||
| 61 | additions of more servers in different geographical locations. | ||
| 62 | |||
| 63 | The functionality of this module is inherited from L<Bio::DB::DBFetch> | ||
| 64 | which implements L<Bio::DB::WebDBSeqI>. | ||
| 65 | |||
| 66 | =head1 FEEDBACK | ||
| 67 | |||
| 68 | =head2 Mailing Lists | ||
| 69 | |||
| 70 | User feedback is an integral part of the evolution of this and other | ||
| 71 | Bioperl modules. Send your comments and suggestions preferably to one | ||
| 72 | of the Bioperl mailing lists. Your participation is much appreciated. | ||
| 73 | |||
| 74 | bioperl-l@bioperl.org - General discussion | ||
| 75 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||
| 76 | |||
| 77 | =head2 Support | ||
| 78 | |||
| 79 | Please direct usage questions or support issues to the mailing list: | ||
| 80 | |||
| 81 | I<bioperl-l@bioperl.org> | ||
| 82 | |||
| 83 | rather than to the module maintainer directly. Many experienced and | ||
| 84 | reponsive experts will be able look at the problem and quickly | ||
| 85 | address it. Please include a thorough description of the problem | ||
| 86 | with code and data examples if at all possible. | ||
| 87 | |||
| 88 | =head2 Reporting Bugs | ||
| 89 | |||
| 90 | Report bugs to the Bioperl bug tracking system to help us keep track | ||
| 91 | the bugs and their resolution. Bug reports can be submitted via the | ||
| 92 | web: | ||
| 93 | |||
| 94 | https://github.com/bioperl/bioperl-live/issues | ||
| 95 | |||
| 96 | =head1 AUTHOR - Heikki Lehvaslaiho | ||
| 97 | |||
| 98 | Email Heikki Lehvaslaiho E<lt>heikki-at-bioperl-dot-orgE<gt> | ||
| 99 | |||
| 100 | =head1 APPENDIX | ||
| 101 | |||
| 102 | The rest of the documentation details each of the object | ||
| 103 | methods. Internal methods are usually preceded with a _ | ||
| 104 | |||
| 105 | =cut | ||
| 106 | |||
| 107 | # Let the code begin... | ||
| 108 | |||
| 109 | package Bio::DB::EMBL; | ||
| 110 | 2 | $Bio::DB::EMBL::VERSION = '1.7.4'; | |
| 111 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 112 | 2 | ▶ | use vars qw($MODVERSION %HOSTS %FORMATMAP $DEFAULTFORMAT); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 113 | |||
| 114 | 2 | $MODVERSION = '0.2'; | |
| 115 | |||
| 116 | 2 | ▶ | use base qw(Bio::DB::DBFetch); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 117 | |||
| 118 | 2 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 119 | # you can add your own here theoretically. | ||
| 120 | 2 | %HOSTS = ( | |
| 121 | 'dbfetch' => { | ||
| 122 | baseurl => 'http://%s/Tools/dbfetch/dbfetch?db=embl&style=raw', | ||
| 123 | hosts => { | ||
| 124 | 'ebi' => 'www.ebi.ac.uk' | ||
| 125 | } | ||
| 126 | } | ||
| 127 | ); | ||
| 128 | 2 | %FORMATMAP = ( 'embl' => 'embl', | |
| 129 | 'fasta' => 'fasta' | ||
| 130 | ); | ||
| 131 | 2 | $DEFAULTFORMAT = 'embl'; | |
| 132 | } | ||
| 133 | |||
| 134 | =head2 new | ||
| 135 | |||
| 136 | Title : new | ||
| 137 | Usage : $gb = Bio::DB::GenBank->new(@options) | ||
| 138 | Function: Creates a new genbank handle | ||
| 139 | Returns : New genbank handle | ||
| 140 | Args : -delay number of seconds to delay between fetches (3s) | ||
| 141 | |||
| 142 | NOTE: There are other options that are used internally. | ||
| 143 | |||
| 144 | =cut | ||
| 145 | |||
| 146 | 3 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 147 | 3 | my ($class, @args ) = @_; | |
| 148 | 3 | my $self = $class->SUPER::new(@args); | |
| 149 | |||
| 150 | 3 | $self->{ '_hosts' } = {}; | |
| 151 | 3 | $self->{ '_formatmap' } = {}; | |
| 152 | |||
| 153 | 3 | $self->hosts(\%HOSTS); | |
| 154 | 3 | $self->formatmap(\%FORMATMAP); | |
| 155 | 3 | $self->{'_default_format'} = $DEFAULTFORMAT; | |
| 156 | |||
| 157 | 3 | return $self; | |
| 158 | } | ||
| 159 | |||
| 160 | 2 | 1; | |