Bio::DB::Flat(3) Interface for indexed flat files


$db = Bio::DB::Flat->new(-directory => '/usr/share/embl',
-dbname => 'mydb',
-format => 'embl',
-index => 'bdb',
-write_flag => 1);
$seq = $db->get_Seq_by_id('BUM');
@sequences = $db->get_Seq_by_acc('DIV' => 'primate');
$raw = $db->fetch_raw('BUM');


This object provides the basic mechanism to associate positions in files with primary and secondary name spaces. Unlike Bio::Index::Abstract (see Bio::Index::Abstract), this is specialized to work with the ``flat index'' and BerkeleyDB indexed flat file formats worked out at the 2002 BioHackathon.

This object is a general front end to the underlying databases.


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.

  [email protected]                  - General discussion  - About the mailing lists


Please direct usage questions or support issues to the mailing list:

[email protected]

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.

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:

AUTHOR - Lincoln Stein

Email - [email protected]


The rest of the documentation details each of the object methods. Internal methods are usually preceded with an ``_'' (underscore).


 Title   : new
 Usage   : my $db = Bio::DB::Flat->new(
                     -directory  => $root_directory,
                     -dbname     => 'mydb',
                     -write_flag => 1,
                     -index      => 'bdb',
                     -verbose    => 0,
                     -out        => 'outputfile',
                     -format     => 'genbank');
 Function: create a new Bio::DB::Flat object
 Returns : new Bio::DB::Flat object
 Args    : -directory    Root directory containing "config.dat"
           -write_flag   If true, allows creation/updating.
           -verbose      Verbose messages
           -out          File to write to when write_seq invoked
           -index        'bdb' or 'binarysearch'
 Status  : Public

The required -directory argument indicates where the flat file indexes will be stored. The build_index() and write_seq() methods will automatically create subdirectories of this root directory. Each subdirectory will contain a human-readable configuration file named ``config.dat'' that specifies where the individual indexes are stored.

The required -dbname argument gives a name to the database index. The index files will actually be stored in a like-named subdirectory underneath the root directory.

The -write_flag enables writing new entries into the database as well as the creation of the indexes. By default the indexes will be opened read only.

-index is one of ``bdb'' or ``binarysearch'' and indicates the type of index to generate. ``bdb'' corresponds to Berkeley DB. You *must* be using BerkeleyDB version 2 or higher, and have the Perl BerkeleyDB extension installed (DB_File will *not* work). ``binarysearch'' corresponds to the OBDA ``flat'' indexed file.

The -out argument specifies the output file for writing objects created with write_seq().

The -format argument specifies the format of the input file or files. If the file suffix is one that Bioperl can already associate with a format then this is optional.


 Title   : new_from_registry
 Usage   : $db = Bio::DB::Flat->new_from_registry(%config)
 Function: creates a new Bio::DB::Flat object in a Bio::DB::Registry-
           compatible fashion
 Returns : new Bio::DB::Flat
 Args    : provided by the registry, see below
 Status  : Public

The following registry-configuration tags are recognized:

  location     Root of the indexed flat file; corresponds to the new() method's
               -directory argument.


  Title   : fetch
  Usage   : $index->fetch( $id )
  Function: Returns a Bio::Seq object from the index
  Example : $seq = $index->fetch( 'dJ67B12' )
  Returns : Bio::Seq object
  Args    : ID

Deprecated. Use get_Seq_by_id instead.

To Be Implemented in Subclasses

The following methods MUST be implemented by subclasses.

May Be Overridden in Subclasses

The following methods MAY be overridden by subclasses.