library(Seurat) library(dplyr) Full_final <- readRDS("/DATA/31/molteni/vexas_mouse_4/results/Full/01-seurat/Full_final.rds") # ######################################################################################################################### # # computation on custom annotation # Full_final <- readRDS("/DATA/31/molteni/vexas_mouse_4/results/Full/01-seurat/Full_final_annot.rds") setwd("/DATA/31/molteni/vexas_mouse_4/results/DE_markers/AvsB/") clusters <- unique(Full_final@meta.data$celltypes_annot) for(i in clusters) { markers <- FindMarkers(Full_final, ident.1 = "Pool_A_m", group.by = "orig.ident", subset.ident = i) markers['cluster'] <- i filename=paste("markers_cluster_",i,".csv", sep="") write.csv(markers, file=filename) } df <- list.files(path="/DATA/31/molteni/vexas_mouse_4/results/DE_markers/AvsB") %>% lapply(read.csv) %>% bind_rows df <- df[df$p_val_adj<0.05,] setwd("/DATA/31/molteni/vexas_mouse_4/results/summary/") write.csv(df, file="PoolA_mvsPoolB_m_sigMarkers.csv") cells_by_sample <- table(Full_final@meta.data$celltypes_annot, Full_final@meta.data$orig.ident) write.csv(cells_by_sample, file="cells_bysample.csv") cc_distribution <-as.data.frame (table(Full_final$Phase, Full_final$orig.ident, Full_final$celltypes_annot)) colnames(cc_distribution) <- c("Phase","orig.ident","cluster","CellNumb") write.csv(cc_distribution, file="cell_cycle.csv")