| dbiblast

## Wiki

The master copies of EMBOSS documentation are available at http://emboss.open-bio.org/wiki/Appdocs on the EMBOSS Wiki.

Please help by correcting and extending the Wiki pages.

## Function

Index a BLAST database

## Description

dbiblast indexes a blast database created by the NCBI indexing programs formatdb, pressdb or setdb, 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.

The index files of the blast database format are not useful by themselves as they do not hold the entrynames or accession numbers, but they are used as pointers to the reference and sequence information in the database.

Because there are two sequence types (nucleic acid and protein) and two index formats (blast1 from pressdb or setdb, and blast2 from formatdb) with different index file names, dbiblast will ask about the database type. If the answer is "unknown" dbiblast will test each possible set of file names until one is found.

## Usage

Here is a sample session with dbiblast

This creates EMBOSS indices for the BLAST database 'swnew'

    % dbiblast
    Index a BLAST database
    Database name: swnew
    Database directory [.]: data
    Wildcard database filename [swnew]:
    Release number [0.0]:
    Index date [00/00/00]:
             N : nucleic
             P : protein
             ? : unknown
    Sequence type [unknown]:
             1 : wublast and setdb/pressdb
             2 : formatdb
             0 : unknown
    Blast index version [unknown]:
    General log output file [outfile.dbiblast]:

Go to the output files for this example

## Command line arguments

    Index a BLAST database
    Version: EMBOSS:6.6.0.0

       Standard (Mandatory) qualifiers:
      [-dbname]            string     Database name (Any string from 2 to 19
                                      characters, matching regular expression
                                      /[A-z][A-z0-9_]+/)
       -directory          directory  [.] Database directory
       -filenames          string     [Database name] Wildcard database filename
                                      (Any string)
       -release            string     [0.0] Release number (Any string up to 9
                                      characters)
       -date               string     [00/00/00] Index date (Date string dd/mm/yy)
       -seqtype            menu       [unknown] Sequence type (Values: N
                                      (nucleic); P (protein); ? (unknown))
       -blastversion       menu       [unknown] Blast index version (Values: 1
                                      (wublast and setdb/pressdb); 2 (formatdb); 0
                                      (unknown))
       -outfile            outfile    [*.dbiblast] General log output file

       Additional (Optional) qualifiers: (none)
       Advanced (Unprompted) qualifiers:
       -fields             menu       [acc] Index fields (Values: acc (acnum
                                      accession number index); sv (seqvn sequence
                                      version and gi number index); des (des
                                      description index))
       -exclude            string     Wildcard filename(s) to exclude (Any string)
       -sortoptions        string     [-T . -k 1,1] 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)
       -maxindex           integer    [0] Maximum index length (Integer 0 or more)
       -[no]systemsort     boolean    [Y] Use system sort utility
       -[no]cleanup        boolean    [Y] Clean up temporary files
       -sourcefile         boolean    Use FASTA source file
       -indexoutdir        outdir     [.] Index file output directory

       Associated qualifiers:

       "-directory" associated qualifiers
       -extension          string     Default file extension

       "-outfile" associated qualifiers
       -odirectory         string     Output directory

       "-indexoutdir" associated qualifiers
       -extension          string     Default file extension

       General qualifiers:
       -auto               boolean    Turn off prompts
       -stdout             boolean    Write first file to standard output
       -filter             boolean    Read first file from standard input, write
                                      first file to standard output
       -options            boolean    Prompt for standard and additional values
       -debug              boolean    Write debug output to program.dbg
       -verbose            boolean    Report some/full command line options
       -help               boolean    Report command line options and exit. More
                                      information on associated and general
                                      qualifiers can be found with -help -verbose
       -warning            boolean    Report warnings
       -error              boolean    Report errors
       -fatal              boolean    Report fatal errors
       -die                boolean    Report dying program messages
       -version            boolean    Report version number and exit

Qualifier | Type | Description | Allowed values | Default
--- | --- | --- | --- | ---
Standard (Mandatory) qualifiers
[-dbname] (Parameter 1) | string | Database name | Any string from 2 to 19 characters, matching regular expression /[A-z][A-z0-9_]+/ | Required
-directory | directory | Database directory | Directory | .
-filenames | string | Wildcard database filename | Any string | Database name
-release | string | Release number | Any string up to 9 characters | 0.0
-date | string | Index date | Date string dd/mm/yy | 00/00/00

-seqtype

list

Sequence type

N | (nucleic)
P | (protein)
? | (unknown)

unknown

-blastversion

list

Blast index version

1 | (wublast and setdb/pressdb)
2 | (formatdb)
0 | (unknown)

unknown

-outfile | outfile | General log output file | Output file | <*>.dbiblast
Additional (Optional) qualifiers
(none)
Advanced (Unprompted) qualifiers

-fields

list

Index fields

acc | (acnum accession number index)
sv | (seqvn sequence version and gi number index)
des | (des description index)

acc

-exclude | string | Wildcard filename(s) to exclude | Any string |
-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 | Any string | -T . -k 1,1
-maxindex | integer | Maximum index length | Integer 0 or more | 0
-[no]systemsort | boolean | Use system sort utility | Boolean value Yes/No | Yes
-[no]cleanup | boolean | Clean up temporary files | Boolean value Yes/No | Yes
-sourcefile | boolean | Use FASTA source file | Boolean value Yes/No | No
-indexoutdir | outdir | Index file output directory | Output directory | .
Associated qualifiers
"-directory" associated directory qualifiers
-extension | string | Default file extension | Any string |
"-outfile" associated outfile qualifiers
-odirectory | string | Output directory | Any string |
"-indexoutdir" associated outdir qualifiers
-extension | string | Default file extension | Any string |
General qualifiers
-auto | boolean | Turn off prompts | Boolean value Yes/No | N
-stdout | boolean | Write first file to standard output | Boolean value Yes/No | N
-filter | boolean | Read first file from standard input, write first file to standard output | Boolean value Yes/No | N
-options | boolean | Prompt for standard and additional values | Boolean value Yes/No | N
-debug | boolean | Write debug output to program.dbg | Boolean value Yes/No | N
-verbose | boolean | Report some/full command line options | Boolean value Yes/No | Y
-help | boolean | Report command line options and exit. More information on associated and general qualifiers can be found with -help -verbose | Boolean value Yes/No | N
-warning | boolean | Report warnings | Boolean value Yes/No | Y
-error | boolean | Report errors | Boolean value Yes/No | Y
-fatal | boolean | Report fatal errors | Boolean value Yes/No | Y
-die | boolean | Report dying program messages | Boolean value Yes/No | Y
-version | boolean | Report version number and exit | Boolean value Yes/No | N

## Input file format

Any BLAST1 or BLAST2 database index files.

## Output file format

### Output files for usage example

### File: division.lkp

This file contains non-printing characters and so cannot be displayed here.

### File: entrynam.idx

This file contains non-printing characters and so cannot be displayed here.

### File: acnum.hit

This file contains non-printing characters and so cannot be displayed here.

### File: acnum.trg

This file contains non-printing characters and so cannot be displayed here.

### File: outfile.dbiblast

    ########################################
    # Program: dbiblast
    # Rundate: Mon 15 Jul 2013 12:00:00
    # Dbname: swnew
    # Release: 0.0
    # Date: 15/07/13
    # CurrentDirectory: /homes/user/test/qa/dbiblast-ex-keep/
    # IndexDirectory: ./
    # IndexDirectoryPath: /homes/user/test/qa/dbiblast-ex-keep/
    # Maxindex: 0
    # Fields: 2
    #   Field 1: id
    #   Field 2: acc
    # Directory: /homes/user/test/data/
    # DirectoryPath: /homes/user/test/data/
    # Filenames: swnew
    # Exclude:
    # Files: 1
    #   File 1: /homes/user/test/data/swnew
    ########################################
    # Commandline: dbiblast
    #    -dbname swnew
    #    -directory ../../data
    ########################################

    filename: '/homes/user/test/data/swnew'
        id: 9
       acc: 9

    Index acc: maxlen 6 items 9

    Total 1 files 9 entries (0 duplicates)

dbiblast 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

dbiblast can't use the new style of Blast indices. You must create the old style of Blast indices by adding `-A F` to the formatdb command line.

Having created the EMBOSS indices for this file, a database can then be defined in the file emboss.defaults as something like:

    DB swnew [
       type: P
       format: embl
       method: blast
       directory: /data/embl
    ]

### Fields Indexed

By default, dbiblast will index the ID name and the accession number (if present).
If they are present in your database, you may specify that dbiblast should index the Sequence Version and GI number and the words in the description by using the '-fields' qualifier with the appropriate values.

### Indexing the Blast database

dbiblast can't use the new style of Blast indices. You must create the old style of Blast indices by adding `-A F` to the formatdb command line.

The reason is that NCBI have not documented the new format, so we cannot extend dbiblast to read it.

If you have the original (fasta format) file you can build the previous blast database format with:

formatdb -A F

This turns off the new "ASN.1" formatting. blastall will still work.

## References

None.

## Warnings

## Diagnostic Error Messages

None.

## Exit status

None.

## Known bugs

dbiblast can't use the new style of Blast indices. You must create the old style of Blast indices by adding `-A F` to the formatdb command line.

## See also

Program name | Description
--- | ---
dbifasta | Index a fasta file database
dbiflat | Index a flat file database
dbigcg | Index a GCG formatted database
dbxcompress | Compress an uncompressed dbx index
dbxedam | Index the EDAM ontology using b+tree indices
dbxfasta | Index a fasta file database using b+tree indices
dbxflat | Index a flat file database using b+tree indices
dbxgcg | Index a GCG formatted database using b+tree indices
dbxobo | Index an obo ontology using b+tree indices
dbxreport | Validate index and report internals for dbx databases
dbxresource | Index a data resource catalogue using b+tree indices
dbxstat | Dump statistics for dbx databases
dbxtax | Index NCBI taxonomy using b+tree indices
dbxuncompress | Uncompress a compressed dbx index

## Author(s)

Peter Rice
European Bioinformatics Institute, Wellcome Trust Genome Campus, Hinxton, Cambridge CB10 1SD, UK

Please report all bugs to the EMBOSS bug team (emboss-bug © emboss.open-bio.org) not to the original author.

## History

Completed December 1999

## Target users

This program is intended to be used by administrators responsible for software and database installation and maintenance.

## Comments

None