This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Can we get the results for Student t test and Welch t test by using limma?.

I am new to gene data analysis. Earlier I posted the questions. but I failed to understand the answers(because I have no big knowledge about the analysis of the gene). If we take this code to find the moderate t values, can we find the Student t-test and Welch t-test by using limma?

   gset <- getGEO("GSE116486", GSEMatrix =TRUE, AnnotGPL=TRUE)
   if (length(gset) > 1) idx <- grep("GPL570", attr(gset, "names")) else idx <- 1
  gset <- gset[[idx]]

  # make proper column names to match toptable 
 fvarLabels(gset) <- make.names(fvarLabels(gset))

 # group membership for all samples
 gsms <- "0000001000001111111110001111000001000001000110"
sml <- strsplit(gsms, split="")[[1]]

# log2 transformation
ex <- exprs(gset)
qx <- as.numeric(quantile(ex, c(0., 0.25, 0.5, 0.75, 0.99, 1.0), na.rm=T))
LogC <- (qx[5] > 100) ||
(qx[6]-qx[1] > 50 && qx[2] > 0)
if (LogC) { ex[which(ex <= 0)] <- NaN
 exprs(gset) <- log2(ex) }

 exprs(gset) <- normalizeBetweenArrays(exprs(gset)) # normalize data
 exprs(gset)
  # assign samples to groups and set up design matrix
 gs <- factor(sml)
 groups <- make.names(c("AD case","Normal case"))
 levels(gs) <- groups
  gset$group <- gs
 design <- model.matrix(~group + 0, gset)
 colnames(design) <- levels(gs)

  fit <- lmFit(gset, design)  # fit linear model

  # set up contrasts of interest and recalculate model coefficients
 cts <- paste(groups[1], groups[2], sep="-")
 cont.matrix <- makeContrasts(contrasts=cts, levels=design)
 fit2 <- contrasts.fit(fit, cont.matrix)

 # compute statistics and table of top significant genes
 fit2 <- eBayes(fit2, 0.01)
 tT <- topTable(fit2, adjust="fdr", sort.by="B", number=1400)

 tT <- subset(tT, select=c("ID","adj.P.Val","P.Value","t","B","logFC","Gene.symbol","Gene.title"))
 new1<-write.table(tT, file=stdout(), row.names=F, sep="\t")
 write.csv(tT,file = "dataa2.csv")
t-test limma

0 answers

No answers yet.

Log in to answer this question.