seu_combined_selectsamples <- RunPCA(seu_combined_selectsamples,assay = "SCT.RNA", features = genes.variable, verbose = FALSE, ndims.print = 0, reduction.name = "pca.RNA")
seu_combined_selectsamples <- RunPCA(seu_combined_selectsamples, assay = "PROT", features = proteins.all, verbose = FALSE, ndims.print = 0,reduction.name = "pca.PROT")
plot.PCA.RNA <- DimPlot(seu_combined_selectsamples, reduction = "pca.RNA", group.by = "condition", pt.size =0.2) +
scale_color_manual(values = colorgradient6_manual2, labels = c(labels), name = "Time aIg",)+
labs(title = "RNA PCA separates cells \nat hour time-scale", x= "RNA PC 1", y = " RNA PC 2") +
add.textsize +
theme(legend.position = "none")
plot.PCA.PROT <- DimPlot(seu_combined_selectsamples, reduction = "pca.PROT", group.by = "condition", pt.size = 0.2) +
scale_color_manual(values = colorgradient6_manual2, labels = c(labels), name = "Time aIg",)+
labs(title = "(phospho-)protein PCA separates cells\nat minutes time-scale", x= "Protein PC 1", y = "Protein PC 2") +
add.textsize +
theme(legend.position = "none")
legend <- get_legend(DimPlot(seu_combined_selectsamples, reduction = "pca.RNA", group.by = "condition", pt.size =0.1) +
scale_color_manual(values = colorgradient6_manual2, labels = c(labels), name = "Time aIg",)+
add.textsize)
legend <- as_ggplot(legend)
PCA.PROTPC1.data <- data.frame(rank = 1:80,
protein = names(sort(seu_combined_selectsamples@reductions$pca.PROT@feature.loadings[,1])),
weight.PC1 = sort(seu_combined_selectsamples@reductions$pca.PROT@feature.loadings[,1]),
highlights = c(names(sort(seu_combined_selectsamples@reductions$pca.PROT@feature.loadings[,1]))[1:4],rep("",76))
)
plot.PCA.PROTweightsPC1 <- ggplot(PCA.PROTPC1.data, aes(x=weight.PC1, y = rank, label = highlights)) +
geom_point(size=0.1) +
labs(title = "Top 4 protein loadings \n", x= "Weight Protein PC1") +
geom_point(color = ifelse(PCA.PROTPC1.data$highlights == "", "grey50", "red")) +
geom_text_repel(size = 2, segment.size = 0.25)+
theme_half_open()+
add.textsize +
theme(axis.title.y=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank()
) +
scale_x_reverse()+
scale_y_reverse()
PCA.RNAPC1.data <- data.frame(rank = 1:2371,
RNA = names(sort(seu_combined_selectsamples@reductions$pca.RNA@feature.loadings[,1])),
weight.PC1 = sort(seu_combined_selectsamples@reductions$pca.RNA@feature.loadings[,1]),
highlights = c(rep("",2366),names(sort(seu_combined_selectsamples@reductions$pca.RNA@feature.loadings[,1]))[2367:2371])
)
plot.PCA.RNAweightsPC1 <- ggplot(PCA.RNAPC1.data, aes(x=weight.PC1, y = rank, label = highlights)) +
geom_point(size=0.1) +
labs(title = "Top 4 RNA loadings \n", x= "Weight RNA PC1") +
geom_point(color = ifelse(PCA.RNAPC1.data$highlights == "", "grey50", "red")) +
geom_text_repel(size = 2, segment.size = 0.25)+
theme_half_open()+
add.textsize +
theme(axis.title.y=element_blank(),
axis.text.y=element_blank(),
axis.ticks.y=element_blank()
)
PC1.data <- data.frame(sample = rownames(seu_combined_selectsamples@reductions$pca.PROT@cell.embeddings),
PC1_PROT = seu_combined_selectsamples@reductions$pca.PROT@cell.embeddings[,1],
PC1_RNA = seu_combined_selectsamples@reductions$pca.RNA@cell.embeddings[,1]) %>%
left_join(meta.allcells)
plot_ridge_PC1Prot <- ggplot(PC1.data, aes(x = PC1_PROT, y = condition, fill = condition)) +
scale_fill_manual(values = colorgradient6_manual, labels = c(labels), name = "Time aIg \n(minutes)")+
geom_density_ridges2() +
scale_y_discrete(labels = labels, name = "Time aIg (minutes)")+
scale_x_continuous(name = "PC1 Proteins") +
theme_half_open() +
add.textsize+
theme(legend.position = "none")
plot_ridge_PC1RNA <- ggplot(PC1.data, aes(x = PC1_RNA, y = condition, fill = condition)) +
scale_fill_manual(values = colorgradient6_manual, labels = c(labels), name = "Time aIg \n(minutes)")+
geom_density_ridges2() +
scale_y_discrete(labels = labels, name = "Time aIg (minutes)")+
scale_x_continuous(name = "PC1 RNA") +
theme_half_open() +
add.textsize+
theme(legend.position = "none")
Fig1.pca <- plot_grid(plot.PCA.PROT,plot.PCA.RNA,legend, plot_ridge_PC1Prot, plot_ridge_PC1RNA,NULL, plot.PCA.PROTweightsPC1, plot.PCA.RNAweightsPC1, labels = c(panellabels[1:2], "","","","",panellabels[3:4]), label_size = 10, ncol = 3, rel_widths = c(0.9,0.9,0.2,0.9,0.9), rel_heights = c(1,0.8,1.3))
ggsave(filename = "output/paper_figures/Suppl_PCA_aIg.pdf", width = 143, height = 170, units = "mm", dpi = 300, useDingbats = FALSE)
ggsave(filename = "output/paper_figures/Suppl_PCA_aIg.png", width = 143, height = 170, units = "mm", dpi = 300)
Fig1.pca