CapturePatternUI: CapturePatternUI

Description Usage Arguments Details Value See Also Examples

View source: R/CapturePattern.R

Description

The CapturePattern Module extracts captures from chr strings based on a regular expression and displays them.

Usage

1
CapturePatternUI(id, label)

Arguments

id

chr id of this object for shiny session

label

chr or NULL a lable/ title for the file upload

Details

The UI part is a text output of several lines.

Value

chr HTML for creating ui elements.

See Also

Other CapturePattern module functions: CapturePattern, GetCaptures

Examples

 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)

mRcSchwering/shinyTools documentation built on May 21, 2017, 4:43 p.m.