Skip to contents
0.16.6 documentation

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

Site guide · find your task

Aggregates nearby alignment ribbons on a normalized query/subject grid. Bundling is always explicit: geom_link_ribbon() continues to draw one ribbon per input row unless the returned data are supplied by the user. Groups use relative endpoint direction, so reversing both ends can remain in the same group. The envelope follows the first row's absolute directions; length and identity are length-weighted source means (length is rounded), not statistics of a newly computed alignment. Conflicting extra metadata become typed missing values. Use group_by to keep source categories separate and retain the original input with the source-row report. Single-base endpoint rows stay independent because their endpoint order cannot define an absolute aggregate direction. Density can still count them without merging their geometry.

Usage

Code
bundle_ggchord_ribbons(
  ribbon_data,
  seq_data,
  bins = 80L,
  min_bundle = 2L,
  weight = c("length", "count", "pident"),
  group_by = NULL
)

Arguments

ribbon_data

Alignment data in ggchord ribbon format.

seq_data

Sequence data containing accver and length.

bins

Positive integer number of normalized midpoint bins per sequence, default 80.

min_bundle

Minimum number of rows required for aggregation, default 2. Smaller groups remain as individual ribbons.

weight

Bundle weight: "length", "count", or "pident". Identity weight is aligned length multiplied by identity proportion.

group_by

Optional character columns that must agree before ribbons can be bundled.

Value

A list with data and report. The data include .bundle_n, .bundle_weight, and .bundle_density; the report maps each output row back to its source rows.

Examples

Code
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, pident, length)
out <- bundle_ggchord_ribbons(links, seqs, bins = 30)
out$report