Commit a168f75e authored by dmattek's avatar dmattek

Added: checkbox for NA interpolation. Time frequency input shows only when NA interpolation = T.

parent 7b7d8294
...@@ -144,14 +144,16 @@ shinyServer(function(input, output, session) { ...@@ -144,14 +144,16 @@ shinyServer(function(input, output, session) {
output$varSelTimeFreq = renderUI({ output$varSelTimeFreq = renderUI({
cat(file = stderr(), 'UI varSelTimeFreq\n') cat(file = stderr(), 'UI varSelTimeFreq\n')
numericInput( if (input$chBtrajInter) {
'inSelTimeFreq', numericInput(
'Provide time frequency:', 'inSelTimeFreq',
min = 1, 'Provide time frequency:',
step = 1, min = 1,
width = '100%', step = 1,
value = 1 width = '100%',
) value = 1
)
}
}) })
# This is main field to select plot facet grouping # This is main field to select plot facet grouping
...@@ -619,34 +621,37 @@ shinyServer(function(input, output, session) { ...@@ -619,34 +621,37 @@ shinyServer(function(input, output, session) {
# Therefore, we cnanot rely on that info to get time frequency; user provides this number! # Therefore, we cnanot rely on that info to get time frequency; user provides this number!
setkey(loc.out, group, id, realtime) setkey(loc.out, group, id, realtime)
# here we fill missing data with NA's
loc.out = loc.out[setkey(loc.out[, .(seq(min(realtime), max(realtime), input$inSelTimeFreq)), by = .(group, id)], group, id, V1)]
# x-check: print all rows with NA's if (input$chBtrajInter) {
print('Rows with NAs:') # here we fill missing data with NA's
print(loc.out[rowSums(is.na(loc.out)) > 0, ]) loc.out = loc.out[setkey(loc.out[, .(seq(min(realtime), max(realtime), input$inSelTimeFreq)), by = .(group, id)], group, id, V1)]
# NA's may be already present in the dataset'. # x-check: print all rows with NA's
# Interpolate (linear) them with na.interpolate as well print('Rows with NAs:')
if(locPos) print(loc.out[rowSums(is.na(loc.out)) > 0, ])
s.cols = c('y', 'pos.x', 'pos.y')
else # NA's may be already present in the dataset'.
s.cols = c('y') # Interpolate (linear) them with na.interpolate as well
if(locPos)
loc.out[, (s.cols) := lapply(.SD, na.interpolation), by = id, .SDcols = s.cols] s.cols = c('y', 'pos.x', 'pos.y')
else
s.cols = c('y')
# !!! Current issue with interpolation:
# The column mid.in is not taken into account. loc.out[, (s.cols) := lapply(.SD, na.interpolation), by = id, .SDcols = s.cols]
# If a trajectory is selected in the UI,
# the mid.in column is added (if it doesn't already exist in the dataset),
# and for the interpolated point, it will still be NA. Not really an issue. # !!! Current issue with interpolation:
# # The column mid.in is not taken into account.
# Also, think about the current option of having mid.in column in the uploaded dataset. # If a trajectory is selected in the UI,
# Keep it? Expand it? # the mid.in column is added (if it doesn't already exist in the dataset),
# Create a UI filed for selecting the column with mid.in data. # and for the interpolated point, it will still be NA. Not really an issue.
# What to do with that column during interpolation (see above) #
# Also, think about the current option of having mid.in column in the uploaded dataset.
# Keep it? Expand it?
# Create a UI filed for selecting the column with mid.in data.
# What to do with that column during interpolation (see above)
}
## Trim x-axis (time) ## Trim x-axis (time)
if(input$chBtimeTrim) { if(input$chBtimeTrim) {
......
...@@ -42,6 +42,7 @@ shinyUI(fluidPage( ...@@ -42,6 +42,7 @@ shinyUI(fluidPage(
uiOutput('uiButLoadTrajRem'), uiOutput('uiButLoadTrajRem'),
tags$hr(), tags$hr(),
checkboxInput('chBtrajInter', 'Interpolate NAs?', value = T),
checkboxInput('chBtrackUni', 'Create unique TrackLabel', T), checkboxInput('chBtrackUni', 'Create unique TrackLabel', T),
helpPopup( helpPopup(
title = 'Create unique cell ID', title = 'Create unique cell ID',
......
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