美文网首页
单细胞分析之metacell包分析流程

单细胞分析之metacell包分析流程

作者: 多啦A梦詹 | 来源:发表于2020-02-06 12:35 被阅读0次

我们演示的数据集是GSE110547,可以从github中下载。

setwd("D:\\R\\ll\\GSE110547")
GSE110547<-read.table("GSE110547.csv",sep = ",",header = T,stringsAsFactors = F)
x<-colnames(GSE110547)
eset<-GSE110547[,unlist(lapply(x,function(x) strsplit(as.character(x),"_")[[1]][1]))=="SpleenTR"]
eset$gene<-GSE110547[,1]
eset1<-aggregate(eset[,1:816],by=list(eset$gene),max)
dataMouse<-eset1[,2:817]
rownames(dataMouse)<-eset1[,1]
GSE110547a<-dataMouse[,1:204]
GSE110547b<-dataMouse[,205:408]
GSE110547c<-dataMouse[,409:612]
GSE110547d<-dataMouse[,613:816]
GSE110547e<-dataMouse[,409:510]
GSE110547f<-dataMouse[,511:612]
GSE110547g<-dataMouse[,613:714]
GSE110547h<-dataMouse[,715:816]
write.table(GSE110547h,file = "GSE110547h.txt",sep = "\t",quote = F)
write.table(GSE110547g,file = "GSE110547g.txt",sep = "\t",quote = F)
write.table(GSE110547f,file = "GSE110547f.txt",sep = "\t",quote = F)
write.table(GSE110547e,file = "GSE110547e.txt",sep = "\t",quote = F)
write.table(GSE110547d,file = "GSE110547d.txt",sep = "\t",quote = F)
write.table(GSE110547c,file = "GSE110547c.txt",sep = "\t",quote = F)
write.table(GSE110547b,file = "GSE110547b.txt",sep = "\t",quote = F)
write.table(GSE110547a,file = "GSE110547a.txt",sep = "\t",quote = F)

分群聚类&画图

在工作目录下新建UMI目录,存放新生成的8个文件。

library(metacell)   #第一步可加glob_blacklist_terms=scan("blacklist.txt",what="")
sc_mat = sc_pipe_clean(index_fn =
    "batchfile.txt",
    base_dir = "UMI/",
    batch_meta_attr = "MARS_BATCH",
    mark.sz_cor_norm_max= -0.05,
    mark.niche_T = 0.05,
    mark.min_tot=100,
    mark.min_var_mean = 5,
    clust_knn=150,
    min_umi_n = 100,
    max_umi_n=5000,
    amb_epsilon=0.03,
    min_clust_size = 30,
    sample_n_batches = NA,
    filt_amb_on_clusts=T,
    filt_outliers_on_clusts=F)


sc_cl = sc_pipe_cluster(sc_mat,
    mark.sz_cor_norm_max= -0.05,
    mark.niche_T = 0.05,
    mark.min_var_mean = 5,
    mark.min_tot=100,
    clust_knn=150,
    min_clust_size = 30,
    filt_outliers_on_clusts=F,
    clust_fp_metadata_fields = NA)


sc_pipe_plots(sc_cl,         
    focus_tfs_fn=NA,                 
    force_max_deg_2dproj = 8,
    store_rda_fn="Plotting_data.Rda",          
    T_edge_asym = F,
    K_2dproj = 60,
    K_cells_2dproj = 30,
    T_edge_2dproj = 0.05,
    restrict_edges_by_fpcor=T)

生成的图如下:


all_2d.png confusion_cor_k60.png confusion_k60.png graph_2d.png markers.png marks_all_mat.png marks_clust_mat.png metadata.png

相关文章

网友评论

      本文标题:单细胞分析之metacell包分析流程

      本文链接:https://www.haomeiwen.com/subject/cqvithtx.html