# #——包括= FALSE --------------------------------------------------------- knitr: opts_chunk美元集(崩溃= TRUE,发表评论 = "#>" ) ## ---- quickYo eval = FALSE ---------------------------------------------------- # 如果(!requireNamespace("BiocManager", quiet = TRUE)) # install.packages("BiocManager") # BiocManager::install("FEAST") ## ----quick, eval = TRUE, message=FALSE, results='hide', include = TRUE-------- library(FEAST) data(Yan) k = length(unique(trueclass)) Y = process_Y(Y, thre = 2) #核心功能。ixs = FEAST(Y, k=k) #查看特征Ynorm = Norm_Y(Y) par(mfrow = c(3,3)) for (i in 1:9){tmp_ix = ixs[i] tmp_gene = rownames(Ynorm)[tmp_ix] boxplot(as。数字(Ynorm [tmp_ix]) ~ trueclass,主要= tmp_gene xlab = " ", ylab = " ",拉斯维加斯= 2 ) } ## ---- load_data eval = TRUE --------------------------------------------------- 数据(Yan)暗(Y)表(trueclass) # #——共识,eval = TRUE,消息= FALSE,结果=“隐藏”,包括= TRUE, Y = process_Y (Y, 3 = 2) #如果需要预处理数据con_res =共识(Y, k = k) # #——能够eval = TRUE,消息= FALSE,结果=“隐藏”,包括= TRUE, F_res = cal_F2 (Y,con_res$cluster) ixs = order(F_res$F_scores, deleting = TRUE) # order features ## ----validation, eval = TRUE, message=FALSE, results='hide', include = TRUE---- ##聚类step tops = c(500,1000,2000) cluster_res = NULL for (top in tops){tmp_ixs = ixs[1:top] tmp_markers = rownames(Y)[tmp_ixs] tmp_res = TSCAN_Clust(Y, k = k, input_markers = tmp_markers) #tmp_res = SC3_Clust(Y, k = k,input_markers = tmp_markers) cluster_res[[toString(top)]] = tmp_res} ##验证步骤Ynorm = Norm_Y(Y) mse_res = NULL for (top in names(cluster_res)){tmp_res = cluster_res[[top]] tmp_cluster = tmp_res$cluster tmp_mse = cal_MSE(Ynorm = Ynorm, cluster = tmp_cluster) mse_res = c(mse_res, tmp_mse)} names(mse_res) = names(cluster_res) ## ----demo, eval = TRUE, message=FALSE, results='hide', include = TRUE--------- original = TSCAN_Clust(Y,k = k) id = which.min (mse_res) eval_Cluster(原始集群美元,trueclass) eval_Cluster (cluster_res [[id]]美元集群,trueclass) # #——wraper-group eval = TRUE,消息= FALSE,结果=“隐藏”,包括= TRUE, fig.height = 4.5, fig.width = 8——数据(Yan) Y = process_Y (Y, 3 = 2) #如果需要预处理数据con_res =共识(Y, k = k) mod_res = Select_Model_short_TSCAN (Y,集群= con_res $集群,= c (200, 500, 1000, 2000)) # mod_res = Select_Model_short_SC3 (Y,集群= con_res $集群,Top = c(200,500,1000,2000)) #要将结果可视化,需要加载ggpubr库。library(ggpubr) PP = Visual_Rslt(model_cv_res = mod_res, trueclass = trueclass) print(PP$ggobj) #显示可视化图。# #——wraperfunctions eval = TRUE,消息= FALSE,结果=“隐藏”,包括= TRUE, fig.height = 4.5, fig.width = 8——第九=盛宴(Y, k = k) #第九= FEAST_fast (Y, k = k) #第九= FEAST_fast (Y, k = k,分裂= TRUE, batch_size = 1000 ) ## ----------------------------------------------------------------------------- sessionInfo ()