We want to compare the clusters we obtained with the two datasets:
library(matchSCore2)
library(nnet)
library(Matrix)
library(Seurat)
library(ggplot2)
<- c('epi', 'myeloids', 'plasmas', 'stroma', 'tcells')
subsets
for(subset in subsets){
<- readRDS(paste0("~/000_GitHub/ibd-bcn_single_cell/Analysis of our data/01_Samples_by_Health/HC/annotated/", subset, ".RDS"))
ref @active.ident <- factor(ref$annotation)
ref<- FindAllMarkers(ref, only.pos = T)
output.seu <- cut_markers(levels(output.seu$cluster),output.seu,ntop=100)
gene_cl.ref saveRDS(gene_cl.ref, file = paste0("~/000_GitHub/ibd-bcn_single_cell/Analysis of our data/01_Samples_by_Health/HC/annotated/genes/",subset,"_gene_cl.ref.RDS"))
}
for(subset in subsets){
<- readRDS(paste0("~/000_GitHub/ibd-bcn_single_cell/Analysis of our data/01_Samples_by_Health/IBD/annotated/", subset, ".RDS"))
ref @active.ident <- factor(ref$annotation)
ref<- FindAllMarkers(ref, only.pos = T)
output.seu <- cut_markers(levels(output.seu$cluster), output.seu, ntop=100)
gene_cl.ref saveRDS(gene_cl.ref, file = paste0("~/000_GitHub/ibd-bcn_single_cell/Analysis of our data/01_Samples_by_Health/IBD/annotated/genes/",subset,"_gene_cl.ref.RDS"))
}
for(subset in subsets){
<- readRDS(file = paste0("~/000_GitHub/ibd-bcn_single_cell/Analysis of our data/01_Samples_by_Health/IBD/annotated/genes/",
ibd
subset,"_gene_cl.ref.RDS"))
<- readRDS(file = paste0("~/000_GitHub/ibd-bcn_single_cell/Analysis of our data/01_Samples_by_Health/HC/annotated/genes/",
hc
subset,"_gene_cl.ref.RDS"))
<- matchSCore2(gene_cl.ref = hc,
ms gene_cl.obs = ibd,
ylab = "IBD",
xlab = "HC")
$ggplot$layers[[2]]$aes_params$size <- 3
ms<- ms$ggplot +
j theme(axis.text.x = element_text(angle=90,
vjust = 0.5, size = 9),
axis.text.y = element_text(size = 9))
cat("## ", subset, "\n"); print(j); cat("\n\n")
}
```