#compare R406W homozygous to ctrls of good isogenic pairs Astsaver.goodonly.seurat <- SetIdent(Astsaver.goodonly.seurat, value = "Genotype3") DEGs_hom <- FindMarkers(Astsaver.goodonly.seurat, ident.1 = "hom", ident.2 = "ctrl", logfc.threshold = 0, min.pct = 0, test.use = "MAST") DEGs_hom <- DEGs_hom[order(DEGs_hom$avg_logFC, decreasing = TRUE),] DEGs_hom$p_val_adj_BH <- p.adjust(p = DEGs_hom$p_val, method = "BH") DEGs_hom$p_val_adj_BY <- p.adjust(p = DEGs_hom$p_val, method = "BY") DEGs_hom_sig <- DEGs_hom[DEGs_hom$p_val_adj_BH <= 0.05,] write.csv(DEGs_hom_sig, file ='Ast_DEGs_hom_MAST_sig.txt') #Volcano Plot library(EnhancedVolcano) keyvals <- ifelse( DEGs_hom$avg_logFC < -0.05 & DEGs_hom$p_val_adj_BH < 0.05, 'royalblue', ifelse(DEGs_hom$avg_logFC > 0.05 & DEGs_hom$p_val_adj_BH < 0.05, 'red2', 'darkgrey')) keyvals[is.na(keyvals)] <- 'darkgrey' names(keyvals)[keyvals == 'red2'] <- 'high' names(keyvals)[keyvals == 'darkgrey'] <- 'mid' names(keyvals)[keyvals == 'royalblue'] <- 'low' #plot with labels of cholesterol-related DEGs EnhancedVolcano(DEGs_hom, lab = rownames(DEGs_hom), x = 'avg_logFC', y = 'p_val_adj_BH', #xlim = c(-0.4, 0.4), #ylim = c(0,6), xlab = bquote('avg log fold change'), ylab = bquote('-log10(p adj) '), axisLabSize = 28, title = 'astrocytes homozygous R406W', selectLab = c("DHCR7", "DHCR24", "FDFT1", "FDPS", "HMGCR", "HMGCS1", "HSD17B7", "IDI1", "LSS", "MVD", "MSMO1", "SC5D", "SQLE", "INSIG1", "SREBF2", "ACAT2", "STARD4", "LDLR"), pCutoff = 0.05, FCcutoff = 0.05, pointSize = 5, colCustom = keyvals, colAlpha = 1, labSize = 8, boxedLabels = TRUE, labFace = 'bold', drawConnectors = TRUE, widthConnectors = 1.0, gridlines.minor = FALSE) rm(keyvals) writeLines(capture.output(sessionInfo()), "sessionInfo_astrocytes.txt")