#Robin 2020/03/08
# Run M3Drop
library(Seurat)
library(ggplot2)
library(M3Drop)
library(ggplot2)
setwd('/share/nas1/Data/Users/luohb/20200307_M3Drop2')
#loadind data of Seurat Object
seu.obj<-readRDS("../20200221/scaled_merge_seurat_rna.rds")
Idents(seu.obj)<-seu.obj@meta.data$seurat_clusters
#选择某个亚群去分析
DE_genes<-read.table('/share/nas1/Data/diff_enrich/cluster11/cluster11_condition_VS_control_sig_diffgene.xls',
header=T) #读入差异表达基因
# 取相应亚群的Seurat子集
c11.seu.obj<-subset(seu.obj, seurat_clusters=="11")
counts<-c11.seu.obj@assays$RNA@counts #提取矩阵
dim(counts)
# 归一化
Normalized_data <- M3DropCleanData(counts,
labels = c11.seu.obj@meta.data$group, #前面已经在Seurat对象的meta.data增加了一列分组信息
is.counts=TRUE,
min_detected_genes=2000)
## Michaelis-Menten
pdf(file="Michaelis-Menten.pdf")
fits<-M3DropDropoutModels(Normalized_data$data)
dev.off()
#由于我是用之前自己跑的差异基因数据,所以这里我就不运行下面这行代码了
# DE_genes <- M3DropDifferentialExpression(Normalized_data$data,
# mt_method="fdr", mt_threshold=0.01)
par(mar=c(1,1,1,1))
dev.new()
heat_out <- M3DropExpressionHeatmap(DE_genes$gene, expr_mat=Normalized_data$data,
cell_labels = Normalized_data$labels)
网友评论