Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sirplus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BioCellGen-public
sirplus
Commits
88ce104e
Commit
88ce104e
authored
7 years ago
by
Luke Zappia
Browse files
Options
Downloads
Patches
Plain Diff
Update addFeatureStats col names
Make it clear which are added by Splatter
parent
fc0c3066
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
R/SCESet-functions.R
+15
-11
15 additions, 11 deletions
R/SCESet-functions.R
R/compare.R
+18
-17
18 additions, 17 deletions
R/compare.R
man/addFeatureStats.Rd
+4
-2
4 additions, 2 deletions
man/addFeatureStats.Rd
with
37 additions
and
30 deletions
R/SCESet-functions.R
+
15
−
11
View file @
88ce104e
...
...
@@ -14,8 +14,10 @@
#' @details
#' Currently adds the following statistics: mean, variance, coefficient of
#' variation, median and median absolute deviation. Statistics are added to
#' the \code{fData} slot and are named \code{stat_[log]_value_[no0]} where
#' \code{log} and \code{no0} are added if those arguments are true.
#' the \code{fData} slot and are named \code{Stat[Log]Value[No0]} where
#' \code{Log} and \code{No0} are added if those arguments are true.
#' UpperCamelCase is used to differentiate these columns from those added by
#' \code{scater}.
#'
#' @return SCESet with additional feature statistics
#'
...
...
@@ -28,35 +30,37 @@ addFeatureStats <- function(sce, value = c("counts", "cpm", "tpm", "fpkm"),
switch
(
value
,
counts
=
{
values
=
scater
::
counts
(
sce
)
suffix
<-
"Counts"
},
cpm
=
{
values
=
scater
::
cpm
(
sce
)
suffix
<-
"CPM"
},
tpm
=
{
values
=
scater
::
tpm
(
sce
)
suffix
<-
"TPM"
},
fpkm
=
{
values
=
scater
::
fpkm
(
sce
)
suffix
<-
"FPKM"
}
)
suffix
<-
value
if
(
no.zeros
)
{
values
[
values
==
0
]
<-
NA
suffix
=
paste0
(
suffix
,
"
_n
o0"
)
suffix
=
paste0
(
suffix
,
"
N
o0"
)
}
if
(
log
)
{
values
=
log2
(
values
+
offset
)
suffix
=
paste0
(
"
l
og
_
"
,
suffix
)
suffix
=
paste0
(
"
L
og"
,
suffix
)
}
mean.str
<-
paste0
(
"
m
ean
_
"
,
suffix
)
var.str
<-
paste0
(
"
v
ar
_
"
,
suffix
)
cv.str
<-
paste0
(
"
cv_
"
,
suffix
)
med.str
<-
paste0
(
"
m
ed
_
"
,
suffix
)
mad.str
<-
paste0
(
"
mad_
"
,
suffix
)
mean.str
<-
paste0
(
"
M
ean"
,
suffix
)
var.str
<-
paste0
(
"
V
ar"
,
suffix
)
cv.str
<-
paste0
(
"
CV
"
,
suffix
)
med.str
<-
paste0
(
"
M
ed"
,
suffix
)
mad.str
<-
paste0
(
"
MAD
"
,
suffix
)
fData
(
sce
)[,
mean.str
]
<-
rowMeans
(
values
,
na.rm
=
TRUE
)
fData
(
sce
)[,
var.str
]
<-
matrixStats
::
rowVars
(
values
,
na.rm
=
TRUE
)
...
...
This diff is collapsed.
Click to expand it.
R/compare.R
+
18
−
17
View file @
88ce104e
...
...
@@ -80,7 +80,7 @@ compareSCESets <- function(sces) {
pData.all
$
Dataset
<-
factor
(
pData.all
$
Dataset
,
levels
=
names
(
sces
))
means
<-
ggplot
(
fData.all
,
aes_string
(
x
=
"Dataset"
,
y
=
"
m
ean
_log_cpm
"
,
aes_string
(
x
=
"Dataset"
,
y
=
"
M
ean
LogCPM
"
,
colour
=
"Dataset"
))
+
#geom_violin(draw_quantiles = c(0.25, 0.5, 0.75)) +
geom_boxplot
()
+
...
...
@@ -89,7 +89,7 @@ compareSCESets <- function(sces) {
theme_minimal
()
vars
<-
ggplot
(
fData.all
,
aes_string
(
x
=
"Dataset"
,
y
=
"
v
ar
_cpm
"
,
aes_string
(
x
=
"Dataset"
,
y
=
"
V
ar
CPM
"
,
colour
=
"Dataset"
))
+
#geom_violin(draw_quantiles = c(0.25, 0.5, 0.75)) +
geom_boxplot
()
+
...
...
@@ -99,7 +99,7 @@ compareSCESets <- function(sces) {
theme_minimal
()
mean.var
<-
ggplot
(
fData.all
,
aes_string
(
x
=
"
m
ean
_log_cpm
"
,
y
=
"
v
ar
_log_cpm
"
,
aes_string
(
x
=
"
M
ean
LogCPM
"
,
y
=
"
V
ar
LogCPM
"
,
colour
=
"Dataset"
,
fill
=
"Dataset"
))
+
geom_point
(
size
=
0.1
,
alpha
=
0.1
)
+
geom_smooth
()
+
...
...
@@ -136,7 +136,7 @@ compareSCESets <- function(sces) {
theme_minimal
()
mean.zeros
<-
ggplot
(
fData.all
,
aes_string
(
x
=
"
m
ean
_c
ounts"
,
y
=
"pct_dropout"
,
aes_string
(
x
=
"
M
ean
C
ounts"
,
y
=
"pct_dropout"
,
colour
=
"Dataset"
,
fill
=
"Dataset"
))
+
geom_point
(
size
=
0.1
,
alpha
=
0.1
)
+
geom_smooth
()
+
...
...
@@ -256,22 +256,23 @@ diffSCESets <- function(sces, ref) {
ref.sce
<-
sces
[[
ref
]]
ref.means
<-
sort
(
fData
(
ref.sce
)
$
m
ean
_log_cpm
)
ref.vars
<-
sort
(
fData
(
ref.sce
)
$
v
ar
_log_cpm
)
ref.means
<-
sort
(
fData
(
ref.sce
)
$
M
ean
LogCPM
)
ref.vars
<-
sort
(
fData
(
ref.sce
)
$
V
ar
LogCPM
)
ref.libs
<-
sort
(
pData
(
ref.sce
)
$
total_counts
)
ref.z.gene
<-
sort
(
fData
(
ref.sce
)
$
pct_dropout
)
ref.z.cell
<-
sort
(
pData
(
ref.sce
)
$
pct_dropout
)
ref.vars.meanrank
<-
fData
(
ref.sce
)
$
var_log_cpm
[
order
(
fData
(
ref.sce
)
$
exprs_rank
)]
ref.z.gene.meanrank
<-
fData
(
ref.sce
)
$
pct_dropout
[
order
(
fData
(
ref.sce
)
$
exprs_rank
)]
ref.rank.ord
<-
order
(
fData
(
ref.sce
)
$
exprs_rank
)
ref.vars.rank
<-
fData
(
ref.sce
)
$
VarLogCPM
[
ref.rank.ord
]
ref.z.gene.rank
<-
fData
(
ref.sce
)
$
pct_dropout
[
ref.rank.ord
]
for
(
name
in
names
(
sces
))
{
sce
<-
sces
[[
name
]]
fData
(
sce
)
$
RefRankMeanLogCPM
<-
ref.means
[
rank
(
fData
(
sce
)
$
m
ean
_log_cpm
)]
fData
(
sce
)
$
RankDiffMeanLogCPM
<-
fData
(
sce
)
$
m
ean
_log_cpm
-
fData
(
sce
)
$
RefRankMeanLogCPM
<-
ref.means
[
rank
(
fData
(
sce
)
$
M
ean
LogCPM
)]
fData
(
sce
)
$
RankDiffMeanLogCPM
<-
fData
(
sce
)
$
M
ean
LogCPM
-
fData
(
sce
)
$
RefRankMeanLogCPM
fData
(
sce
)
$
RefRankVarLogCPM
<-
ref.vars
[
rank
(
fData
(
sce
)
$
v
ar
_log_cpm
)]
fData
(
sce
)
$
RankDiffVarLogCPM
<-
fData
(
sce
)
$
v
ar
_log_cpm
-
fData
(
sce
)
$
RefRankVarLogCPM
<-
ref.vars
[
rank
(
fData
(
sce
)
$
V
ar
LogCPM
)]
fData
(
sce
)
$
RankDiffVarLogCPM
<-
fData
(
sce
)
$
V
ar
LogCPM
-
fData
(
sce
)
$
RefRankVarLogCPM
pData
(
sce
)
$
RefRankLibSize
<-
ref.libs
[
rank
(
pData
(
sce
)
$
total_counts
)]
pData
(
sce
)
$
RankDiffLibSize
<-
pData
(
sce
)
$
total_counts
-
...
...
@@ -283,10 +284,10 @@ diffSCESets <- function(sces, ref) {
pData
(
sce
)
$
RankDiffZeros
<-
pData
(
sce
)
$
pct_dropout
-
pData
(
sce
)
$
RefRankZeros
fData
(
sce
)
$
MeanRankVarDiff
<-
fData
(
sce
)
$
v
ar
_log_cpm
-
ref.vars.
mean
rank
[
fData
(
sce
)
$
exprs_rank
]
fData
(
sce
)
$
MeanRankVarDiff
<-
fData
(
sce
)
$
V
ar
LogCPM
-
ref.vars.rank
[
fData
(
sce
)
$
exprs_rank
]
fData
(
sce
)
$
MeanRankZerosDiff
<-
fData
(
sce
)
$
pct_dropout
-
ref.z.gene.
mean
rank
[
fData
(
sce
)
$
exprs_rank
]
ref.z.gene.rank
[
fData
(
sce
)
$
exprs_rank
]
sces
[[
name
]]
<-
sce
}
...
...
@@ -376,7 +377,7 @@ diffSCESets <- function(sces, ref) {
theme_minimal
()
means.qq
<-
ggplot
(
fData.all
,
aes_string
(
x
=
"RefRankMeanLogCPM"
,
y
=
"
m
ean
_log_cpm
"
,
aes_string
(
x
=
"RefRankMeanLogCPM"
,
y
=
"
M
ean
LogCPM
"
,
colour
=
"Dataset"
))
+
geom_abline
(
intercept
=
0
,
slope
=
1
,
colour
=
"red"
)
+
geom_point
()
+
...
...
@@ -386,7 +387,7 @@ diffSCESets <- function(sces, ref) {
theme_minimal
()
vars.qq
<-
ggplot
(
fData.all
,
aes_string
(
x
=
"RefRankVarLogCPM"
,
y
=
"
v
ar
_log_cpm
"
,
aes_string
(
x
=
"RefRankVarLogCPM"
,
y
=
"
V
ar
LogCPM
"
,
colour
=
"Dataset"
))
+
geom_abline
(
intercept
=
0
,
slope
=
1
,
colour
=
"red"
)
+
geom_point
()
+
...
...
This diff is collapsed.
Click to expand it.
man/addFeatureStats.Rd
+
4
−
2
View file @
88ce104e
...
...
@@ -30,6 +30,8 @@ Add additional feature statistics to an SCESet object
\details{
Currently adds the following statistics: mean, variance, coefficient of
variation, median and median absolute deviation. Statistics are added to
the \code{fData} slot and are named \code{stat_[log]_value_[no0]} where
\code{log} and \code{no0} are added if those arguments are true.
the \code{fData} slot and are named \code{Stat[Log]Value[No0]} where
\code{Log} and \code{No0} are added if those arguments are true.
UpperCamelCase is used to differentiate these columns from those added by
\code{scater}.
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment