Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
shiny-timecourse-inspector
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pertz-lab
shiny-timecourse-inspector
Commits
653dfeba
Commit
653dfeba
authored
Oct 08, 2019
by
dmattek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed: check for empty dt replaced by explicit zeroRecords option to DT.
parent
3ee73121
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
36 deletions
+42
-36
modules/dispTrackStats.R
modules/dispTrackStats.R
+42
-36
No files found.
modules/dispTrackStats.R
View file @
653dfeba
...
...
@@ -38,8 +38,8 @@ modTrackStats = function(input, output, session,
DT
::
dataTableOutput
(
ns
(
'outTabStatsMeas'
))),
tabPanel
(
"Duplicated IDs"
,
DT
::
dataTableOutput
(
ns
(
'outTabStatsDup'
)))
)
)
)
}
})
...
...
@@ -60,7 +60,7 @@ modTrackStats = function(input, output, session,
})
# ca
cl
ulate stats of the measurement (column Y) per group
# ca
lc
ulate stats of the measurement (column Y) per group
calcStatsMeas
=
reactive
({
cat
(
file
=
stderr
(),
'modTrackStats:calsStats\n'
)
loc.dt
=
in.data
()
...
...
@@ -83,7 +83,7 @@ modTrackStats = function(input, output, session,
return
(
loc.dt.aggr
)
})
# ca
cl
ulate stats of tracks per group
# ca
lc
ulate stats of tracks per group
calcStatsTracks
=
reactive
({
cat
(
file
=
stderr
(),
'modTrackStats:calsStats\n'
)
loc.dt
=
in.data
()
...
...
@@ -94,10 +94,10 @@ modTrackStats = function(input, output, session,
loc.dt.aggr
=
loc.dt
[,
.
(
nTpts
=
.N
),
by
=
c
(
in.bycols
,
COLID
)][,
.
(
tracksN
=
.N
,
tracksLenMean
=
mean
(
nTpts
),
tracksLenSD
=
sd
(
nTpts
),
tracksLenMedian
=
median
(
as.double
(
nTpts
)),
tracksLenIQR
=
IQR
(
nTpts
)),
by
=
c
(
in.bycols
)]
tracksLenMean
=
mean
(
nTpts
),
tracksLenSD
=
sd
(
nTpts
),
tracksLenMedian
=
median
(
as.double
(
nTpts
)),
tracksLenIQR
=
IQR
(
nTpts
)),
by
=
c
(
in.bycols
)]
setnames
(
loc.dt.aggr
,
c
(
in.bycols
,
'nTracks'
,
'Mean Length'
,
'SD'
,
'Median Length'
,
'IQR'
))
...
...
@@ -109,8 +109,9 @@ modTrackStats = function(input, output, session,
cat
(
file
=
stderr
(),
'modTrackStats:outTabStats\n'
)
loc.dt
=
calcStatsTracks
()
if
(
is.null
(
loc.dt
))
return
(
NULL
)
validate
(
need
(
!
is.null
(
loc.dt
),
"Cannot calculate statistics. Load data first!"
)
)
if
(
nrow
(
loc.dt
))
datatable
(
loc.dt
,
...
...
@@ -141,8 +142,9 @@ modTrackStats = function(input, output, session,
cat
(
file
=
stderr
(),
'modTrackStats:outTabMeas\n'
)
loc.dt
=
calcStatsMeas
()
if
(
is.null
(
loc.dt
))
return
(
NULL
)
validate
(
need
(
!
is.null
(
loc.dt
),
"Cannot calculate statistics. Load data first!"
)
)
if
(
nrow
(
loc.dt
))
datatable
(
loc.dt
,
...
...
@@ -174,35 +176,39 @@ modTrackStats = function(input, output, session,
cat
(
file
=
stderr
(),
'modTrackStats:outTabStatsDup\n'
)
loc.dt
=
in.data
()
if
(
is.null
(
loc.dt
))
return
(
NULL
)
validate
(
need
(
!
is.null
(
loc.dt
),
"Cannot calculate statistics. Load data first!"
)
)
# Look whether there were more objects with the same track ID in the frame
# Such track IDs will have TRUE assigned in 'dup' column
# Keep only s.track column with dup=TRUE
loc.duptracks
=
loc.dt
[,
.
(
dup
=
(
sum
(
duplicated
(
get
(
COLRT
)))
>
0
)),
by
=
COLID
][
dup
==
TRUE
,
COLID
,
with
=
FALSE
]
if
(
nrow
(
loc.duptracks
))
datatable
(
loc.duptracks
,
caption
=
paste0
(
"Track IDs with duplicated objects in a group. "
,
"To avoid, create a data-wide unique track ID in "
,
"the panel on the left or in your input data."
),
rownames
=
TRUE
,
extensions
=
'Buttons'
,
options
=
list
(
dom
=
'Bfrtip'
,
buttons
=
list
(
'copy'
,
'print'
,
list
(
extend
=
'collection'
,
buttons
=
list
(
list
(
extend
=
'csv'
,
filename
=
'hitStats'
),
list
(
extend
=
'excel'
,
filename
=
'hitStats'
),
list
(
extend
=
'pdf'
,
filename
=
'hitStats'
)),
text
=
'Download'
))))
%>%
formatRound
(
3
:
6
)
else
return
(
NULL
)
loc.duptracks
=
loc.dt
[,
.
(
dup
=
(
sum
(
duplicated
(
get
(
COLRT
)))
>
0
)),
by
=
COLID
][
dup
==
TRUE
,
COLID
,
with
=
FALSE
]
DT
::
datatable
(
loc.duptracks
,
caption
=
paste0
(
"Time series with duplicated track IDs. "
,
"To avoid, create a data-wide unique track ID in "
,
"the panel on the left or in your input data."
),
rownames
=
TRUE
,
extensions
=
'Buttons'
,
options
=
list
(
dom
=
'Bfrtip'
,
buttons
=
list
(
'copy'
,
'print'
,
list
(
extend
=
'collection'
,
buttons
=
list
(
list
(
extend
=
'csv'
,
filename
=
'hitStats'
),
list
(
extend
=
'excel'
,
filename
=
'hitStats'
),
list
(
extend
=
'pdf'
,
filename
=
'hitStats'
)),
text
=
'Download'
)),
language
=
list
(
zeroRecords
=
"No records to display"
)
)
)
%>%
formatRound
(
3
:
6
)
})
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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