blast_p: Run a blastp query.

Description Usage Arguments Value Author(s) References Examples

Description

This is a wrapper for blastp.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
blast_p(
  query,
  database,
  out_file = NULL,
  outfmt = "6",
  other_args = NULL,
  echo = TRUE,
  wd,
  ...
)

Arguments

query

Character vector of length one; the path to the fasta file to use as the query sequence(s).

database

Character vector of length one; the name of the blast database.

out_file

Character vector of length one; the name to use for the results file.

outfmt

Character vector of length one; value to pass to blastp outfmt argument. Default = "6".

other_args

Character vector; other arguments to pass on to blastp. For a list of options, run blastp -help.

echo

Logical; should standard error and output be printed?

wd

Character vector of length one; working directory. The blast search will be conducted here.

...

Additional other arguments. Not used by this function, but meant to be used by drake_plan for tracking during workflows.

Value

A tab-separated text file with the results of the blastp search, named with the value of out_file.

Author(s)

Joel H Nitta, joelnitta@gmail.com

References

https://www.ncbi.nlm.nih.gov/books/NBK279690/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
library(ape)

# Make temp dir for storing files
temp_dir <- fs::dir_create(fs::path(tempdir(), "baitfindR_example"))

# Write out ape::woodmouse dataset as amino acids
data(woodmouse)
woodmouse_aa <- trans(woodmouse, 2)
ape::write.FASTA(woodmouse_aa, fs::path(temp_dir, "woodmouse.fasta"))

# Make protein blast database
build_blast_db(
  fs::path(temp_dir, "woodmouse.fasta"),
  db_type = "prot",
  out_name = "wood",
  parse_seqids = TRUE,
  wd = temp_dir)

# Blast the original sequences against the database
blast_p(
  fs::path(temp_dir, "woodmouse.fasta"),
  database = "wood",
  out_file = "blastp_results",
  wd = temp_dir,
  echo = TRUE
)

# Take a look at the results.
readr::read_tsv(
  fs::path(temp_dir, "blastp_results"),
  col_names = FALSE
  )

# Cleanup.
fs::file_delete(temp_dir)

joelnitta/baitfindR documentation built on May 7, 2020, 6:21 p.m.