Skip to contents
0.16.6 documentation

Complete canonical API text; task articles explain the workflows. Tutorials

Site guide · find your task

Both file and files accept literal path vectors or wildcard patterns. Repeated resolved paths are read once, in first-occurrence order. Standard -outfmt 6 and -outfmt 7 use the default 12 tabular fields; the historical extended 17-column format is optional. Omitting -outfmt entirely produces pairwise text, which this tabular reader does not parse.

Usage

Code
read_blast(
  file = NULL,
  files = NULL,
  format = c("auto", "outfmt6", "outfmt7", "custom"),
  col_names = NULL,
  comment = "#",
  source_file = FALSE,
  ...
)

Arguments

file

Optional path vector or glob patterns; read before files.

files

Optional character vector of BLAST tabular output files (literal paths and/or wildcard patterns). All matched files are read and combined into one data.frame.

format

Character. "auto" (default) detects the column layout from the file; "outfmt6" requires the standard 12-column layout, "outfmt7" parses its # Fields: declaration, and "custom" requires col_names.

col_names

Optional character vector naming the columns in the file, used with format = "custom" or to override auto-detection.

comment

Character comment character, default "#" (BLAST outfmt 7 header lines start with #).

source_file

Logical. Add a .source_file column when reading one or more files, default FALSE.

...

Additional arguments passed to utils::read.table() (e.g. na.strings).

Value

A data.frame with the required ribbon columns first (qaccver, saccver, qstart, qend, sstart, send) followed by any preserved optional columns. A ggchord_import attribute records files, per-file output row counts and the one-based inclusive coordinate convention.

Details

The reader also parses BLASTp tabular output. It preserves the producer's numeric endpoints and does not infer or convert amino-acid/nucleotide units. Protein intervals require an explicit CDS projection before genomic plotting; reading a protein HSP does not establish an ungapped nucleotide correspondence. See project_ggchord_features() and project_ggchord_links().

Examples

Code
if (FALSE) { # \dontrun{
library(dplyr)
# Standard 12-column records; requires the source checkout or tutorial input bundle.
source <- read_blast("examples/blastn-standard/MT108731.1__MT118296.1.tsv")
links <- source |>
  select(qaccver, saccver, qstart, qend, sstart, send)
} # }