Commit f43d2993 authored by dmattek's avatar dmattek

Added (not completely): Bayesian clustering

parent 5a2e859f
source('modules/auxfunc.R') source('modules/auxfunc.R')
source('modules/downPlot.R') source('modules/downPlot.R')
source('modules/downCellIDsCls.R') source('modules/downCellIDsCls.R')
source('modules/tabScatter.R') source('modules/tabScatter.R')
\ No newline at end of file source('modules/tabClBay.R')
\ No newline at end of file
...@@ -145,14 +145,23 @@ userDataGen <- function() { ...@@ -145,14 +145,23 @@ userDataGen <- function() {
cat(file=stderr(), 'userDataGen: in\n') cat(file=stderr(), 'userDataGen: in\n')
locNtp = 40 locNtp = 40
locNtracks = 5 locNtracks = 100
locNsites = 4 locNsites = 4
locNwells = 2 locNwells = 1
x.rand.1 = c(rnorm(locNtp * locNtracks * locNsites * 0.5, 2, 0.5), rnorm(locNtp * locNtracks * locNsites * 0.5, 2, 0.5))
x.rand.2 = c(rnorm(locNtp * locNtracks * locNsites * 0.5, 0, 0.1), rnorm(locNtp * locNtracks * locNsites * 0.5, 0, 0.1))
x.rand.3 = rep(rnorm(locNtracks, 2, 0.5), 1, each = locNtp)
x.rand.4 = rep(rnorm(locNtracks, 1, 0.1), 1, each = locNtp)
x.arg = rep(seq(0, locNtp-1) / locNtp * 4 * pi, locNtracks * locNsites)
dt.nuc = data.table(Metadata_Site = rep(1:locNsites, each = locNtp * locNtracks), dt.nuc = data.table(Metadata_Site = rep(1:locNsites, each = locNtp * locNtracks),
Metadata_Well = rep(1:locNwells, each = locNtp * locNsites * locNtracks / locNwells), Metadata_Well = rep(1:locNwells, each = locNtp * locNsites * locNtracks / locNwells),
Metadata_RealTime = rep(1:locNtp, locNsites* locNtracks), Metadata_RealTime = x.arg,
objCyto_Intensity_MeanIntensity_imErkCor = c(rnorm(locNtp * locNtracks * locNsites * 0.5, .5, 0.1), rnorm(locNtp * locNtracks * locNsites * 0.5, 1, 0.2)), # objCyto_Intensity_MeanIntensity_imErkCor = c(rnorm(locNtp * locNtracks * locNsites * 0.5, .5, 0.1), rnorm(locNtp * locNtracks * locNsites * 0.5, 1, 0.2)),
# objNuc_Intensity_MeanIntensity_imErkCor = c(rnorm(locNtp * locNtracks * locNsites * 0.5, .25, 0.1), rnorm(locNtp * locNtracks * locNsites * 0.5, .5, 0.2)),
objCyto_Intensity_MeanIntensity_imErkCor = x.rand.3 + ifelse(x.arg < 4, 0, 1) / x.rand.3,
objNuc_Intensity_MeanIntensity_imErkCor = c(rnorm(locNtp * locNtracks * locNsites * 0.5, .25, 0.1), rnorm(locNtp * locNtracks * locNsites * 0.5, .5, 0.2)), objNuc_Intensity_MeanIntensity_imErkCor = c(rnorm(locNtp * locNtracks * locNsites * 0.5, .25, 0.1), rnorm(locNtp * locNtracks * locNsites * 0.5, .5, 0.2)),
TrackLabel = rep(1:(locNtracks*locNsites), each = locNtp)) TrackLabel = rep(1:(locNtracks*locNsites), each = locNtp))
......
# RShiny module for performing hierarchical clustering # RShiny module for the scatter plot
# Use: # Use:
# in ui.R # in ui.R
# tabPanel( # tabPanel(
...@@ -28,7 +28,7 @@ tabScatterPlotUI <- function(id, label = "Comparing t-points") { ...@@ -28,7 +28,7 @@ tabScatterPlotUI <- function(id, label = "Comparing t-points") {
4, 4,
uiOutput(ns('uiSelTptX')), uiOutput(ns('uiSelTptX')),
uiOutput(ns('uiSelTptY')), uiOutput(ns('uiSelTptY')),
checkboxInput(ns('chBfoldChange'), 'Y-axis displays fold change between the two t-points'), checkboxInput(ns('chBfoldChange'), 'Y-axis displays difference between two t-points'),
numericInput(ns('inNeighTpts'), '#t-pts left & right', value = 0, step = 1, min = 0), numericInput(ns('inNeighTpts'), '#t-pts left & right', value = 0, step = 1, min = 0),
radioButtons(ns('rBstats'), 'Operation:', list('Mean' = 1, 'Min' = 2, 'Max' = 3)) radioButtons(ns('rBstats'), 'Operation:', list('Mean' = 1, 'Min' = 2, 'Max' = 3))
), ),
...@@ -161,7 +161,7 @@ data4scatterPlot <- reactive({ ...@@ -161,7 +161,7 @@ data4scatterPlot <- reactive({
setnames(loc.dt, c('group.x', 'y.aggr.x', 'y.aggr.y'), c('group', 'x', 'y')) setnames(loc.dt, c('group.x', 'y.aggr.x', 'y.aggr.y'), c('group', 'x', 'y'))
if (input$chBfoldChange) { if (input$chBfoldChange) {
loc.dt[ , y := y / x] loc.dt[ , y := y - x]
} }
return(loc.dt) return(loc.dt)
...@@ -233,6 +233,7 @@ output$outPlotScatterInt <- renderPlotly({ ...@@ -233,6 +233,7 @@ output$outPlotScatterInt <- renderPlotly({
# When running on a server. Based on: # When running on a server. Based on:
# https://github.com/ropensci/plotly/issues/494 # https://github.com/ropensci/plotly/issues/494
locBut = input$butGoScatter
if (locBut == 0) { if (locBut == 0) {
cat(file=stderr(), 'plotScatterInt Go button not pressed\n') cat(file=stderr(), 'plotScatterInt Go button not pressed\n')
return(NULL) return(NULL)
......
...@@ -1459,4 +1459,7 @@ shinyServer(function(input, output, session) { ...@@ -1459,4 +1459,7 @@ shinyServer(function(input, output, session) {
labCol = loc.colnames labCol = loc.colnames
) )
}) })
callModule(clustBay, 'TabClustBay', data4clust)
}) })
...@@ -475,7 +475,12 @@ shinyUI(fluidPage( ...@@ -475,7 +475,12 @@ shinyUI(fluidPage(
actionButton('butPlotHierSparClDist', 'Plot!'), actionButton('butPlotHierSparClDist', 'Plot!'),
plotOutput('outPlotHierSparClDist')) plotOutput('outPlotHierSparClDist'))
) )
) ),
tabPanel(
'Bayesian Cl.',
clustBayUI('TabClustBay'))
)) ))
) )
)) ))
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment