R语言 在做基因差异表达时下标出界

FLOWER370 |浏览5479次
2016/05/23 01:16
  • 问题补充 : 2016/05/23 01:17

    library(Biobase)

    library(BiocGenerics)

    library(affy)

    library(limma)

    library(pheatmap)


    filename = list.files("CCLEpaxOVrna") 


    dir = paste("./CCLEpaxOVrna/",filename,sep="") 


    n = length(dir)

    data = ReadAffy(filenames=filename[1] )

    for (i in 2:n){ new.data = ReadAffy(filenames = filename[i])

    data = merge(data,new.data)}

    aaa<-rma(data)

    aa2<-exprs(aaa)

    head(aa2)


    control<-aa2[,c(5,6,10,20)]

    LPS<-aa2[,-c(5,6,10,20)]

    design <- model.matrix(~ -1+factor(c(1,1,1,1, 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2)))


    colnames(design) <- c("control", "LPS")

    fit <- lmFit(aa2, design)

    contrast.matrix <- makeContrasts(control-LPS, levels=design)

    fit <- eBayes(fit)

    fit2 <- contrasts.fit(fit, contrast.matrix)

    fit2 <- eBayes(fit2)

    dif<-topTable(fit2,coef="control-LPS",n=nrow(fit2),lfc=2)

    dif<-dif[dif[,"P.Value"]<0.5

    head(dif)


  • 问题补充 : 2016/05/23 01:18

    > dif<-topTable(fit2,coef="control-LPS",n=nrow(fit2),lfc=2)

    Error in fit$coefficients[, coef] : 下标出界


收藏关注

满意回答

2016/05/30 11:32

当你的索引超过它的维数时,会引起下标越界的错误

matlab-007

其他回答(0)    我来补答
2人关注该问题
+1
 加载中...