-
Notifications
You must be signed in to change notification settings - Fork 0
/
SuppFig4_PCA_Endothelial.R
42 lines (34 loc) · 1.3 KB
/
SuppFig4_PCA_Endothelial.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
###########################
#### scDVP Figure Code ####
###########################
#### -- Supplementary Figure S4 -- ####
## -- Prepare Workspace
cat("\014")
rm(list=ls())
## Read relevant data
load("../output/variables/d_all_norm.R")
load("../output/variables/statTable_all.R")
## Endothelial cell PCA
d_all_norm %>%
dplyr::select(Protein, int_core, cell_ID) %>%
spread(cell_ID, int_core) %>%
filter(complete.cases(.)) %>%
column_to_rownames("Protein") -> d_complete_all
meta_all <- statTable_all %>%
distinct(bio_ID, label, cell_ID, run_ID, heps) %>%
filter(cell_ID %in% colnames(d_complete_all)) %>%
arrange(cell_ID) %>%
mutate(run_number = as.numeric(str_replace(run_ID, ".*_", ""))) %>%
column_to_rownames("cell_ID")
p <- PCAtools::pca(d_complete_all, metadata = meta_all, removeVar = 0.1)
PCAtools::biplot(p,
colby = 'heps',
hline = 0, vline = 0,
labSize = 3,
lab = NA,
encircle = F,
encircleFill = F,
showLoadings = F,
shape = 'heps', shapekey = c('FALSE'=25, 'TRUE'=21), fill = 'heps') +
scale_color_manual(values = c("darkred","grey")) -> pca_endothelial
ggsave(pca_endothelial, file = "../Output/Figures/PCA_Endothelial.pdf", width = 7, height = 6)