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