Description Usage Arguments Details Value See Also Examples
View source: R/CapturePattern.R
The CapturePattern Module extracts captures from chr strings based on a regular expression and displays them.
1 | CapturePatternUI(id, label)
|
id |
chr id of this object for shiny session |
label |
chr or NULL a lable/ title for the file upload |
The UI part is a text output of several lines.
chr HTML for creating ui elements.
Other CapturePattern module functions: CapturePattern
,
GetCaptures
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | library(shinyTools)
# some generic strings with regular expressions
regexes <- list("^(.+?)_.*$", "^(.+?)_(.*?)_(.*?)\\.(.*)$", "^.*(SG.+?)1.*_(.+?)_.*$")
lib <- paste0("ENSG00000139", apply(expand.grid(0:9, 0:9, 0:9, "_8_", sample(20000:60000, 5), ".", sample(20000:60000, 5)),
1, function(x) paste0(x, collapse = "")))
# little app with module
ui <- fluidPage(sidebarLayout(
sidebarPanel( width = 4, h2("Pattern as input"), p("Not part of Module UI"),
selectizeInput("regex", "Regex", choices = regexes, options = list(create = TRUE)),
helpText("Write your own Regex to try out.")
),
mainPanel( width = 8, h2("CapturePatternUI"),
CapturePatternUI("cap", "Patterns Captured")
)
))
server <-function(input, output, session) {
callModule(CapturePattern, "cap", pat = reactive(input$regex), lines = reactive(lib))
}
shinyApp(ui, server)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.