跳到正文
0.16.6 文档

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

全站目录 · 按任务查找

基于通用构造函数 geom_feature() 的有方向基因快捷图层,使用箭头及独立的 gene_fill 角色。输入必须具有已知的 + 或 - 链;未知链请用 geom_feature()。基因填色与区间连接填色使用不同的内部 aesthetic,因此标度互相独立。

用法

代码
geom_gene(
  mapping = NULL,
  data = NULL,
  width = NULL,
  arrow_head_length = 0.04,
  arrow_head_width = 1,
  arrow_head_style = c("shouldered", "flush", "triangle"),
  short_feature = c("auto", "wedge", "block"),
  position = "identity",
  show.legend = TRUE,
  inherit.aes = FALSE,
  ...
)

参数

mapping

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

data

默认 NULL,从布局自动获取。

width

可选数值、向量或列表,基因箭头宽度,默认 0.05。

arrow_head_length, arrow_head_width

序列局部坐标中的共享箭头尺寸。

arrow_head_style

箭头形状:凸肩、齐平或完整三角楔形。

short_feature

基因太短、容不下指定箭头时,自动选择楔形/矩形,或明确使用其中一种。

position

注释位置,使用 "identity"、"strand"、"plasmid"、position_strand()、position_plasmid() 或 position_feature_stack()。

show.legend, inherit.aes

标准 ggplot2 图层参数。

...

传给 geom_polygon() 的其他参数。

返回值

一个 ggplot2 图层;添加 geom_gene_label() 图层可标注基因名称。

示例

代码
library(dplyr)
data(seq_data_example)
seqs <- seq_data_example |>
  select(accver, length)
data(gene_data_example)
genes <- gene_data_example |>
  transmute(accver, start, end, strand = source_strand)
ggchord(seq_data = seqs, gene_data = genes) +
  geom_seq() +
  geom_gene()