View source: R/sequence-motifs.R
| filter_sequence_motifs | R Documentation |
Applies transparent count, prevalence, length, and top-ranking filters to sequence motif summaries.
filter_sequence_motifs(
x,
min_occurrences = 1L,
min_sequences = 1L,
min_prevalence = 0,
motif_lengths = NULL,
top_n = NULL,
rank_by = c("sequence_prevalence", "n_occurrences", "n_sequences"),
ties = c("include", "first")
)
x |
A motif extraction, motif summary, or filtered-motif object. |
min_occurrences |
Non-negative whole number giving the minimum total occurrence count. |
min_sequences |
Non-negative whole number giving the minimum number of sequences containing the motif. |
min_prevalence |
Minimum sequence prevalence between 0 and 1. |
motif_lengths |
Optional vector of positive whole-number motif lengths to retain. |
top_n |
Optional positive whole number giving the requested number of highest-ranked motifs. |
rank_by |
Metric used for deterministic top-ranking: one of
|
ties |
Character value controlling the top- |
Filtering is descriptive and deterministic. When ties = "first", ties are
resolved by sequence prevalence, occurrence count, sequence count, shorter
motif length, and finally the collision-resistant motif key.
A named list containing the filtered motifs table, the matching
sequence-level rows in by_sequence, sequence and state dictionaries,
validation metadata, filter settings, and counts before and after filtering.
sequences <- data.frame(
id = c(rep("s1", 5L), rep("s2", 4L)),
position = c(1:5, 1:4),
state = c("A", "B", "A", "B", "A", "A", "B", "A", "C")
)
extracted <- extract_sequence_ngrams(
sequences,
sequence_id_col = "id",
order_col = "position",
state_col = "state"
)
filtered <- filter_sequence_motifs(
extracted,
min_sequences = 2,
top_n = 5,
ties = "include"
)
filtered$motifs
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.