## ----long-example,warning=FALSE, echo=-c(1,2,3,4)----------------------- suppressPackageStartupMessages(library(Biobase)) library(knitr) opts_chunk$set(error=FALSE) #load_all('..') library(MAST) library(data.table) library(plyr) data(vbeta) colnames(vbeta) vbeta <- computeEtFromCt(vbeta) vbeta。< / p > < p > < / p >ID”、“芯片。“Number”,“Well”),primerid=“Gene”,measurement=“Et”,ncells=“Number.of”。细胞的geneid =“基因”,cellvars = c (Number.of。细胞”、“人口”),phenovars = c(“Stim.Condition”,“时间”),id =“vβ”)显示(vbeta.fa) # #——examineMeta --------------------------------------------------------- 头(fData (vbeta.fa), 3)头(cData (vbeta.fa), 3) # #——子集,警告= FALSE ----------------------------------------------- sub1 < - vβ。fa[1:10,] show(sub1) sub2 <-子集(vbeta.)fa, Well=='A01') show(sub2) sub3 <- vbeta。fa(1:10, 6:10)显示(sub3) cellData (sub3) featureData (sub3) # #——分裂,警告= FALSE ------------------------------------------------- sp1 < -分裂(vβ。足总,Subject.ID)显示(sp1) # #——结合,警告= FALSE,回声= 1 -------------------------------------- ## unloadNamespace(“gplots”)结合(x = sp1 ([1]), y = sp1[[2]])结合(sp1) # #——combineDF ----------------------------------------------------------- newData < - data.frame (otherVariable = rnorm (nrow (vbeta.fa))) vbetaWithNewData < - (vβ相结合。(cData(vbetaWithNewData))) ## ----splitbyncells,警告=FALSE, fig.height=4, fig.width=4-------------- vbeta.split<-split(vbeta.fa,"Number.of.Cells") #参见默认参数plotSCAConcordance(vbeta.split[[1]],vbeta. split[[1]],vbeta. split[[1]],vbeta. split[[1]])分裂[[2]],filterCriteria =列表(nOutlier = 1, sigmaContinuous = 9, sigmaProportion = 9 )) ## ---- otherFiltering,警告= FALSE --------------------------------------- vβ。f# #通过“ncells”拆分,应用于每个组件,然后重组vbeta。< -过滤器过滤(vβ。fa, groups='ncells') ##返回布尔矩阵。< -过滤器过滤(vβ。fa, apply_filter=FALSE) ## Wells filter for being discrete离群值## ---- burdenfiltering, warning=FALSE, fig.width=4, fig.height=4--------- burdenfiltering (vbeta. filter, pctout))ncell的fa, byGroup = TRUE) # #——zlmArgs ------------------------------------------------------------- vβ。1 (vβ< -子集。fa, ncells==1) ##考虑前20个基因vbeta。1 < - vβ。1[,1:20] layername(vbeta.1) head(cData(vbeta.1)) ## ----zlmExample, warning=FALSE, message=FALSE, fig.width=6, fig.height=6---- library(ggplot2) library(shape) library(abind) zlm. x . x . x< - zlm输出。SingleCellAssay(~ Population + Subject.ID, vbeta.1, method='glm', ebayes=TRUE) show(zlm.output) ## returns a data.table with a summary of the fit coefAndCI <- summary(zlm.output, logFC=FALSE) coefAndCI <- coefAndCI[contrast != '(Intercept)',] coefAndCI[,contrast:=abbreviate(contrast)] ggplot(coefAndCI, aes(x=contrast, y=coef, ymin=ci.lo, ymax=ci.hi, col=component))+ geom_pointrange(position=position_dodge(width=.5)) +facet_wrap(~primerid) + theme(axis.text.x=element_text(angle=45, hjust=1)) + coord_cartesian(ylim=c(-3, 3)) ## ----tests--------------------------------------------------------------- zlm.lr <- lrTest(zlm.output, 'Population') dimnames(zlm.lr) pvalue <- ggplot(melt(zlm.lr[,,'Pr(>Chisq)']), aes(x=primerid, y=-log10(value)))+ geom_bar(stat='identity')+facet_wrap(~test.type) + coord_flip() print(pvalue) ## ----lmerExample, warning=FALSE, message=FALSE, eval=TRUE---------------- library(lme4) lmer.output <- zlm.SingleCellAssay(~ Stim.Condition +(1|Subject.ID), vbeta.1, method='glmer') ## ----LRTexample, echo=-1------------------------------------------------- library(car) two.sample <- LRT(vbeta.1, 'Population', referent='CD154+VbetaResponsive') car::some(two.sample)