跳到正文
0.16.6 文档

本页完整说明已译为现代汉语;函数、参数、代码和原始数据标识保留原样。 使用教程

全站目录 · 按任务查找

file 和 files 均接受路径向量或通配模式;解析后重复的路径按首次出现顺序只读一次。标准 -outfmt 6、-outfmt 7 使用默认 12 个表格字段,历史扩展 17 列只是可选格式。完全省略 -outfmt 会产生 pairwise 文本,本表格读取器不解析它。

用法

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

参数

file

可选路径向量或通配模式,在 files 之前读取。

files

可选 BLAST 表格文件字符向量,支持路径和通配模式;读取所有匹配文件并合并为一个数据框。

format

格式选项:"auto"(默认)自动检测列布局;"outfmt6" 要求标准 12 列;"outfmt7" 解析 # Fields: 声明;"custom" 要求提供 col_names。

col_names

可选的文件列名字符向量,用于 format = "custom" 或覆盖自动检测。

comment

注释字符,默认 "#";BLAST outfmt 7 的头部注释行以 # 开始。

source_file

逻辑值,读取一个或多个文件时是否添加 .source_file 列,默认 FALSE。

...

传给 utils::read.table() 的其他参数,例如 na.strings。

返回值

数据框,必需连接列 qaccver、saccver、qstart、qend、sstart、send 在前,其后保留可选列。ggchord_import 属性记录文件、逐文件输出行数和一基闭区间坐标约定。

详细说明

也可解析 BLASTp 表格,保留生成软件的数值端点,不推断或转换氨基酸/核苷酸单位。蛋白区间用于基因组绘图前须显式投影到 CDS;读取蛋白 HSP 不构成核苷酸无缺口对应证据。见 project_ggchord_features() 和 project_ggchord_links()。

示例

代码
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)
} # }