MetaNeighbor: 评估细胞类型之间的相似性
2023-04-21 本文已影响0人
LET149
细胞类型重复性验证,验证细胞类型注释的真伪,不同数据或者文章中对相同细胞类型注释的准确性验证;同一物种不同细胞类型之间的相似性计算
https://www.jianshu.com/p/955dd0049bd2
http://events.jianshu.io/p/5b88bf5434bc
1. Paper-1
Li J, Wang J, Zhang P, et al. Deep learning of cross-species single-cell landscapes identifies conserved regulatory programs underlying cell types. Nat Genet. 2022;54(11):1711-1720. doi:10.1038/s41588-022-01197-7
image.png
10.1038/s41588-022-01197-7
image.png
2. Caculate AUROC score by MetaNeighbor
Scaling up reproducible research for single-cell transcriptomics using MetaNeighbor
image.png
https://www.nature.com/articles/s41596-021-00575-5
2023-04-20 22-15-04屏幕截图.png
3. 使用
library(scRNAseq)
library(org.Hs.eg.db)
library(MetaNeighbor)
library(SingleCellExperiment)
library()
#------------------------------------#
load("/home/zhiyong/Desktop/AAAAAAA-Amel-and-Bter/Figure-4__scRNA-seq_analysis/Integration/LIGER/Integration_of_Amel_3_and__Bter_15-3/K_20__Lambda_7__Dim_20/Cluster_number_12---used/Amel_3_raw_cluster_0_removed_doublet_removed_HVF_825_dims_8__with_celltype.RData")
load("/home/zhiyong/Desktop/AAAAAAA-Amel-and-Bter/Figure-4__scRNA-seq_analysis/Integration/LIGER/Integration_of_Amel_3_and__Bter_15-3/K_20__Lambda_7__Dim_20/Cluster_number_12---used/cluster_number_13---used/Bter_15_featue_over_800_Doublets_removed__HVF_2000_dim_12__with_celltype.RData")
object_used_Amel_raw <- Amel_3_raw_cluster_0_removed_doublet_removed_HVF_825_dims_8__with_celltype
object_used_Bter_raw <- Bter_15_featue_over_800_Doublets_removed__HVF_2000_dim_12__with_celltype
#-------------------------------------------------------------------------------------------------#
gene_used <- read.table("/home/zhiyong/Desktop/AAAAAAA-Amel-and-Bter/Figure-1__Genome-sequence_analysis/Gene_orthology/Amel-Bter_ortho_based_on_OrthoDB_only-one-to-one.txt")
gene_used <- gene_used[gene_used[,1]%in%rownames(object_used_Amel_raw),]
gene_used <- gene_used[gene_used[,2]%in%rownames(object_used_Bter_raw),]
matrix_used_Amel <- object_used_Amel_raw@assays$RNA@counts[gene_used[,1],]
colnames(matrix_used_Amel) <- paste(colnames(matrix_used_Amel), "_1", sep = "")
object_used_Amel <- CreateSeuratObject(matrix_used_Amel, min.cells = 0, min.features =0,project = "Amel_3")
object_used_Amel@meta.data[["Celltype"]] <- object_used_Amel_raw@active.ident
matrix_used_Bter <- object_used_Bter_raw@assays$RNA@counts[gene_used[,2],]
colnames(matrix_used_Bter) <- paste(colnames(matrix_used_Bter), "_2", sep = "")
rownames(matrix_used_Bter) <- gene_used[,1]
object_used_Bter <- CreateSeuratObject(matrix_used_Bter, min.cells = 0, min.features =0,project = "Bter_15")
object_used_Bter@meta.data[["Celltype"]] <- object_used_Bter_raw@active.ident
#------------------------------------#
object_used_Amel <- as.SingleCellExperiment(object_used_Amel)
object_used_Bter <- as.SingleCellExperiment(object_used_Bter)
#------------------------------------#
object_list <- list(Amel_3= object_used_Amel, Bter_15= object_used_Bter) '#load data
lapply(object_list, function(x) head(rownames(x), 3)) #display the gene name used; the objects used for merge must use the same gene name system
lapply(object_list, function(x) colnames(colData(x))) #check the column name of cell metadata, and make sure everu object has a column with the same column-name to store the cell type information
#------------------------------------#
lapply(object_list, function(x) names(assays(x))) #make sure the sprase expresion matrix are store as the name "counts"
#------------------------------------#
object_merged = mergeSCE(object_list) #merge all objects as a new object
dim(object_merged)
head(colData(object_merged))
table(object_merged$"Celltype", object_merged$study_id)
#------------------------------------#
global_hvgs = variableGenes(dat = object_merged, exp_labels = object_merged$study_id) #call the most variable genes across datasets
length(global_hvgs)
global_hvgs <- global_hvgs[1:800] #choose the top 500 variable genes to ultilize
#------------------------------------#
Aurocs_matrix = MetaNeighborUS(var_genes = global_hvgs, dat = object_merged, study_id = object_merged$study_id, cell_type = object_merged$"Celltype", fast_version = TRUE)
Aurocs_matrix <- Aurocs_matrix[1:7,8:13]
Aurocs_matrix <- Aurocs_matrix[c(7,6,5,4,1,2,3),]
Aurocs_matrix <- Aurocs_matrix[,c(6,5,4,1,2,3)]
#------------------------------------#
Heatmap(Aurocs_matrix, cluster_rows = F, cluster_columns = F)