makeblastdb: Create BLAST Databases

View source: R/makeblastdb.R

makeblastdbR Documentation

Create BLAST Databases

Description

Call the makeblastdb utility to create a BLAST database from a FASTA file.

Usage

makeblastdb(
  file,
  db_name = NULL,
  dbtype = "nucl",
  hash_index = TRUE,
  args = "",
  verbose = TRUE
)

Arguments

file

input file/database name. Note that the filename and path cannot contain whitespaces.

db_name

name of the database (files).

dbtype

molecule type of target db ("nucl" or "prot").

hash_index

logical; create index of sequence hash values.

args

string including additional arguments passed on to makeblastdb.

verbose

logical; show the progress report produced by makeblastdb?

Details

R needs to be able to find the executable (mostly an issue with Windows). Try Sys.which("makeblastdb") to see if the program is properly installed.

Use blast_help("makeblastdb") to see all possible extra arguments. Arguments need to be formated in exactly the way as they would be used for the command line tool.

Value

Nothing but creates a BLAST database directory.

Author(s)

Michael Hahsler

See Also

Other blast: blast(), blast_db_cache()

Examples

## check if makeblastdb is correctly installed
Sys.which("makeblastdb")

## only run if blast is installed
if (has_blast()) {
    ## see possible arguments
    blast_help("makeblastdb")

    ## read some example sequences
    seq <- readRNAStringSet(system.file("examples/RNA_example.fasta",
        package = "rBLAST"
    ))

    ## 1. write the FASTA file
    writeXStringSet(seq, filepath = "seqs.fasta")

    ## 2. make database
    makeblastdb(file = "seqs.fasta", db_name = "db/small", dbtype = "nucl")

    ## 3. open database
    db <- blast("db/small")
    db

    ## 4. perform search (first sequence in the db should be a perfect match)
    predict(db, seq[1])

    ## clean up
    unlink("seqs.fasta")
    unlink("db", recursive = TRUE)
}

mhahsler/rBLAST documentation built on April 24, 2024, 10:07 p.m.