Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
🚀
This server has been upgraded to GitLab release
15.7
.
🚀
Open sidebar
pertz-lab
shiny-timecourse-inspector
Commits
0f2d73ff
Commit
0f2d73ff
authored
Nov 22, 2017
by
dmattek
Browse files
Interpolation of missing frames in tracks only within min and max realtime of a particlar cell id.
parent
9bb17940
Changes
1
Hide whitespace changes
Inline
Side-by-side
server.R
View file @
0f2d73ff
...
...
@@ -591,21 +591,41 @@ shinyServer(function(input, output, session) {
loc.out
[,
mid.in
:=
ifelse
(
id
%in%
loc.tracks.highlight
,
'SELECTED'
,
'NOT SEL'
)]
}
}
## Interpolate NA's and data points not included
# dt with a full span of realtime for every group and cell id (here it's already unique across entire dataset) combination
loc.dt.IdRt
=
CJ
(
id
=
loc.out
[[
'id'
]],
realtime
=
loc.out
[[
'realtime'
]],
unique
=
TRUE
,
sorted
=
TRUE
)
# dt with all cell id's and their associated group names
loc.dt.GrId
=
loc.out
[,
.
(
group
=
first
(
group
)),
by
=
id
]
# merge the 2 above to have all id~rt combinations with associated group names
loc.dt.GrIdRt
=
merge
(
loc.dt.IdRt
,
loc.dt.GrId
,
by
=
'id'
)
## Interpolate NA's and data points not include
# From: https://stackoverflow.com/questions/28073752/r-how-to-add-rows-for-missing-values-for-unique-group-sequences
# Tracks are interpolated only within min and max realtime of every cell id
setkey
(
loc.out
,
group
,
id
,
realtime
)
loc.out
=
loc.out
[
setkey
(
loc.out
[,
.
(
min
(
realtime
)
:
max
(
realtime
)),
by
=
.
(
group
,
id
)],
group
,
id
,
V1
)]
# join with the original to expand it and create NA's for non-existing group-id-rt combinations
loc.out
=
merge
(
loc.dt.GrIdRt
,
loc.out
,
all.x
=
TRUE
,
by
=
c
(
'group'
,
'id'
,
'realtime'
))
# # dt with a full span of realtime for every group and cell id
# # (here id is already unique across entire dataset) combination
# loc.dt.IdRt = CJ(id = loc.out[['id']],
# realtime = loc.out[['realtime']],
# unique = TRUE, sorted = TRUE )
#
# print('loc.dt.IdRt:')
# print(loc.dt.IdRt)
#
# # dt with all cell id's and their associated group names
# loc.dt.GrId = loc.out[, .(group = first(group)), by = id]
#
# print('loc.dt.GrId:')
# print(loc.dt.GrId)
#
# # merge the 2 above to have all id~rt combinations with associated group names
# loc.dt.GrIdRt = merge(loc.dt.IdRt, loc.dt.GrId, by = 'id')
#
# print('loc.dt.GrIdRt:')
# print(loc.dt.GrIdRt)
#
# # join with the original to expand it and create NA's for non-existing group-id-rt combinations
# loc.out = merge(loc.dt.GrIdRt, loc.out, all.x = TRUE, by = c('group', 'id', 'realtime'))
#
# print('loc.out:')
# print(loc.out)
#
# x-check: print all rows with NA's
print
(
'Rows with NAs:'
)
...
...
@@ -635,12 +655,12 @@ shinyServer(function(input, output, session) {
# 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
)
{
loc.out
=
loc.out
[
realtime
>=
input
$
slTimeTrim
[[
1
]]
&
realtime
<=
input
$
slTimeTrim
[[
2
]]
]
}
# Normalization
#
#
Normalization
# F-n myNorm adds additional column with .norm suffix
if
(
input
$
chBnorm
)
{
loc.out
=
myNorm
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment