跳到正文
0.16.6 文档

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

全站目录 · 按任务查找

沿序列弧为一个或多个坐标区间绘制矩形带,用于标记区域、重复序列、CRISPR 阵列或自定义区域,无需将其变为基因箭头。

用法

代码
geom_seq_region(
  mapping = NULL,
  data = NULL,
  fill = "#F59E0B",
  colour = "#B45309",
  alpha = 0.25,
  region_width = 0.08,
  region_offset = 0,
  region_side = c("inside", "outside", "auto"),
  position = "identity",
  show.legend = FALSE,
  inherit.aes = FALSE,
  ...
)

参数

mapping

默认 NULL,使用预计算数据。

data

数据框,至少含 accver、start、end,可选 label、category、color。因子 start/end 使用数值标签而非级别编码。

fill

区域默认填色,默认 "#F59E0B"。

colour

轮廓颜色,默认 "#B45309"。

alpha

0–1 数值,区域透明度,默认 0.25。

region_width

区域带宽,单位为弦图半径,默认 0.08。

region_offset

相对序列弧的径向偏移,默认 0。

region_side

侧向取 "inside"、"outside" 或 "auto";"auto" 在可能时放在弦图内侧。

position, show.legend, inherit.aes

标准 ggplot2 图层参数。

...

传给 geom_polygon() 的其他参数。

返回值

一个 ggplot2 图层。

示例

代码
library(dplyr)
data(seq_data_example)
seqs <- seq_data_example |>
  select(accver, length)
data(ribbon_data_example)
links <- ribbon_data_example |>
  select(qaccver, saccver, qstart, qend, sstart, send)
region <- tibble(
  accver = links$qaccver[1], start = min(links$qstart[1], links$qend[1]),
  end = max(links$qstart[1], links$qend[1])
)
ggchord(seq_data = seqs) +
  geom_seq() +
  geom_seq_region(data = region)