-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
uses revised facet_grid with side panels
- Loading branch information
Showing
14 changed files
with
223 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,182 @@ | ||
plot() | ||
library(hexSticker) | ||
install.packages("hexSticker") | ||
library(hexSticker) | ||
sticker("./cellScaleFactorsIMAGE.png", | ||
package="cellScaleFactors", | ||
p_size=20, s_x=1, s_y=.75, s_width=.6, | ||
filename="cellScaleFactors.png") | ||
sticker("./cellScaleFactorsIMAGE.PNG", | ||
package="cellScaleFactors", | ||
p_size=20, s_x=1, s_y=.75, s_width=.6, | ||
filename="cellScaleFactors.png") | ||
sticker("./cellScaleFactorsIMAGE.PNG", | ||
package="cellScaleFactors", | ||
p_size=20, s_x=1, s_y=.75, s_width=.6, | ||
filename="cellScaleFactors.png") | ||
sticker("./cellScaleFactorsIMAGE.PNG", | ||
package="cellScaleFactors", | ||
p_size=15, s_x=1, s_y=.75, s_width=.6, | ||
filename="cellScaleFactors.png") | ||
sticker("./cellScaleFactorsIMAGE.PNG", | ||
package="cellScaleFactors", | ||
p_size=15, s_x=1, s_y=.75, s_width=.5, | ||
filename="cellScaleFactors.png") | ||
sticker("./cellScaleFactorsIMAGE.PNG", | ||
package="cellScaleFactors", | ||
p_size=15, s_x=1, s_y=.8, s_width=.5, | ||
filename="cellScaleFactors.png") | ||
?sticker | ||
sticker("./cellScaleFactorsIMAGE.PNG", | ||
package="cellScaleFactors", | ||
p_size=15, s_x=1, s_y=.8, s_width=.5, | ||
filename="cellScaleFactors.png",) | ||
sticker("./cellScaleFactorsIMAGE.PNG", | ||
package="cellScaleFactors", | ||
p_size=15, s_x=1, s_y=.8, s_width=.5, | ||
filename="cellScaleFactors.png", h_fill="#111111") | ||
sticker("./cellScaleFactorsIMAGE.PNG", | ||
package="cellScaleFactors", | ||
p_size=15, s_x=1, s_y=.8, s_width=.5, | ||
filename="cellScaleFactors.png", h_fill="#000000") | ||
sticker("./cellScaleFactorsIMAGE.PNG", | ||
package="cellScaleFactors", | ||
p_size=15, s_x=1, s_y=.8, s_width=.5, | ||
filename="cellScaleFactors.png", h_fill="#999999") | ||
sticker("./cellScaleFactorsIMAGE.PNG", | ||
package="cellScaleFactors", | ||
p_size=15, s_x=1, s_y=.8, s_width=.5, | ||
filename="cellScaleFactors.png", h_fill="#FCFCFC") | ||
sticker("./cellScaleFactorsIMAGE.PNG", | ||
package="cellScaleFactors", | ||
p_size=15, s_x=1, s_y=.8, s_width=.5, | ||
filename="cellScaleFactors.png", h_fill="#FCFCFC", | ||
p_color = "#111111") | ||
sticker("./cellScaleFactorsIMAGE.PNG", | ||
package="cellScaleFactors", | ||
p_size=15, s_x=1, s_y=.8, s_width=.5, | ||
filename="cellScaleFactors.png", | ||
h_fill="#FCFCFC", p_color = "#111111", h_color = "#FF8E60") | ||
sticker("./cellScaleFactorsIMAGE.PNG", | ||
package="cellScaleFactors", | ||
p_size=15, s_x=1, s_y=.8, s_width=.5, | ||
filename="cellScaleFactors.png", | ||
h_fill="#FCFCFC", p_color = "#111111", h_color = "#FF674F") | ||
setwd("C:/Users/User/Documents/GitHub/deconvo_method-paper/cohort1") | ||
knitr::opts_chunk$set(fig.width=10, fig.height=10, echo = F) | ||
libv <- c("ggplot2") | ||
sapply(libv, library, character.only = TRUE) | ||
knitr::opts_chunk$set(echo = TRUE) | ||
sapply(libv, library, character.only = T) | ||
# load env data | ||
setwd("..") | ||
setwd("..") | ||
list.files() | ||
load("./env/02_pseudobulk/02_k3.RData") | ||
new.plot | ||
# plot proportions multipanel -- scale vs with scale | ||
new.plot <- ggplot(dfp.ct, aes(x = true.noscale, y = pred.noscale)) + | ||
geom_point(size = 4, alpha = 0.5) + | ||
geom_abline(slope = 1, intercept = 0) + | ||
geom_hline(yintercept = 0.5) + geom_vline(xintercept = 0.5) + theme_bw() + | ||
xlab("Known") + ylab("Predicted") + | ||
xlim(0, 1) + ylim(0, 1) + facet_wrap(~celltype) + | ||
load("./env/05_bulk/01_run_manual_script.RData") | ||
# format plot data | ||
dfp <- df.k2 | ||
# format variable states | ||
dfp$experiment.type <- paste0("z_type : ", dfp$experiment.type) | ||
dfp$assay.name.lutearg <- paste0("rescale_type : ", dfp$assay.name.lutearg) | ||
dfp$s.set.label <- paste0("s_set : ", dfp$s.set.label) | ||
dfp$bulk.sample.id <- gsub("c1", "c", dfp$bulk.sample.id) | ||
dfp$bulk.sample.id <- gsub("k1", "k", dfp$bulk.sample.id) | ||
dfp$bulk.sample.id <- gsub("o1", "o", dfp$bulk.sample.id) | ||
# experiment conditions | ||
dfp$bulk.sample.condition <- cd[dfp$bulk.sample.id,]$expt_condition | ||
table(dfp$bulk.sample.condition) | ||
# filter na | ||
dfp <- na.omit(dfp) | ||
expt <- data.frame(z.reference.type = c("shared", "within", "shared", "within"), | ||
y.expression.scale = c("counts", "counts", "RPKM", "RPKM")) | ||
expt <- do.call(rbind, lapply(seq(length(list.s.pred)), function(ii){ | ||
expt.iter <- expt | ||
expt.iter | ||
})) | ||
expt$cell.label.type <- "k2" | ||
# table visualization | ||
knitr::kable(expt) | ||
data.dict <- list(z.reference.type = "Type of cell type reference for deconvolution", | ||
y.expression.scale = "Scale of the bulk sample data passed to lute", | ||
s.pred.set.name = "Label of the S factor set", | ||
s.pred.set.values = "S factor set values.", | ||
cell.label.type = "Cell type identifier") | ||
data.dict <- do.call(rbind, lapply(seq(length(data.dict)), function(ii){c(names(data.dict)[ii], data.dict[[ii]])})) | ||
knitr::kable(data.dict) | ||
# new plot | ||
new.plot.scatter <- | ||
ggplot(dfp, aes(x = true.neuron, y = neuron, color = bulk.scale.type)) + | ||
theme_bw() + geom_point(alpha = 0.5) + geom_abline(slope = 1, intercept = 0) + | ||
facet_wrap(experiment.type*assay.name.lutearg~s.set.label) + | ||
xlab("Known") + ylab("Predicted") + xlim(0, 1) + ylim(0, 1) + | ||
theme(axis.text.x = element_text(angle = 45, hjust = 1)) | ||
new.plot | ||
# plot proportions multipanel -- scale vs with scale | ||
dfp.ct$celltype <- factor(dfp.ct$celltype, levels = c("Excit", "Inhib", "glial")) | ||
new.plot <- ggplot(dfp.ct, aes(x = true.noscale, y = pred.noscale)) + | ||
geom_point(size = 4, alpha = 0.5) + | ||
geom_abline(slope = 1, intercept = 0) + | ||
geom_hline(yintercept = 0.5) + geom_vline(xintercept = 0.5) + theme_bw() + | ||
xlab("Known") + ylab("Predicted") + | ||
xlim(0, 1) + ylim(0, 1) + facet_wrap(~celltype) + | ||
new.plot.scatter | ||
# new plot | ||
new.plot.scatter <- | ||
ggplot(dfp, aes(x = true.neuron, y = neuron, color = bulk.scale.type)) + | ||
theme_bw() + geom_point(alpha = 0.5) + geom_abline(slope = 1, intercept = 0) + | ||
facet_wrap(experiment.type+assay.name.lutearg~s.set.label) + | ||
xlab("Known") + ylab("Predicted") + xlim(0, 1) + ylim(0, 1) + | ||
theme(axis.text.x = element_text(angle = 45, hjust = 1)) | ||
new.plot.scatter | ||
# new plot | ||
new.plot.scatter <- | ||
ggplot(dfp, aes(x = true.neuron, y = neuron, color = bulk.scale.type)) + | ||
theme_bw() + geom_point(alpha = 0.5) + geom_abline(slope = 1, intercept = 0) + | ||
facet_grid(experiment.type+assay.name.lutearg~s.set.label) + | ||
xlab("Known") + ylab("Predicted") + xlim(0, 1) + ylim(0, 1) + | ||
theme(axis.text.x = element_text(angle = 45, hjust = 1)) | ||
new.plot.scatter | ||
# new plot | ||
new.plot.scatter <- | ||
ggplot(dfp, aes(x = true.neuron, y = neuron, color = bulk.scale.type)) + | ||
theme_bw() + geom_point(alpha = 0.5) + geom_abline(slope = 1, intercept = 0) + | ||
facet_grid(experiment.type~assay.name.lutearg+s.set.label) + | ||
xlab("Known") + ylab("Predicted") + xlim(0, 1) + ylim(0, 1) + | ||
theme(axis.text.x = element_text(angle = 45, hjust = 1)) | ||
new.plot | ||
new.plot.scatter | ||
setwd("..") | ||
setwd("..") | ||
new.plot.name <- "fig2c_cohort1.jpg" | ||
jpeg(file.path("./figures/02_pseudobulk/", new.plot.name), | ||
width = 6, height = 3, units = "in", res = 400) | ||
new.plot | ||
new.plot.path <- "./figures/05_bulk/figs3a_scatter.jpg" | ||
jpeg(new.plot.path, width = 7.5, height = 7, res = 400, units = "in") | ||
new.plot.scatter | ||
dev.off() | ||
setwd("..") | ||
setwd("..") | ||
new.plot.name <- "fig2c_cohort1.jpg" | ||
jpeg(file.path("./figures/02_pseudobulk/", new.plot.name), | ||
width = 6.5, height = 3, units = "in", res = 400) | ||
new.plot | ||
load("./env/05_bulk/02_crossvalidate_script.RData") | ||
knitr::opts_chunk$set(fig.width=10, fig.height=10, echo = F) | ||
libv <- c("ggplot2") | ||
sapply(libv, library, character.only = T) | ||
setwd("..") | ||
setwd("..") | ||
load("./env/05_bulk/02_crossvalidate_script.RData") | ||
dfp <- df.k2 | ||
# format plot data | ||
dfp <- dfp[dfp$crossvalidation=="validation",] | ||
dfp[dfp$s.set.label=="s.null",]$s.set.label <- "unscaled" | ||
dfp[dfp$s.set.label=="s.manual",]$s.set.label <- "scaled" | ||
dfp$experiment.type <- paste0("z_type : ", dfp$experiment.type) | ||
dfp$bulk.sample.id <- gsub("c1", "c", dfp$bulk.sample.id) | ||
dfp$bulk.sample.id <- gsub("k1", "k", dfp$bulk.sample.id) | ||
dfp$bulk.sample.id <- gsub("o1", "o", dfp$bulk.sample.id) | ||
# experiment conditions | ||
dfp$bulk.sample.condition <- cd[dfp$bulk.sample.id,]$expt_condition | ||
table(dfp$bulk.sample.condition) | ||
dfp <- na.omit(dfp) | ||
new.plot.scatter <- ggplot(dfp, aes(x = true.neuron, y = neuron)) + | ||
theme_bw() + geom_point(alpha = 0.5) + | ||
geom_abline(slope = 1, intercept = 0) + | ||
facet_wrap(~s.set.label*experiment.type) + xlab("Known") + | ||
ylab("Predicted") + xlim(0, 1) + ylim(0, 1) + | ||
theme(axis.text.x = element_text(angle = 45, hjust = 1)) | ||
new.plot.scatter | ||
new.plot.scatter <- ggplot(dfp, aes(x = true.neuron, y = neuron)) + | ||
theme_bw() + geom_point(alpha = 0.5) + | ||
geom_abline(slope = 1, intercept = 0) + | ||
facet_grid(s.set.label~experiment.type) + xlab("Known") + | ||
ylab("Predicted") + xlim(0, 1) + ylim(0, 1) + | ||
theme(axis.text.x = element_text(angle = 45, hjust = 1)) | ||
new.plot.scatter | ||
setwd("..") | ||
setwd("..") | ||
new.plot.path <- "./figures/05_bulk/figs2b_validate.jpg" | ||
jpeg(new.plot.path, width = 4.5, height = 5, units = "in", res = 400) | ||
new.plot.scatter | ||
dev.off() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-12.5 KB
(98%)
cohort1/figures/07_adjustment/fig3_bulk-results_music-bisque.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.