| ## EMBOSS: dbifasta

# Program dbifasta

## Function

Index a fasta database

## Description

dbifasta indexes a flat file database of one or more files, and builds EMBL CD-ROM format index files. This format is used by the software on the EMBL database CD-ROM distribution and by the Staden package in addition to EMBOSS, and appears to be the most generally used and publicly available index file format for these databases.

## Usage

Here is a sample session with dbifasta, using the data in the test/wormpep directory of the distribution which is normally indexed as "wormpep"

    % dbifasta
    Index a fasta database
        simple : >ID
         idacc : >ID ACC
         gcgid : >db:ID
      gcgidacc : >db:ID ACC
          ncbi : >blah|...[|ACC]|ID
    ID line format [idacc]: idacc
    Database name: wormpep
    Database directory [.]: /data/worm/
    Wildcard database filename [*.dat]: wormpep
    Release number [0.0]: 1.0
    Index date [00/00/00]: 04/02/00

## Command line arguments

       Mandatory qualifiers:
       -idformat           menu       ID line format
       -directory          string     Database directory
       -filenames          string     Wildcard database filename
      [-dbname]            string     Database name
       -release            string     Release number
       -date               string     Index date

       Optional qualifiers: (none)
       Advanced qualifiers:
       -fields             menu       Index fields
       -exclude            string     wildcard filename(s) to exclude
       -indexdirectory     string     Index directory
       -maxindex           integer    Maximum index length
       -sortoptions        string     Sort options, typically '-T .' to use
                                      current directory for work files and '-k
                                      1,1' to force GNU sort to use the first
                                      field
       -[no]systemsort     bool       Use system sort utility
       -[no]cleanup        bool       Clean up temporary files

       General qualifiers:
      -help                bool       report command line options. More
                                      information on associated and general
                                      qualifiers can be found with -help -verbose

Mandatory qualifiers | Allowed values | Default
--- | --- | ---
-idformat | ID line format |
simple | (>ID)
idacc | (>ID ACC)
gcgid | (>db:ID)
gcgidacc | (>db:ID ACC)
dbid | (>db ID)
ncbi | (| formats)
| idacc
-directory | Database directory | Any string is accepted | .
-filenames | Wildcard database filename | Any string is accepted | *.dat
[-dbname] (Parameter 1) | Database name | A string from 1 to 19 characters | Required
-release | Release number | A string up to 9 characters | 0.0
-date | Index date | Date string dd/mm/yy | 00/00/00
Optional qualifiers | Allowed values | Default
(none)
Advanced qualifiers | Allowed values | Default
-fields | Index fields |
acnum | (Accession number)
seqvn | (Sequence Version and GI)
des | (Description)
| acnum
-exclude | wildcard filename(s) to exclude | Any string is accepted | An empty string is accepted
-indexdirectory | Index directory | Any string is accepted | .
-maxindex | Maximum index length | Integer 0 or more | 0
-sortoptions | Sort options, typically '-T .' to use current directory for work files and '-k 1,1' to force GNU sort to use the first field | Any string is accepted | -T . -k 1,1
-[no]systemsort | Use system sort utility | Yes/No | Yes
-[no]cleanup | Clean up temporary files | Yes/No | Yes

## Input file format

None.

## Output file format

dbifasta creates four index files. All are binary but with a simple format.

- division.lkp is the master index file, and has a 300 byte header containing the database name and date plus information on the record size. This header is followed by one record for each database file, giving the full file name for the data file, and optionally a second sequence file.
- entryname.idx is the entry name index. It has the same 300 byte header, mainly used to store the record size which will depend on the size of the longest entryname in the database. Each entry is stored in sorted alphanumeric order so that a binary search can be used to efficiently find any record. The record also holds the file number from division.lkp and the offsets in the data and sequence files for that entry.
- acnum.trg holds the accession number information. The file has the usual 300 byte header, and a sorted list of record by accession number. Each accession number record contains the first record number in acnum.hit and the total number of records in acnum.hit so that secondary (duplicated) accession numbers can be searched.
- acnum.hit is a very simple file. After the usual 300 byte header, each record simply holds the record number in entryname.idx. An accession number search will use acnum.trg to find a start position and number of records to read in this file, and will then simply read the entryname.idx records for each entry in turn.

## Data files

None.

## Notes

The indexing method depends on each entry having a unique entry name. No allowance is made for two entries with the same name so it is not possible to index EMBL and EMBLNEW together.

## References

None.

## Warnings

None.

## Diagnostic Error Messages

None.

## Exit status

It always exits with status 0.

## Known bugs

None.

## See also

Program name | Description
--- | ---
dbiblast | Index a BLAST database
dbiflat | Index a flat file database
dbigcg | Index a GCG formatted database

## Author(s)

This application was written by Alan Bleasby (ableasby@hgmp.mrc..ac.uk) Bioinformatics Division, MRC HGMP-RC, Wellcome Trust Genome Campus, Hinxton, Cambridge, CB10 1SA, UK.

## History

Completed August 2000

## Target users

This program is intended to be used by everyone and everything, from naive users to embedded scripts.

## Comments