View source: R/selected_position.R
| id_to_sequence_position | R Documentation |
id_to_sequence_positon converts selected columns in the gene.alignment.tables visualisation to positions in the original sequence dataset.
id_to_sequence_position(id, shiny.input)
id |
InputID of the format aDTXXXXX_n_m_columns_selected from the |
shiny.input |
The input object of the Shiny app |
## Not run:
## create a set of reactiveValues to store the selected column ids
selected_col_values <- reactiveValues()
## observe all input values matching the format aDTXXXXX_n_m_columns_selected
observe({
if (!is.null(input[[paste0(alignment.dt.unique.id,
"_1_",
table_width,
"_rows_current")]])) {
selected_col_values[["previous"]] <-
isolate(selected_col_values[["current"]])
all_inputs <- isolate(reactiveValuesToList(input))
inputs_selected_cols <-
grepl(
paste0(
alignment.dt.unique.id,
"_[0-9]{1,}_[0-9]{1,}_columns_selected"
),
names(all_inputs)
)
inputs_with_nulls <- all_inputs[inputs_selected_cols]
inputs_selected_cols <-
setNames(inputs_with_nulls, names(all_inputs)[inputs_selected_cols])
selected_positions <-
lapply(names(inputs_selected_cols), function(id) {
id_to_sequence_position(id, shiny.input = input)
}) %>%
unlist()
selected_positions
} else {
if (is.null(selected_col_values[["current"]])){
selected_positions <- NULL
}
else {
selected_positions <- selected_col_values[["current"]]
}
}
selected_col_values[["current"]] <- selected_positions
})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.