Skip to contents
0.16.6 documentation

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

Site guide · find your task

A directed-gene shortcut using the generic geom_feature() constructor with arrow geometry and the independent gene_fill role. Gene input still requires a known + or - strand; use geom_feature() for unknown strands. The gene fill scale is kept independent from the ribbon's fill scale via a separate internal aesthetic used by the ribbon layer.

Usage

Code
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,
  ...
)

Arguments

mapping

Default NULL (uses pre-computed data)

data

Default NULL (retrieved automatically from the layout)

width

Optional numeric/vector/list. Width of gene arrows, default 0.05

arrow_head_length, arrow_head_width

Shared arrow-head dimensions in the sequence-local frame.

arrow_head_style

Arrowhead construction: shouldered, flush, or a full triangular wedge.

short_feature

Fallback for arrows too short to hold their requested head: automatic wedge/block selection, a wedge, or a block.

position

Feature placement. Use "identity", "strand", "plasmid", position_strand(), position_plasmid(), or position_feature_stack().

show.legend, inherit.aes

Standard ggplot2 layer arguments.

...

Additional arguments passed to geom_polygon()

Value

A ggplot2 layer. To annotate the genes with their labels, add a geom_gene_label() layer.

Examples

Code
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()