Title: | Molecular Biology Visualization Tools for 'Shiny' Apps |
---|---|
Description: | Interactive visualization of 'RDML' files via 'shiny' apps. Package provides (1) PCR plate interface with ability to select individual tubes; (2) amplification/melting plots with fast hiding and highlighting individual curves; (3) 2D allelic discrimination plot. |
Authors: | Konstantin A. Blagodatskikh [cre, aut] |
Maintainer: | Konstantin A. Blagodatskikh <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.6 |
Built: | 2024-11-05 12:37:05 UTC |
Source: | https://github.com/pcruniversum/shinymolbio |
Create an input control for representing PCR plate and dynamically selecting wells inside it.
pcrPlateInput(inputId, label = NULL, plateDescription, pcrFormat = pcrFormatType$new(8, 12, labelFormatType$new("ABC"), labelFormatType$new("123")), selection = NULL, highlighting = NULL, wellLabelTemplate = "{{sample}}", onHoverWellTextTemplate = "{{position}}\u000A{{sample}}\u000A{{targets}}", wellClassTemplate = NULL, wellStyleTemplate = NULL, wellGroupTemplate = "{{sample}}-{{targets}}", cssFile = system.file("/css/pcrPlateInputStyle.css", package = "shinyMolBio"), cssText = NULL, legend = NULL, interactive = TRUE)
pcrPlateInput(inputId, label = NULL, plateDescription, pcrFormat = pcrFormatType$new(8, 12, labelFormatType$new("ABC"), labelFormatType$new("123")), selection = NULL, highlighting = NULL, wellLabelTemplate = "{{sample}}", onHoverWellTextTemplate = "{{position}}\u000A{{sample}}\u000A{{targets}}", wellClassTemplate = NULL, wellStyleTemplate = NULL, wellGroupTemplate = "{{sample}}-{{targets}}", cssFile = system.file("/css/pcrPlateInputStyle.css", package = "shinyMolBio"), cssText = NULL, legend = NULL, interactive = TRUE)
inputId |
The |
label |
Display label for the control, or |
plateDescription |
Plate description - basicly output from |
pcrFormat |
PCR plate parametrs. Should be |
selection |
Set preselected wells (e.g. |
highlighting |
Set highlighted wells (e.g. |
wellLabelTemplate |
Template of the well label. |
onHoverWellTextTemplate |
Template of the text on hover. |
wellClassTemplate |
Template of the well class (css class). |
wellStyleTemplate |
Template of the well style (css). |
wellGroupTemplate |
Template of the well group for selecting. |
cssFile |
Path to the css styles file. |
cssText |
CSS styles as text. |
legend |
Plate legend (any HTML content). |
interactive |
Should be this |
A PCR plate control that can be added to a UI definition.
Konstantin A. Blagodatskikh <[email protected]>
## Only run examples in interactive R sessions library(RDML) if (interactive()) { ui <- fluidPage( pcrPlateInput("plate1", "Plate 1", RDML$new(system.file("/extdata/stepone_std.rdml", package = "RDML"))$AsTable(), pcrFormatType$new(8,12,labelFormatType$new("ABC"), labelFormatType$new("123"))), verbatimTextOutput("selected") ) server <- function(input, output) { output$selected <- renderText({ input$plate1 }) } shinyApp(ui, server) }
## Only run examples in interactive R sessions library(RDML) if (interactive()) { ui <- fluidPage( pcrPlateInput("plate1", "Plate 1", RDML$new(system.file("/extdata/stepone_std.rdml", package = "RDML"))$AsTable(), pcrFormatType$new(8,12,labelFormatType$new("ABC"), labelFormatType$new("123"))), verbatimTextOutput("selected") ) server <- function(input, output) { output$selected <- renderText({ input$plate1 }) } shinyApp(ui, server) }
Print a adPlot
## S3 method for class 'adPlot' print(x)
## S3 method for class 'adPlot' print(x)
x |
object of class |
Konstantin A. Blagodatskikh <[email protected]>
renderAmpCurves
, renderMeltCurves
Print a pcrCurves
## S3 method for class 'pcrCurves' print(x)
## S3 method for class 'pcrCurves' print(x)
x |
object of class |
Konstantin A. Blagodatskikh <[email protected]>
renderAmpCurves
, renderMeltCurves
library(RDML) rdml <- RDML$new(system.file("/extdata/test.rdml", package = "shinyMolBio")) curves <- renderMeltCurves("curves1", meltCurves = rdml$GetFData(dp.type = "mdp", long.table = TRUE)) curves
library(RDML) rdml <- RDML$new(system.file("/extdata/test.rdml", package = "shinyMolBio")) curves <- renderMeltCurves("curves1", meltCurves = rdml$GetFData(dp.type = "mdp", long.table = TRUE)) curves
Print a pcrPlate
## S3 method for class 'pcrPlate' print(x)
## S3 method for class 'pcrPlate' print(x)
x |
object of class |
Konstantin A. Blagodatskikh <[email protected]>
Renders a reactive allelic discrimination plot that is suitable for
assigning to an UI output
slot.
renderADplot(inputId, label = NULL, adData, targetColumn = "target.dyeId", xAxisTarget = "FAM", yAxisTarget = "HEX", valueColumn = "endPointRFU", colorBy = "genotype", polar = FALSE, showLegend = FALSE, plotlyCode = NULL, cssFile = NULL, cssText = NULL, interactive = TRUE)
renderADplot(inputId, label = NULL, adData, targetColumn = "target.dyeId", xAxisTarget = "FAM", yAxisTarget = "HEX", valueColumn = "endPointRFU", colorBy = "genotype", polar = FALSE, showLegend = FALSE, plotlyCode = NULL, cssFile = NULL, cssText = NULL, interactive = TRUE)
inputId |
The |
label |
Display label for the control, or |
adData |
Allelic descrimination data with
|
targetColumn |
Column name that contains axis splitting (dye or target). |
xAxisTarget |
X axis target (dye) name. |
yAxisTarget |
X axis target (dye) name. |
valueColumn |
Column name that contains discrimination value (RFU or cq). |
colorBy |
Column name that contains color levels data. |
polar |
Enables polar coordinates. |
showLegend |
Show plot legend. |
plotlyCode |
Your quoted custom plotly code. |
cssFile |
Path to the css styles file. |
cssText |
CSS styles as text. |
interactive |
Should be this |
Konstantin A. Blagodatskikh <[email protected]>
Other render elements:
renderAmpCurves()
,
renderMeltCurves()
library(RDML) rdml <- RDML$new(system.file("/extdata/test.rdml", package = "shinyMolBio")) tbl <- rdml$AsTable(endPointRFU = mean(tail(data$adp$fpoints$fluor, 5))) tbl <- group_by(tbl, position) tbl <- mutate(tbl, genotype = paste( if (endPointRFU[1] > 400 && endPointRFU[2] > 400) "AG" else if (endPointRFU[1] > 400) "AA" else if (endPointRFU[2] > 400) "GG" else "NA" )) renderADplot("f", "aa", tbl, polar = TRUE, showLegend = TRUE)
library(RDML) rdml <- RDML$new(system.file("/extdata/test.rdml", package = "shinyMolBio")) tbl <- rdml$AsTable(endPointRFU = mean(tail(data$adp$fpoints$fluor, 5))) tbl <- group_by(tbl, position) tbl <- mutate(tbl, genotype = paste( if (endPointRFU[1] > 400 && endPointRFU[2] > 400) "AG" else if (endPointRFU[1] > 400) "AA" else if (endPointRFU[2] > 400) "GG" else "NA" )) renderADplot("f", "aa", tbl, polar = TRUE, showLegend = TRUE)
Renders a reactive PCR amplification plot that is suitable for assigning to
an UI output
slot.
renderAmpCurves(inputId, label = NULL, ampCurves, colorBy = NULL, linetypeBy = NULL, logScale = FALSE, showCq = FALSE, showLegend = FALSE, thBy = NULL, plotlyCode = NULL, cssFile = NULL, cssText = NULL, interactive = TRUE)
renderAmpCurves(inputId, label = NULL, ampCurves, colorBy = NULL, linetypeBy = NULL, logScale = FALSE, showCq = FALSE, showLegend = FALSE, thBy = NULL, plotlyCode = NULL, cssFile = NULL, cssText = NULL, interactive = TRUE)
inputId |
The |
label |
Display label for the control, or |
ampCurves |
Amplification curves data with
|
colorBy |
Column name that contains color levels data. |
linetypeBy |
Column name that contains linetype levels data. |
logScale |
Converts plot to |
showCq |
Shows Cq with dots ( |
showLegend |
Show plot legend. |
thBy |
Column name that separates threshold values ( |
plotlyCode |
Your quoted custom plotly code. |
cssFile |
Path to the css styles file. |
cssText |
CSS styles as text. |
interactive |
Should be this |
Konstantin A. Blagodatskikh <[email protected]>
Other render elements:
renderADplot()
,
renderMeltCurves()
library(RDML) rdml <- RDML$new(system.file("/extdata/test.rdml", package = "shinyMolBio")) curves <- renderAmpCurves("curves1", ampCurves = rdml$GetFData(long.table = TRUE)) curves
library(RDML) rdml <- RDML$new(system.file("/extdata/test.rdml", package = "shinyMolBio")) curves <- renderAmpCurves("curves1", ampCurves = rdml$GetFData(long.table = TRUE)) curves
Renders a reactive melting plot that is suitable for assigning to an UI
output
slot.
renderMeltCurves(inputId, label = NULL, meltCurves, fluorColumn = "fluor", colorBy = NULL, linetypeBy = NULL, showTm = FALSE, showLegend = FALSE, plotlyCode = NULL, cssFile = NULL, cssText = NULL, interactive = TRUE)
renderMeltCurves(inputId, label = NULL, meltCurves, fluorColumn = "fluor", colorBy = NULL, linetypeBy = NULL, showTm = FALSE, showLegend = FALSE, plotlyCode = NULL, cssFile = NULL, cssText = NULL, interactive = TRUE)
inputId |
The |
label |
Display label for the control, or |
meltCurves |
Melting curves data with |
fluorColumn |
Column name that contains fluorescence values
(can be |
colorBy |
Column name that contains color levels data. |
linetypeBy |
Column name that contains linetype levels data. |
showTm |
Shows Tm with dots ( |
showLegend |
Show plot legend. |
plotlyCode |
Your quoted custom plotly code. |
cssFile |
Path to the css styles file. |
cssText |
CSS styles as text. |
interactive |
Should be this |
Konstantin A. Blagodatskikh <[email protected]>
Other render elements:
renderADplot()
,
renderAmpCurves()
library(RDML) rdml <- RDML$new(system.file("/extdata/test.rdml", package = "shinyMolBio")) curves <- renderMeltCurves("curves1", meltCurves = rdml$GetFData(dp.type = "mdp", long.table = TRUE)) curves
library(RDML) rdml <- RDML$new(system.file("/extdata/test.rdml", package = "shinyMolBio")) curves <- renderMeltCurves("curves1", meltCurves = rdml$GetFData(dp.type = "mdp", long.table = TRUE)) curves
Launch shinyMolBio example applications
runExample(example)
runExample(example)
example |
The name of the example to run, or NA (the default) to list the available examples. |
Konstantin A. Blagodatskikh <[email protected]>
## Only run this example in interactive R sessions if (interactive()) { # List all available examples runExample() # Run one of the examples runExample("pcrPlateInput") # Print the directory containing the code for all examples system.file("shiny-examples", package="shinyMolBio") }
## Only run this example in interactive R sessions if (interactive()) { # List all available examples runExample() # Run one of the examples runExample("pcrPlateInput") # Print the directory containing the code for all examples system.file("shiny-examples", package="shinyMolBio") }
Change the value of a render ADplot control on the client
updateADplot( session, inputId, label = NULL, hidePoints = NULL, highlightPoints = NULL )
updateADplot( session, inputId, label = NULL, hidePoints = NULL, highlightPoints = NULL )
session |
The |
inputId |
The id of the |
label |
The label to set for the input object. |
hidePoints |
The |
highlightPoints |
The |
Konstantin A. Blagodatskikh <[email protected]>
Change the value of a render PCR curves control on the client
updateCurves( session, inputId, label = NULL, hideCurves = NULL, highlightCurves = NULL )
updateCurves( session, inputId, label = NULL, hideCurves = NULL, highlightCurves = NULL )
session |
The |
inputId |
The id of the |
label |
The label to set for the input object. |
hideCurves |
The |
highlightCurves |
The |
Konstantin A. Blagodatskikh <[email protected]>
Change the value of a PCR plate input control on the client
updatePcrPlateInput( session, inputId, label = NULL, selection = NULL, highlighting = NULL )
updatePcrPlateInput( session, inputId, label = NULL, selection = NULL, highlighting = NULL )
session |
The |
inputId |
The id of the |
label |
The label to set for the input object. |
selection |
The positions of the wells to be selected. |
highlighting |
The positions of the wells to be highlighted. |
Konstantin A. Blagodatskikh <[email protected]>
## Only run examples in interactive R sessions library(RDML) if (interactive()) { ui <- fluidPage( pcrPlateInput("plate1", "Plate 1", RDML$new(system.file("/extdata/stepone_std.rdml", package = "RDML"))$AsTable(), pcrFormatType$new(8,12,labelFormatType$new("ABC"), labelFormatType$new("123"))), verbatimTextOutput("selected"), actionButton("selectWellBtn", "Select Well A01-A03") ) server <- function(input, output, session) { output$selected <- renderText({ input$plate1 }) observeEvent( input$selectWellBtn, { updatePcrPlateInput(session, "plate1", selection = c("A01", "A02", "A03")) }) } shinyApp(ui, server) }
## Only run examples in interactive R sessions library(RDML) if (interactive()) { ui <- fluidPage( pcrPlateInput("plate1", "Plate 1", RDML$new(system.file("/extdata/stepone_std.rdml", package = "RDML"))$AsTable(), pcrFormatType$new(8,12,labelFormatType$new("ABC"), labelFormatType$new("123"))), verbatimTextOutput("selected"), actionButton("selectWellBtn", "Select Well A01-A03") ) server <- function(input, output, session) { output$selected <- renderText({ input$plate1 }) observeEvent( input$selectWellBtn, { updatePcrPlateInput(session, "plate1", selection = c("A01", "A02", "A03")) }) } shinyApp(ui, server) }