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
84cdda8f
Commit
84cdda8f
authored
5 years ago
by
Luke Zappia
Browse files
Options
Downloads
Patches
Plain Diff
Add violins to comparison plots
parent
de1c10d9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NEWS.md
+1
-0
1 addition, 0 deletions
NEWS.md
R/compare.R
+38
-18
38 additions, 18 deletions
R/compare.R
with
39 additions
and
18 deletions
NEWS.md
+
1
−
0
View file @
84cdda8f
### Version 1.9.4.9009 (2019-08-21)
*
Replace library size log-normal with density and rejection sampling
*
Add violins to comparison plots
### Version 1.9.4.9008 (2019-08-20)
...
...
This diff is collapsed.
Click to expand it.
R/compare.R
+
38
−
18
View file @
84cdda8f
...
...
@@ -52,9 +52,9 @@
#' names(comparison)
#' names(comparison$Plots)
#' @importFrom ggplot2 ggplot aes_string geom_point geom_smooth geom_boxplot
#' geom_tile scale_y_continuous scale_y_log10 scale_x_log10
scale_colour_manual
#' scale_fill_manual scale_fill_distiller coord_fixed
facet_wrap xlab ylab
#' ggtitle theme_minimal
#'
geom_violin
geom_tile scale_y_continuous scale_y_log10 scale_x_log10
#'
scale_colour_manual
scale_fill_manual scale_fill_distiller coord_fixed
#'
facet_wrap xlab ylab
ggtitle theme_minimal
#' @importFrom S4Vectors metadata<- metadata
#' @importFrom SingleCellExperiment cpm<- cpm
#' @importFrom stats cor
...
...
@@ -125,8 +125,12 @@ compareSCEs <- function(sces, point.size = 0.1, point.alpha = 0.1,
means
<-
ggplot
(
features
,
aes_string
(
x
=
"Dataset"
,
y
=
"MeanLogCPM"
,
colour
=
"Dataset"
))
+
geom_boxplot
()
+
geom_violin
(
aes_string
(
fill
=
"Dataset"
),
draw_quantiles
=
c
(
0.25
,
0.5
,
0.75
),
colour
=
"white"
,
alpha
=
0.3
,
size
=
0.8
)
+
geom_boxplot
(
notch
=
TRUE
,
width
=
0.1
,
size
=
0.8
)
+
scale_colour_manual
(
values
=
colours
)
+
scale_fill_manual
(
values
=
colours
)
+
ylab
(
expression
(
paste
(
"Mean "
,
log
[
2
],
"(CPM + 1)"
)))
+
ggtitle
(
"Distribution of mean expression"
)
+
theme_minimal
()
...
...
@@ -134,8 +138,12 @@ compareSCEs <- function(sces, point.size = 0.1, point.alpha = 0.1,
vars
<-
ggplot
(
features
,
aes_string
(
x
=
"Dataset"
,
y
=
"VarLogCPM"
,
colour
=
"Dataset"
))
+
geom_boxplot
()
+
geom_violin
(
aes_string
(
fill
=
"Dataset"
),
draw_quantiles
=
c
(
0.25
,
0.5
,
0.75
),
colour
=
"white"
,
alpha
=
0.3
,
size
=
0.8
)
+
geom_boxplot
(
notch
=
TRUE
,
width
=
0.1
,
size
=
0.8
)
+
scale_colour_manual
(
values
=
colours
)
+
scale_fill_manual
(
values
=
colours
)
+
ylab
(
expression
(
paste
(
"Variance "
,
log
[
2
],
"(CPM + 1)"
)))
+
ggtitle
(
"Distribution of variance"
)
+
theme_minimal
()
...
...
@@ -154,9 +162,13 @@ compareSCEs <- function(sces, point.size = 0.1, point.alpha = 0.1,
libs
<-
ggplot
(
cells
,
aes_string
(
x
=
"Dataset"
,
y
=
"sum"
,
colour
=
"Dataset"
))
+
geom_boxplot
()
+
geom_violin
(
aes_string
(
fill
=
"Dataset"
),
draw_quantiles
=
c
(
0.25
,
0.5
,
0.75
),
colour
=
"white"
,
alpha
=
0.3
,
size
=
0.8
)
+
geom_boxplot
(
notch
=
TRUE
,
width
=
0.1
,
size
=
0.8
)
+
scale_y_continuous
(
labels
=
scales
::
comma
)
+
scale_colour_manual
(
values
=
colours
)
+
scale_fill_manual
(
values
=
colours
)
+
ylab
(
"Total counts per cell"
)
+
ggtitle
(
"Distribution of library sizes"
)
+
theme_minimal
()
...
...
@@ -164,9 +176,13 @@ compareSCEs <- function(sces, point.size = 0.1, point.alpha = 0.1,
z.gene
<-
ggplot
(
features
,
aes_string
(
x
=
"Dataset"
,
y
=
"PctZero"
,
colour
=
"Dataset"
))
+
geom_boxplot
()
+
geom_violin
(
aes_string
(
fill
=
"Dataset"
),
draw_quantiles
=
c
(
0.25
,
0.5
,
0.75
),
colour
=
"white"
,
alpha
=
0.3
,
size
=
0.8
)
+
geom_boxplot
(
notch
=
TRUE
,
width
=
0.1
,
size
=
0.8
)
+
scale_y_continuous
(
limits
=
c
(
0
,
100
))
+
scale_colour_manual
(
values
=
colours
)
+
scale_fill_manual
(
values
=
colours
)
+
ylab
(
"Percentage zeros per gene"
)
+
ggtitle
(
"Distribution of zeros per gene"
)
+
theme_minimal
()
...
...
@@ -174,9 +190,13 @@ compareSCEs <- function(sces, point.size = 0.1, point.alpha = 0.1,
z.cell
<-
ggplot
(
cells
,
aes_string
(
x
=
"Dataset"
,
y
=
"PctZero"
,
colour
=
"Dataset"
))
+
geom_boxplot
()
+
geom_violin
(
aes_string
(
fill
=
"Dataset"
),
draw_quantiles
=
c
(
0.25
,
0.5
,
0.75
),
colour
=
"white"
,
alpha
=
0.3
,
size
=
0.8
)
+
geom_boxplot
(
notch
=
TRUE
,
width
=
0.1
,
size
=
0.8
)
+
scale_y_continuous
(
limits
=
c
(
0
,
100
))
+
scale_colour_manual
(
values
=
colours
)
+
scale_fill_manual
(
values
=
colours
)
+
ylab
(
"Percentage zeros per cell"
)
+
ggtitle
(
"Distribution of zeros per cell"
)
+
theme_minimal
()
...
...
@@ -413,7 +433,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
aes_string
(
x
=
"Dataset"
,
y
=
"RankDiffMeanLogCPM"
,
colour
=
"Dataset"
))
+
geom_hline
(
yintercept
=
0
,
colour
=
"red"
)
+
geom_boxplot
()
+
geom_boxplot
(
notch
=
TRUE
,
width
=
0.1
,
size
=
0.8
)
+
scale_colour_manual
(
values
=
colours
)
+
ylab
(
expression
(
paste
(
"Rank difference mean "
,
log
[
2
],
"(CPM + 1)"
)))
+
ggtitle
(
"Difference in mean expression"
)
+
...
...
@@ -423,7 +443,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
aes_string
(
x
=
"Dataset"
,
y
=
"RankDiffVarLogCPM"
,
colour
=
"Dataset"
))
+
geom_hline
(
yintercept
=
0
,
colour
=
"red"
)
+
geom_boxplot
()
+
geom_boxplot
(
notch
=
TRUE
,
width
=
0.1
,
size
=
0.8
)
+
scale_colour_manual
(
values
=
colours
)
+
ylab
(
expression
(
paste
(
"Rank difference variance "
,
log
[
2
],
"(CPM + 1)"
)))
+
...
...
@@ -447,7 +467,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
aes_string
(
x
=
"Dataset"
,
y
=
"RankDiffLibSize"
,
colour
=
"Dataset"
))
+
geom_hline
(
yintercept
=
0
,
colour
=
"red"
)
+
geom_boxplot
()
+
geom_boxplot
(
notch
=
TRUE
,
width
=
0.1
,
size
=
0.8
)
+
scale_colour_manual
(
values
=
colours
)
+
ylab
(
paste
(
"Rank difference library size"
))
+
ggtitle
(
"Difference in library sizes"
)
+
...
...
@@ -457,7 +477,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
aes_string
(
x
=
"Dataset"
,
y
=
"RankDiffZeros"
,
colour
=
"Dataset"
))
+
geom_hline
(
yintercept
=
0
,
colour
=
"red"
)
+
geom_boxplot
()
+
geom_boxplot
(
notch
=
TRUE
,
width
=
0.1
,
size
=
0.8
)
+
scale_colour_manual
(
values
=
colours
)
+
ylab
(
paste
(
"Rank difference percentage zeros"
))
+
ggtitle
(
"Difference in zeros per gene"
)
+
...
...
@@ -467,7 +487,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
aes_string
(
x
=
"Dataset"
,
y
=
"RankDiffZeros"
,
colour
=
"Dataset"
))
+
geom_hline
(
yintercept
=
0
,
colour
=
"red"
)
+
geom_boxplot
()
+
geom_boxplot
(
notch
=
TRUE
,
width
=
0.1
,
size
=
0.8
)
+
scale_colour_manual
(
values
=
colours
)
+
ylab
(
paste
(
"Rank difference percentage zeros"
))
+
ggtitle
(
"Difference in zeros per cell"
)
+
...
...
@@ -489,7 +509,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
aes_string
(
x
=
"RefRankMeanLogCPM"
,
y
=
"MeanLogCPM"
,
colour
=
"Dataset"
))
+
geom_abline
(
intercept
=
0
,
slope
=
1
,
colour
=
"red"
)
+
geom_point
(
size
=
point.size
,
alpha
=
point.alpha
)
+
geom_point
(
size
=
point.size
)
+
scale_colour_manual
(
values
=
colours
)
+
xlab
(
expression
(
paste
(
"Reference mean "
,
log
[
2
],
"(CPM + 1)"
)))
+
ylab
(
expression
(
paste
(
"Alternative mean "
,
log
[
2
],
"(CPM + 1)"
)))
+
...
...
@@ -500,7 +520,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
aes_string
(
x
=
"RefRankVarLogCPM"
,
y
=
"VarLogCPM"
,
colour
=
"Dataset"
))
+
geom_abline
(
intercept
=
0
,
slope
=
1
,
colour
=
"red"
)
+
geom_point
(
size
=
point.size
,
alpha
=
point.alpha
)
+
geom_point
(
size
=
point.size
)
+
scale_colour_manual
(
values
=
colours
)
+
xlab
(
expression
(
paste
(
"Reference variance "
,
log
[
2
],
"(CPM + 1)"
)))
+
ylab
(
expression
(
paste
(
"Alternative variance "
,
log
[
2
],
"(CPM + 1)"
)))
+
...
...
@@ -511,7 +531,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
aes_string
(
x
=
"RefRankLibSize"
,
y
=
"sum"
,
colour
=
"Dataset"
))
+
geom_abline
(
intercept
=
0
,
slope
=
1
,
colour
=
"red"
)
+
geom_point
(
size
=
point.size
,
alpha
=
point.alpha
)
+
geom_point
(
size
=
point.size
)
+
scale_colour_manual
(
values
=
colours
)
+
xlab
(
"Reference library size"
)
+
ylab
(
"Alternative library size"
)
+
...
...
@@ -523,7 +543,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
y
=
"PctZero"
,
colour
=
"Dataset"
))
+
geom_abline
(
intercept
=
0
,
slope
=
1
,
colour
=
"red"
)
+
geom_point
(
size
=
point.size
,
alpha
=
point.alpha
)
+
geom_point
(
size
=
point.size
)
+
scale_colour_manual
(
values
=
colours
)
+
xlab
(
"Reference percentage zeros"
)
+
ylab
(
"Alternative percentage zeros"
)
+
...
...
@@ -534,7 +554,7 @@ diffSCEs <- function(sces, ref, point.size = 0.1, point.alpha = 0.1,
aes_string
(
x
=
"RefRankZeros"
,
y
=
"PctZero"
,
colour
=
"Dataset"
))
+
geom_abline
(
intercept
=
0
,
slope
=
1
,
colour
=
"red"
)
+
geom_point
(
size
=
point.size
,
alpha
=
point.alpha
)
+
geom_point
(
size
=
point.size
)
+
scale_colour_manual
(
values
=
colours
)
+
xlab
(
"Reference percentage zeros"
)
+
ylab
(
"Alternative percentage zeros"
)
+
...
...
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