0
|
1 #
|
|
2 # $Id: embl.pm,v 1.4 2002/10/22 07:38:31 lapp Exp $
|
|
3 #
|
|
4 # BioPerl module for Bio::DB::Flat::BDB
|
|
5 #
|
|
6 # Cared for by Lincoln Stein <lstein@cshl.org>
|
|
7 #
|
|
8 # You may distribute this module under the same terms as perl itself
|
|
9
|
|
10 # POD documentation - main docs before the code
|
|
11
|
|
12 =head1 NAME
|
|
13
|
|
14 Bio::DB::Flat::BDB::embl - embl adaptor for Open-bio standard BDB-indexed flat file
|
|
15
|
|
16 =head1 SYNOPSIS
|
|
17
|
|
18 See Bio::DB::Flat.
|
|
19
|
|
20 =head1 DESCRIPTION
|
|
21
|
|
22 This module allows embl files to be stored in Berkeley DB flat files
|
|
23 using the Open-Bio standard BDB-indexed flat file scheme. You should
|
|
24 not be using this directly, but instead use it via Bio::DB::Flat.
|
|
25
|
|
26 =head1 FEEDBACK
|
|
27
|
|
28 =head2 Mailing Lists
|
|
29
|
|
30 User feedback is an integral part of the evolution of this and other
|
|
31 Bioperl modules. Send your comments and suggestions preferably to one
|
|
32 of the Bioperl mailing lists. Your participation is much appreciated.
|
|
33
|
|
34 bioperl-l@bioperl.org - General discussion
|
|
35 http://bioperl.org/MailList.shtml - About the mailing lists
|
|
36
|
|
37 =head2 Reporting Bugs
|
|
38
|
|
39 Report bugs to the Bioperl bug tracking system to help us keep track
|
|
40 the bugs and their resolution. Bug reports can be submitted via
|
|
41 email or the web:
|
|
42
|
|
43 bioperl-bugs@bio.perl.org
|
|
44 http://bugzilla.bioperl.org/
|
|
45
|
|
46 =head1 AUTHOR - Lincoln Stein
|
|
47
|
|
48 Email - lstein@cshl.org
|
|
49
|
|
50 =head1 SEE ALSO
|
|
51
|
|
52 L<Bio::DB::Flat>,
|
|
53
|
|
54 =cut
|
|
55
|
|
56 package Bio::DB::Flat::BDB::embl;
|
|
57
|
|
58 use strict;
|
|
59 use Bio::DB::Flat::BDB;
|
|
60 use vars '@ISA';
|
|
61
|
|
62 @ISA = qw(Bio::DB::Flat::BDB);
|
|
63
|
|
64 sub parse_one_record {
|
|
65 my $self = shift;
|
|
66 my $fh = shift;
|
|
67 my $parser =
|
|
68 $self->{embl_cached_parsers}{fileno($fh)} ||= Bio::SeqIO->new(-fh=>$fh,-format=>$self->default_file_format);
|
|
69 my $seq = $parser->next_seq;
|
|
70 my $ids = $self->seq_to_ids($seq);
|
|
71 return $ids;
|
|
72 }
|
|
73
|
|
74 sub seq_to_ids {
|
|
75 my $self = shift;
|
|
76 my $seq = shift;
|
|
77
|
|
78 my $display_id = $seq->display_id;
|
|
79 my $accession = $seq->accession_number;
|
|
80 my %ids;
|
|
81 $ids{ID} = $display_id;
|
|
82 $ids{ACC} = $accession if defined $accession;
|
|
83 return \%ids;
|
|
84 }
|
|
85
|
|
86 sub default_primary_namespace {
|
|
87 return "ID";
|
|
88 }
|
|
89
|
|
90 sub default_secondary_namespaces {
|
|
91 return qw(ACC);
|
|
92 }
|
|
93
|
|
94 sub default_file_format { "embl" }
|
|
95
|
|
96
|
|
97 1;
|