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
Focus quantitative intervals or samples without bridging omitted windows
Source:R/focus-track.R
focus_ggchord_track.RdApplies the same explicit loci and output IDs as focus_ggchord_data() and
segment_ggchord_data(). It never averages, interpolates, rescales values,
or creates boundary samples. Missing values remain missing. Subsequent
track layers group by the returned window accession, so separate windows
cannot be joined by a line. Source coordinates and original row lineage
survive repeated focusing.
Arguments
- data
Quantitative input table. Metadata and mapped values are retained.
- seq_data
Sequence reference table.
- loci
Explicit
accver,start,endand optionallocus_id, as infocus_ggchord_data().- type
"point"requirespos;"interval"requiresstart/end.- boundary
"trim"(default) or"drop"for partly retained intervals.
Value
An ordinary data frame with focused coordinates. Its
ggchord_track_focus attribute reports output-to-input rows and omitted
input rows; .source_* columns retain earliest source coordinates.
Examples
Code
library(ggchord)
library(dplyr)
data(plasmid_example_pUC19)
track_seq <- plasmid_example_pUC19 |>
select(accver, length)
starts <- seq.int(1L, track_seq$length, by = 100L)
gc_fraction <- function(sequence) {
bases <- strsplit(sequence, "")[[1]]
mean(bases %in% c("G", "C"))
}
bins <- tibble(
accver = track_seq$accver,
start = starts,
end = pmin(starts + 99L, track_seq$length)
) |>
rowwise() |>
mutate(gc = gc_fraction(substr(plasmid_example_pUC19$sequence, start, end))) |>
ungroup()
loci <- tibble(accver = track_seq$accver, start = 501, end = 2000)
focus_ggchord_track(bins, track_seq, loci, type = "interval")