## ----------------------------------------------------------------------------- suppressPackageStartupMessages(库(SingleCellExperiment))库(ggplot2);theme_set (theme_bw())库(DuoClustering2018)需要(用水晶球占卜 ) ## ----------------------------------------------------------------------------- 南加州爱迪生公司< -sce_full_Zhengmix4eq () # m <计数(sce) # UMI计数< -as.data.frame (colData (sce #厘米 )) ## ---- 无花果。宽度= 6,fig.height = 4 ------------------------------------------------ 南加州爱迪生公司< -devianceFeatureSelection (sce检测=“计数”,排序= TRUE)情节(rowData (sce) binomial_deviance美元,类型=“l”,xlab =“排名基因”,ylab =“二项异常”,主要=“与异常特征选择”)abline (v = 2000, lty = 2,坳= "红色 ") ## ----------------------------------------------------------------------------- (1:1000 sce2 <大带宽 , ] ## ---- 无花果。宽度= 6,fig.height = 4 ------------------------------------------------ set.seed (101) sce2 < -GLMPCA (sce2 2测定=“计数”)符合<元数据(sce2)美元glmpca pd < -cbind (as.data.frame (colData (sce2)),适合美元因素)ggplot (pd, aes (x = dim1, y = dim2,颜色= phenoid)) + geom_point(大小= 8)+ ggtitle(“GLM-PCA应用于高异常基因 ") ## ---- 无花果。width=6, fig.height=8------------------------------------------------ sce<-nullResiduals(sce, assay="counts", type="deviance") sce<-nullResiduals(sce, assay="counts", type="pearson") sce2<-sce[1:1000,] #只使用高偏差基因pca<-function(Y, L=2, center=TRUE, scale=TRUE){#假设features=rows, observations=cols res<-prcomp(as.matrix(t(Y)), center=center, scale。=scale, rank.=L) factors<-as.data.frame(res$x) colnames(factors)<-paste0("dim", 1:L) factors} pca_d<-pca(assay(sce2, "binomial_deviance_residuals")) pca_d$resid_type<-"deviance_residuals" pca_p<-pca(assay(sce2, "binomial_pearson_residuals")) pca_p$resid_type<-" pearance_residuals " cm<-as.data.frame(colData(sce2)) pd<-rbind(cbind(cm, pca_d), cbind(cm, pca_p)) ggplot(pd, aes(x=dim1, y=dim2, color =phenoid)) + geom_point() + facet_wrap(~resid_type, scales="free",nrow=2) + ggtitle(“PCA应用于高异常基因的零残差”)