This is a test version of Biostars. For the public version, visit https://www.biostars.org.
GEO2R not performing log2 transform??

Hello,

I'm playing around with the R script that GEO2R outputs. Below is a snippet of code.

When I export the gset before and after the log2 transform, I get the exact same values. Is GEO2R actually performing the transform?

library(Biobase)
library(GEOquery)
library(limma)

# load series and platform data from GEO

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

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

# group names for all samples
gsms <- "0X1X1X0X1X0X01XX0X01XX1X0XX1X1"
sml <- c()
for (i in 1:nchar(gsms)) { sml[i] <- substr(gsms,i,i) }

# eliminate samples marked as "X"
sel <- which(sml != "X")
sml <- sml[sel]
gset <- gset[ ,sel]

After the above is where I do the first csv export.

# log2 transform
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) ||
          (qx[2] > 0 && qx[2] < 1 && qx[4] > 1 && qx[4] < 2)
if (LogC) { ex[which(ex <= 0)] <- NaN
  exprs(gset) <- log2(ex) }

Here is where I do the second csv export and I see the values are identical.

Any input is highly appreciated.

geo geo2r microarray

1 answer

LogC is a boolean variable used to check if the quantiles had previously been normalized or transformed.

the if statement:

if (LogC) { ex[which(ex <= 0)] <- NaN
  exprs(gset) <- log2(ex) }

checks to see if the data is already normalized/transformed. If the data isn't pre-normailzed/transformed then log2() will be used (i.e. LogC is equal to TRUE).

if LogC is equal to FALSE, then the data you downloaded from GEO had already been transformed/normalized and doesn't need the log2() function. Therefore log2 isn't performed.

Thank you so much for the explanation

Log in to answer this question.