View source: R/sequence-subsequences.R
| extract_sequence_subsequences | R Documentation |
Enumerates ordered non-contiguous subsequences under explicit length, gap, span, and safety limits. The implementation is transparent and intended for modest sequence collections; specialist mining packages remain preferable for very large search spaces.
extract_sequence_subsequences(
data,
sequence_id_col = "sequence_id",
order_col = "sequence_order",
state_col = "state",
metadata_cols = NULL,
min_length = 2L,
max_length = 5L,
max_gap = Inf,
max_span = Inf,
repeated_state_policy = c("preserve", "collapse"),
separator = " > ",
max_combinations_per_sequence = 100000L
)
data |
Long-format sequence data or a prepared result. |
sequence_id_col, order_col, state_col |
Core sequence columns. |
metadata_cols |
Optional sequence-constant metadata retained as attributes. |
min_length, max_length |
Minimum and maximum subsequence lengths. |
max_gap |
Maximum number of skipped positions between adjacent selected
states. Use |
max_span |
Maximum difference between the first and last selected
sequence positions. Use |
repeated_state_policy |
Preserve or collapse consecutive repeated states before mining. |
separator |
Separator used in stable motif labels. |
max_combinations_per_sequence |
Safety limit for the number of index combinations considered for any one sequence. |
A data frame of class gp3_sequence_subsequences, with one row per
qualifying occurrence.
sequences <- data.frame(
sequence_id = rep(c("s1", "s2"), each = 5L),
sequence_order = rep(1:5, times = 2L),
state = c("A", "B", "C", "D", "E", "A", "C", "B", "D", "E")
)
extract_sequence_subsequences(sequences, min_length = 2L, max_length = 3L,
max_gap = 2L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.