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 changes
Prepare independent windows for a segmented linear display
Source:R/data-segment.R
segment_ggchord_data.RdCrops through focus_ggchord_data() while retaining one sequence per
window. Pass segments to coord_collinear() to place those sequences in
shared display rows with explicit gaps and local reversals. Coordinates in
the returned tables remain window-local and are never concatenated.
Usage
Code
segment_ggchord_data(
seq_data,
ribbon_data = NULL,
gene_data = NULL,
windows,
point_data = NULL,
cross_gap = c("split", "drop"),
max_links = 10000
)Arguments
- seq_data
Full sequence table with unique
accverand integer lengths.- ribbon_data
Optional paired interval table.
- gene_data
Optional gene or generic feature table, including segments.
- windows
Table with
accver,start,end, uniquelocus_id, optionalrow_id(defaults to sourceaccver) andorientation(1 or -1, defaults to 1). Bounds must be ordered, integral and within the sequence.- point_data
Optional point links with
qaccver,saccver,qpos,spos.- cross_gap
How to handle interval links clipped by selected windows.
- max_links
Positive integer upper bound on candidate ribbon/point copies. Increase explicitly for larger, intentionally overlapping views.
Value
A list containing focused seq_data, ribbon_data, gene_data,
point_data, segments for the coordinate system, reversible source to
window transforms, and a report with input row numbers for every
output connection and omitted input rows. Each window retains its own
source accession, origin, full length and truncation flags.
Details
cross_gap = "split" retains only the parts of each ribbon's linear
endpoint correspondence that lie in both selected windows. Omitted regions
are never bridged by one ribbon polygon. "drop" retains only links fully
contained in a query and subject window. This is a display projection, not
realignment. Point links survive only when both endpoints are retained.
Overlapping windows can deliberately duplicate a source row; provenance
identifies each copy, and max_links bounds the candidate expansion before
allocation. Order in the window table is display order within each row.
Examples
Code
library(dplyr)
data(seq_data_example)
seqs <- seq_data_example |>
select(accver, length)
windows <- tibble(
accver = rep(seqs$accver[1], 2),
start = c(1, floor(seqs$length[1] * .65)),
end = c(floor(seqs$length[1] * .4), seqs$length[1]),
locus_id = c("left_window", "right_window"), row_id = seqs$accver[1]
)
segment_ggchord_data(slice_head(seqs, n = 1), windows = windows)