View source: R/sequence-motif-visualisation.R
| plot_sequence_motif_positions | R Documentation |
Shows occurrence locations for selected contiguous motifs.
plot_sequence_motif_positions(
x,
motifs = NULL,
position = c("start", "centre", "end"),
scale = c("absolute", "relative"),
top_n = 10L,
display = c("strip", "distribution")
)
x |
An object returned by |
motifs |
Optional character vector of motif identifiers, motif keys, or displayed motif labels. When omitted, motifs are selected deterministically by occurrence count, sequence count, motif length, and motif key. |
position |
Occurrence position represented by motif |
scale |
Position scale: one-based |
top_n |
Positive whole number giving the number of motifs selected when
|
display |
Base-R display type: occurrence |
The strip display uses deterministic vertical stacking rather than random jitter. The distribution display uses one horizontal boxplot per motif. Empty inputs produce an informative blank plot and return an empty table. The function provides structural location summaries only.
Invisibly returns the exact occurrence-level data used by the plot, including deterministic motif ranks and plotting coordinates where relevant.
sequences <- data.frame(
id = c(rep("s1", 5L), rep("s2", 4L)),
position = c(1:5, 1:4),
state = c("A", "B", "A", "B", "C", "A", "B", "C", "B")
)
extracted <- extract_sequence_ngrams(
sequences,
sequence_id_col = "id",
order_col = "position",
state_col = "state"
)
plot_sequence_motif_positions(
extracted,
position = "centre",
scale = "relative",
top_n = 5,
display = "strip"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.