Skip to contents
0.16.6 documentation

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

Site guide · find your task

Applies 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.

Usage

Code
focus_ggchord_track(
  data,
  seq_data,
  loci,
  type = c("point", "interval"),
  boundary = c("trim", "drop")
)

Arguments

data

Quantitative input table. Metadata and mapped values are retained.

seq_data

Sequence reference table.

loci

Explicit accver, start, end and optional locus_id, as in focus_ggchord_data().

type

"point" requires pos; "interval" requires start/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")