## ----setup, echo=FALSE, results="hide", message=FALSE-------------------- knitr::opts_chunk$set(tidy=false,cache = true,dev =“ png”,message = false,error = false,parning = true)## libraries quirect(“ Biobase”)require(“ nmf”)require(“ cvxclustr”)## -------------------------------------------- 安装,eval = false ----------------------------------------------------------------------------------------------------------------------------------------------------#source(“ //www.andersvercelli.com/bioclite.r”)#bioclite(“ dasc”)## ---- message = false,结果='hide',eart eval = true -----------------------------------------库(DASC)数据(“ Esgolub”)样品<-c(20,21,28,30)dat <-exprs(esgolub)[1:100,样本] pdat <-pdata(esgolub)[样品,] ##使用nrun = 50或更多,以更好地收敛结果res res <-dasc(edata = dat,pdata = pdat,factor = factor = pdat $ cell,method ='ama',type = 3,lambda = 1,rank = 2:3,nrun = 5,注释=“ esgolub dataset”)#consensususmap(res)#plot(res)## ----消息= false,eval = true ------------------------------------------------------------------ ##图书馆set.seed(99999)库(deseq2)库(ggplot2)库(pcaexplorer)##数据集rawcounts <-StanfordData $ RAWCOUNTS Metadata <-StanfordData $ Metadata ## ----消息= false,eval = true ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ##使用较小的数据集IDX < - wher(元数据$ tissue%in%c(“脂肪”,“肾上腺”,“ sigmoid”))RAWCOUNTS <-awCounts [,IDX]元数据<-Metadata [idx,] ## ----消息= false,eval = true ------------------------------------------------------------------------------------------------------------------- head(rawCounts) head(metadata) ## ---- message=FALSE, eval=TRUE------------------------------------------- ## Normalizing the dataset using DESeq2 dds <- DESeqDataSetFromMatrix(rawCounts,元数据,设计=〜物种 +组织)dds < - 估计量:ddsFactor(dds)dat < - counts(dds,strormanized = true)lognormalizedCounts <-log2(dat + 1)## ----消息= false,eval = true------------------------------------------- ## PCA plot using rld.dds <- rlog(dds) pcaplot(rld.dds, intgroup=c("tissue","species"), ntop=1000, pcX=1, pcY=2) ## ---- message=FALSE, eval=TRUE------------------------------------------- res <- DASC(edata = dat, pdata = metadata, factor = metadata$tissue, method = 'ama', type = 3, lambda = 1, rank = 2:3, nrun = 10, annotation = 'Stanford Dataset') ## ---- message=FALSE, eval=TRUE------------------------------------------- ## Consensus plot consensusmap(res) ## ---- message=FALSE, eval=TRUE------------------------------------------- ## Residual plot plot(res) ## ---- message=FALSE, eval=TRUE------------------------------------------- ## Batches -- dataset has 6 batches sample.clust <- data.frame(sample.name = colnames(lognormalizedCounts), clust = as.vector(predict(res$fit$`2`)), batch = metadata$seqBatch) ggplot(data = sample.clust, aes(x=c(1:6), y=clust, color=factor(clust))) + geom_point(size = 4) + xlab("Sample Number") + ylab("Cluster Number") ## ---- message=FALSE------------------------------------------------------ sessionInfo()