# #——style-knitr eval = TRUE,呼应= FALSE,结果= "飞机 "-------------------- BiocStyle:乳胶 () ## ---- 设置,包括= FALSE,缓存= FALSE ---------------------------------------- 库(knitr) #美元全球块选项opts_knit集合(基地。Dir = '.') opts_chunk$setpath='figure/minimal-', fig.align='center', fig.show='hold') options(replace.assign=TRUE,width=80) ## ----loaddata, cache=TRUE, warning=FALSE, tidy=TRUE, dependson='data_import'---- #下载NCBI GEO data with GEOquery library(knitr) rm(list = ls()) library(GEOquery) library(stringr) library(Rnits) gds <- getGEO('GSE4158',AnnotGPL = FALSE)[[1]] class(gds) gds #提取非复制样本pdata <- pdata (gds) filt <- pdata$characteristics_ch2 %in% names(which(table(pdata$characteristics_ch2) == 2)) gds <- gds[, filt] pdata <- pdata (gds) time <- as。numeric(str_extract(pdata$characteristics_ch2, "\\d+")) sample <- rep("2g/l", length(time)) sample[grep("0.2g/l", gds[["title"]])] <- "0.2g/l" #用时间和样本信息格式化表型数据gds[[" time "]] <- time gds[[" sample "]] <- sample dat <- gds fData(dat)["Gene Symbol"] <- fData(dat)$ orf# # ----buildrnitsobj, tidy=TRUE, cache=TRUE, dependson='loaddata'--------------- #从格式化的数据(样本可以是任意顺序)#和数组间归一化构建rnits数据对象。Rnitsobj = build。Rnits(dat[, sample(ncol(dat))], logscale = TRUE, normmethod = "Between") rnitsobj #或者,我们也可以从一个数据矩阵中构建对象,通过提供"probedata"和"phenodata"表datdf <- exprs(dat) rownames(datdf) <- fData(dat)$ID probedata <- data.frame(ProbeID=fData(dat)$ID, GeneName=fData(dat)$ORF) phenodata <- pData(dat) rnitsobj = build。Rnits(datdf, probedata = probedata, phenodata = phenodata, logscale =TRUE, normmethod =' Between') #提取归一化表达值lr <- getLR(rnitsobj) head(lr) #使用K-nn imputation Impute缺失值lr <- getLR(rnitsobj, Impute =TRUE) head(lr) ## ----fit_model, cache=TRUE, fig.keep='first', dependson='buildrnitsobj'------- #使用基因级摘要拟合模型rnitsobj <- Fit (rnitsobj,基因。level = TRUE, clusterallsamples = TRUE) ## ----fit_model_noclustering, eval=FALSE, dependson='buildrnitsobj'------------ # rnitsobj_nocl <- fit(rnitsobj,基因。level = TRUE, clusterallsamples = FALSE) # # opt_model <- calculateGCV(rnitsobj) # rnitsobj_optmodel <- fit(rnitsobj,基因。level =TRUE, model = opt_model) ## ----modelsummary, cache=TRUE, dependson='fit_model', tidy=TRUE-------------- #从拟合模型pval中获取pvalues <- getPval(rnitsobj) head(pval) #从拟合模型中获取比率统计数据stat <- getStat(rnitsobj) head(stat) #如果使用了聚类,则检查聚类基因分布表(getCID(rnitsobj)) # P-values,率统计和集群ID可以检索的所有基因一起fitdata < - getFitModel (rnitsobj)头(fitdata) #顶级基因的观点总结总结(rnitsobj顶级= 10)#的基因中提取数据(5%罗斯福)td <——topData (rnitsobj,罗斯福= 5)头(td) # #——plotresults,取决于= modelsummary,缓存= TRUE,整洁= TRUE ------------- # 情节上基因轨迹plotResults (rnitsobj顶级= 16)# #——sessionInfo -------------------------------------------------------------- sessionInfo ()