Commit 22f5a492 authored by dmattek's avatar dmattek

Changed:

- modularized plot download

Added:
- download CSV with cellIDs and cluster assignment
- download CSV after cleaning
parent ea935f44
source('auxfunc.R')
\ No newline at end of file
source('modules/auxfunc.R')
source('modules/downPlot.R')
source('modules/downCellIDsCls.R')
\ No newline at end of file
......@@ -152,8 +152,8 @@ userDataGen <- function() {
dt.nuc = data.table(Metadata_Site = rep(1:locNsites, each = locNtp * locNtracks),
Metadata_Well = rep(1:locNwells, each = locNtp * locNsites * locNtracks / locNwells),
Metadata_RealTime = rep(1:locNtp, locNsites* locNtracks),
objCyto_Intensity_MeanIntensity_imErkCor = rnorm(locNtp * locNtracks * locNsites, .5, 0.1),
objNuc_Intensity_MeanIntensity_imErkCor = rnorm(locNtp * locNtracks * locNsites, .5, 0.1),
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)),
TrackLabel = rep(1:(locNtracks*locNsites), each = locNtp))
cat(colnames(dt.nuc))
......
# RShiny module for downloading cellIDs with cluster numbers
# Use:
# in ui.R
# downPlotUI('uniqueID', "your_label")
#
# in server.R
# callModule(downPlot, "uniqueID", 'fname.pdf', input_plot_to_save)
downCellClUI <- function(id, label = "Download Data") {
ns <- NS(id)
tagList(
# Label to display as h4 header
h4(label),
downloadButton(ns('downCellCl'), 'CSV')
)
}
downCellCl <- function(input, output, session, in.fname, in.data) {
output$downCellCl <- downloadHandler(
filename = function() {
in.fname
},
content = function(file) {
write.csv(x = in.data, file = file, row.names = FALSE)
}
)
}
\ No newline at end of file
# RShiny module for downloading pdf of the plot
# Use:
# in ui.R
# downPlotUI('uniqueID', "your_label")
#
# in server.R
# callModule(downPlot, "uniqueID", 'fname.pdf', input_plot_to_save)
downPlotUI <- function(id, label = "Download Plot") {
ns <- NS(id)
tagList(
# Label to display as h4 header
h4(label),
fluidRow(
column(
3,
numericInput(
ns('inPlotWidth'),
"Width",
17,
min = 1,
width = 100
)
),
column(
3,
numericInput(
ns('inPlotHeight'),
"Height",
10,
min = 1,
width = 100
)
),
column(6,
downloadButton(ns('downPlot'), 'PDF'))
)
)
}
downPlot <- function(input, output, session, in.fname, in.plot, in.gg = FALSE) {
output$downPlot <- downloadHandler(
filename = function() {
in.fname
},
content = function(file) {
if (in.gg) {
ggsave(
file,
limitsize = FALSE,
in.plot(),
width = input$inPlotWidth,
height = input$inPlotHeight
)
} else {
pdf(file,
width = input$inPlotWidth,
height = input$inPlotHeight)
in.plot()
dev.off()
}
}
)
}
\ No newline at end of file
This diff is collapsed.
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