Complete canonical API text; task articles explain the workflows. Tutorials
Site guide · find your task
Setup and learning paths
HomeInstall and prepare the environmentChoose your learning moduleModule I · Chord
1.1 Tables and field meanings1.2 Produce and import comparisons1.3 Build the layers step by step1.4 Direction, curvature and clearance1.5 Filter and summarize links1.6 Full source-file workflow1.7 Complete chord showcaseModule II · Collinear
2.1 Reuse chord input tables2.2 Switch coordinates and add layers2.3 Routes, clearance and the ruler2.4 Compare CDS neighbourhoods2.5 Focus, anchors and segments2.6 Complete collinear showcaseModule III · Plasmid
3.1 DNA, annotations and 13 references3.2 From a circle to annotation layers3.3 Features, primers and restriction3.4 Thirteen plasmid references3.5 Complete plasmid casesConsult as needed · Data and layers
Prepare tables and coordinatesImport and convert dataImport nucleotide and protein alignmentsProject protein intervals to genomic coordinatesFeatures, stacking and genomic decorationLabels and local placementQuantitative tracksMappings, scales, guides and themesSet values by sequence and strandCommon adjustments and grammarExport, preview and diagnosticsLearning map and reference
Articles and complete workflowsFunction referenceReproducible galleryFrequently asked questionsMigrate to the candidate APITerminology and design sourcesDevelopment status and changesA general layer for CDS, tRNA, rRNA, repeat, CRISPR, promoter or user-defined features. It supports directional arrows, blocks, notched chevrons and lollipops, all generated against the sequence's real local curve. Feature fill and geometry use independent role-specific scales.
Usage
Code
geom_feature(
mapping = NULL,
data = NULL,
shape = "arrow",
width = NULL,
arrow_head_length = 0.04,
arrow_head_width = 1,
arrow_head_style = c("shouldered", "flush", "triangle"),
short_feature = c("auto", "wedge", "block"),
segment_boundaries = TRUE,
boundary_colour = "#666666",
boundary_linewidth = 0.25,
boundary_linetype = "22",
position = "identity",
show.legend = TRUE,
inherit.aes = FALSE,
...
)Arguments
- mapping
Optional aesthetic mapping. Role aesthetics such as
accver,start,endandstrandmay rename input columns; ordinary visual mappings are evaluated after geometry is generated.- data
data.frame with
accver,start,endandstrand; optionaltype,categoryandlabel. Factorstart/endcolumns use their numeric labels, not their internal level codes. Coordinates must resolve to finite numbers.display_priorityor logicalprioritized_display. As an alternative tostrand,directionalityordirectionmay contain"forward","reverse","bidirectional", or"none".- shape
Fixed feature geometry. An explicitly supplied shape takes precedence over
aes(feature_shape = ...):"arrow","compact_arrow","promoter_arrow","primer_arrow","marker","block","capped_line","primer_arc","chevron", or"lollipop". The default is"arrow". Useaes(feature_shape = type)together withscale_feature_shape_manual()to map categories to geometry.- width
Optional numeric/vector/list controlling width in the shared feature geometry engine. In a circular feature-label composition, the base width responds to final label size within bounded limits.
- arrow_head_length, arrow_head_width
Arrow-head dimensions in the sequence-local frame, shared with
geom_gene(). Values above one forarrow_head_widthcreate a protruding block-arrow head.- arrow_head_style
Arrowhead construction:
"shouldered"keeps the requested protruding head,"flush"keeps it level with the body, and"triangle"draws a full triangular wedge.- short_feature
Fallback for arrows too short to hold their requested head: an automatically compressed directional glyph, a wedge, or a block.
- segment_boundaries
Draw explicit internal marks carried by a segmented feature. Contiguous source-segment joins use dotted dividers; a non-solid segment-level
line_stylemay override them, while acleavage_arrowscoordinate adds or merges a biological cut mark. These marks never create additional arrowheads.- boundary_colour, boundary_linewidth, boundary_linetype
Appearance of internal segment joins.
- position
Feature placement. Use
"identity","strand","plasmid",position_strand(),position_plasmid(), orposition_feature_stack().- show.legend, inherit.aes
Standard ggplot2 layer arguments.
- ...
Additional fixed polygon aesthetics.
Examples
Code
library(dplyr)
data(plasmid_example_pUC19)
seqs <- plasmid_example_pUC19 |>
select(accver, length)
feature_source <- find_common_features(plasmid_example_pUC19)
features <- feature_source |>
select(accver, start, end, strand, type, anno)
# ASCII display copy for the default PDF help-example device.
features <- features |>
mutate(anno = gsub("\u03b1", "alpha", anno, fixed = TRUE))
ggchord(seq_data = seqs) +
geom_seq() +
geom_feature(
data = features,
shape = "block"
) +
coord_circular()