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
8fc29800
Commit
8fc29800
authored
Apr 09, 2019
by
Maciej Dobrzynski
Browse files
Changed the type of quantile calculation to 3.
parent
17a85ab0
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/selOutliers.R
View file @
8fc29800
...
...
@@ -94,23 +94,24 @@ modSelOutliers = function(input, output, session, in.data) {
return
(
NULL
)
}
# store the number of trajectories before prunning
nCellsCounter
[[
'nCellsOrig'
]]
=
length
(
unique
(
loc.out
[[
'id'
]]))
# Remove outliers if the field with percentage of data to remove is greater than 0
if
(
input
$
numOutliersPerc
>
0
)
{
# store the number of trajectories before prunning
nCellsCounter
[[
'nCellsOrig'
]]
=
length
(
unique
(
loc.out
[[
'id'
]]))
# scale all measurement points
loc.out
[,
y.sc
:=
scale
(
get
(
COLY
))]
# Identify outlier points
# In the UI, user selectes percentage of data to remove from the bottom, middle, or top part.
# loc.outpts stores outlier points
# warning: quantile type = 3: SAS definition: nearest even order statistic.
switch
(
input
$
rbOutliersType
,
'top'
=
{
loc.outpts
=
loc.out
[
y.sc
>
quantile
(
y.sc
,
1
-
input
$
numOutliersPerc
*
0.01
,
na.rm
=
T
)]},
'mid'
=
{
loc.outpts
=
loc.out
[
y.sc
<
quantile
(
y.sc
,
input
$
numOutliersPerc
*
0.005
,
na.rm
=
T
)
|
y.sc
>
quantile
(
y.sc
,
1
-
input
$
numOutliersPerc
*
0.005
,
na.rm
=
T
)]},
'bot'
=
{
loc.outpts
=
loc.out
[
y.sc
<
quantile
(
y.sc
,
input
$
numOutliersPerc
*
0.01
,
na.rm
=
T
)]}
'top'
=
{
loc.outpts
=
loc.out
[
y.sc
>
quantile
(
y.sc
,
1
-
input
$
numOutliersPerc
*
0.01
,
na.rm
=
T
,
type
=
3
)]},
'mid'
=
{
loc.outpts
=
loc.out
[
y.sc
<
quantile
(
y.sc
,
input
$
numOutliersPerc
*
0.005
,
na.rm
=
T
,
type
=
3
)
|
y.sc
>
quantile
(
y.sc
,
1
-
input
$
numOutliersPerc
*
0.005
,
na.rm
=
T
,
type
=
3
)]},
'bot'
=
{
loc.outpts
=
loc.out
[
y.sc
<
quantile
(
y.sc
,
input
$
numOutliersPerc
*
0.01
,
na.rm
=
T
,
type
=
3
)]}
)
if
(
DEB
)
{
...
...
@@ -158,7 +159,7 @@ modSelOutliers = function(input, output, session, in.data) {
# x-check: print all rows with NA's
if
(
DEB
)
{
cat
(
file
=
stdout
(),
'\nselOutliers.dtReturn: Rows with NAs
due to outliers
:\n'
)
cat
(
file
=
stdout
(),
'\nselOutliers.dtReturn: Rows with NAs
to interpolate
:\n'
)
print
(
loc.out
[
rowSums
(
is.na
(
loc.out
))
>
0
,
])
}
...
...
@@ -179,26 +180,31 @@ modSelOutliers = function(input, output, session, in.data) {
loc.out
[,
(
col
)
:=
na.interpolation
(
get
(
col
)),
by
=
c
(
COLID
)]
}
}
}
else
{
# remove outlier tracks with gaps of length 1 time point
# !(input$slOutliersGapLen > 1)
loc.out
=
loc.out
[
!
(
get
(
COLID
)
%in%
unique
(
loc.outpts
[[
COLID
]]))]
}
# clean
loc.out
[,
y.sc
:=
NULL
]
# count number of trajectories after removing outlier tracks
nCellsCounter
[[
'nCellsAfter'
]]
=
length
(
unique
(
loc.out
[[
COLID
]]))
# count number of outlier points
nCellsCounter
[[
'nOutlierTpts'
]]
=
length
(
loc.outpts
[[
COLID
]])
# store a vector of outlier timepoints with the corresponding IDs
vOut
[[
'id'
]]
=
loc.outpts
}
else
{
# no outlier removal
# !(input$numOutliersPerc > 0)
loc.outpts
=
NULL
vOut
=
NULL
}
# count number of trajectories after removing outlier tracks
nCellsCounter
[[
'nCellsAfter'
]]
=
length
(
unique
(
loc.out
[[
COLID
]]))
# count number of outlier points
nCellsCounter
[[
'nOutlierTpts'
]]
=
length
(
loc.outpts
[[
COLID
]])
cat
(
sprintf
(
"%d outlier tpts\n"
,
nCellsCounter
[[
'nOutlierTpts'
]]))
# return cleaned dt
if
(
nrow
(
loc.out
)
<
1
)
...
...
modules/tabScatter.R
View file @
8fc29800
...
...
@@ -29,7 +29,7 @@ tabScatterPlotUI <- function(id, label = "Comparing t-points") {
4
,
uiOutput
(
ns
(
'uiSelTptX'
)),
uiOutput
(
ns
(
'uiSelTptY'
)),
checkboxInput
(
ns
(
'chBfoldChange'
),
'
Y-axis d
isplay
s
difference between two t-points'
)
checkboxInput
(
ns
(
'chBfoldChange'
),
'
D
isplay difference between two t-points
on Y-axis
'
)
),
column
(
4
,
...
...
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