1#
2#
3# BioPerl module for Bio::DB::Flat::BDB::swiss
4#
5# Please direct questions and support issues to <bioperl-l@bioperl.org>
6#
7# Cared for by Lincoln Stein <lstein@cshl.org>
8#
9# You may distribute this module under the same terms as perl itself
10
11# POD documentation - main docs before the code
12
13=head1 NAME
14
15Bio::DB::Flat::BDB::swiss - swissprot adaptor for Open-bio standard BDB-indexed flat file
16
17=head1 SYNOPSIS
18
19See Bio::DB::Flat.
20
21=head1 DESCRIPTION
22
23This module allows swissprot files to be stored in Berkeley DB flat files
24using the Open-Bio standard BDB-indexed flat file scheme.  You should
25not be using this directly, but instead use it via Bio::DB::Flat.
26
27=head1 FEEDBACK
28
29=head2 Mailing Lists
30
31User feedback is an integral part of the evolution of this and other
32Bioperl modules. Send your comments and suggestions preferably to one
33of the Bioperl mailing lists.  Your participation is much appreciated.
34
35  bioperl-l@bioperl.org                  - General discussion
36  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists
37
38=head2 Support
39
40Please direct usage questions or support issues to the mailing list:
41
42I<bioperl-l@bioperl.org>
43
44rather than to the module maintainer directly. Many experienced and
45reponsive experts will be able look at the problem and quickly
46address it. Please include a thorough description of the problem
47with code and data examples if at all possible.
48
49=head2 Reporting Bugs
50
51Report bugs to the Bioperl bug tracking system to help us keep track
52the bugs and their resolution.  Bug reports can be submitted via the
53web:
54
55  https://github.com/bioperl/bioperl-live/issues
56
57=head1 SEE ALSO
58
59L<Bio::DB::Flat>,
60
61=head1 AUTHOR - Lincoln Stein
62
63Email - lstein@cshl.org
64
65=cut
66
67package Bio::DB::Flat::BDB::swiss;
68$Bio::DB::Flat::BDB::swiss::VERSION = '1.7.7';
69use strict;
70
71use base qw(Bio::DB::Flat::BDB);
72
73sub default_file_format { "swiss" }
74
75sub default_primary_namespace {
76  return "ID";
77}
78
79sub default_secondary_namespaces {
80  return qw(ACC VERSION);
81}
82
83sub seq_to_ids {
84  my $self = shift;
85  my $seq  = shift;
86
87  my $display_id = $seq->display_id;
88  my $accession  = $seq->accession_number;
89  my $version    = $seq->seq_version;
90  my $gi         = $seq->primary_id;
91  my %ids;
92  $ids{ID}       = $display_id;
93  $ids{ACC}      = $accession              if defined $accession;
94  $ids{VERSION}  = "$accession.$version"   if defined $accession && defined $version;
95  return \%ids;
96}
97
98
991;
100