Hello everyone, I've been having the same question for a while now. I'm also conducting my own analysis of differential expression on a microarray dataset in R. However, the data is different from the results obtained using GEO2R. Here's my line of code:
my_id <- "GSE80178"
gse <- getGEO(my_id, GSEMatrix = TRUE, AnnotGPL = TRUE)
length(gse)
gse <- gse[[1]]
gse
sampleInfo
sample treat
GSM2114231 tissue: foot ulcer diabetic
GSM2114232 tissue: foot ulcer diabetic
GSM2114233 tissue: foot ulcer diabetic
GSM2114234 tissue: foot ulcer diabetic
GSM2114235 tissue: foot ulcer diabetic
GSM2114236 tissue: foot ulcer diabetic
GSM2114240 tissue: foot skin non-diabetic
GSM2114241 tissue: foot skin non-diabetic
GSM2114242 tissue: foot skin non-diabetic
design <- model.matrix(~0 + sampleInfo$sample)
design
colnames(design) <- c("NDM", "DFU")
design
NDM DFU
0 1
0 1
0 1
0 1
0 1
0 1
1 0
1 0
1 0
cutoff <- median(exprs(gse[,-c(7:9)]))
is_expressed <- exprs(gse[,-c(7:9)]) > cutoff
keep <- rowSums(is_expressed) > 2
gse <- gse[keep, ]
fit <- lmFit(exprs(gse[,-c(7:9)]), design)
contrasts <- makeContrasts(DFU - NDM,
levels=design)
fit2 <- contrasts.fit(fit, contrasts)
fit2 <- eBayes(fit2)
top_table <- topTable(fit2, n = Inf, coef = 1)
logFC AveExpr t P.Value adj.P.Val B
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
17121740 4.332877 12.256391 26.39945 1.618705e-10 2.677875e-06 13.55329
16671139 6.357127 10.556574 25.89515 1.954927e-10 2.677875e-06 13.42962
16693409 6.747750 9.681567 25.01266 2.743913e-10 2.677875e-06 13.20273
16693406 5.705290 9.171220 24.38503 3.517157e-10 2.677875e-06 13.03277
16990767 7.658577 9.380941 22.34467 8.246736e-10 5.023087e-06 12.42553
16848403 -5.384042 6.735076 -19.72763 2.765824e-09 1.403886e-05 11.50286
To find the anotaçõehugene20sttranscriptcluster.db, I encountered many values with expression among the samples, but GeneName, Symbol, or Entrez information was not available. After filtering out these NA values and applying a cutoff of adjust < 0.05 and LogFC > 1 or LogFC < -1, I obtained a list with 3,315 downregulated genes, 883 upregulated genes, and 16,941 showing no significance.
However, it seems that these values do not align with the analyses conducted by GEO2R. Can I trust my results based on the analysis I performed?
GEO2R Script:
# Differential expression analysis with limma
library(GEOquery)
library(limma)
library(umap)
# load series and platform data from GEO
gset <- getGEO("GSE80178", GSEMatrix =TRUE, AnnotGPL=FALSE)
if (length(gset) > 1) idx <- grep("GPL16686", 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 <- "111111XXX000"
sml <- strsplit(gsms, split="")[[1]]
# filter out excluded samples (marked as "X")
sel <- which(sml != "X")
sml <- sml[sel]
gset <- gset[ ,sel]
# 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) }
# assign samples to groups and set up design matrix
gs <- factor(sml)
groups <- make.names(c("control","dfu"))
levels(gs) <- groups
gset$group <- gs
design <- model.matrix(~group + 0, gset)
colnames(design) <- levels(gs)
gset <- gset[complete.cases(exprs(gset)), ] # skip missing values
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=250)
tT <- subset(tT, select=c("ID","adj.P.Val","P.Value","t","B","logFC","RANGE_STRAND","RANGE_START","RANGE_END","GB_ACC","SPOT_ID","RANGE_GB"))
write.table(tT, file=stdout(), row.names=F, sep="\t")