Skip to contents
0.16.6 documentation

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

Site guide · find your task

Searches deterministic sequence-order and orientation changes that reduce weighted ribbon centre-line crossings and long chord spans. It never modifies the supplied data and never accepts a worse arrangement. Inputs above 2,000 ribbons use a deterministic 64-bin approximation and record approximate = TRUE in the returned report.

Usage

Code
optimize_ggchord_layout(
  seq_data,
  ribbon_data,
  seq_order = NULL,
  seq_orientation = NULL,
  optimize = c("order", "orientation"),
  weight = c("length", "count", "pident"),
  max_iter = 50L
)

Arguments

seq_data

Sequence data containing accver and length.

ribbon_data

Alignment data in ggchord ribbon format.

seq_order

Optional initial complete sequence order. The default uses the row order of seq_data.

seq_orientation

Optional initial orientation (1 or -1), scalar, complete vector, or named vector.

optimize

Any of "order" and "orientation".

weight

Objective weight: "length", "count", or "pident".

max_iter

Positive integer maximum number of improving search rounds.

Value

An object of class ggchord_layout_optimization containing seq_order, seq_orientation, before/after scores and a report.

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)
suggestion <- optimize_ggchord_layout(seqs, links, weight = "count")
suggestion$seq_order