This is a test version of Biostars. For the public version, visit https://www.biostars.org.
variance stabilization and normalization

Hi,

I am going to perform variance stabilization on my data sets then I did like below

library(affy)
library(vsn)

celFiles <- list.celfiles()
affyraw=ReadAffy(filenames = celFiles)
fit = vsn2(affyraw)
vsn2: 506944 x 8 matrix (1 stratum). Please use 'meanSdPlot' to verify the fit.

nkid = predict(fit, newdata=affyraw)
vsnrma(nkid)
vsn2: 506944 x 8 matrix (1 stratum). Please use 'meanSdPlot' to verify the fit.
Creating a generic function for ‘nchar’ from package ‘base’ in package ‘S4Vectors’

Calculating Expression
ExpressionSet (storageMode: lockedEnvironment)
assayData: 22810 features, 8 samples 
  element names: exprs 
protocolData
  sampleNames: Col-0 24h primed.CEL.CEL Col-0 24h unprimed.CEL.CEL ... Col-0 8h unprimed.CEL.CEL (8 total)
  varLabels: ScanDate
  varMetadata: labelDescription
phenoData
  sampleNames: Col-0 24h primed.CEL.CEL Col-0 24h unprimed.CEL.CEL ... Col-0 8h unprimed.CEL.CEL (8 total)
  varLabels: sample
  varMetadata: labelDescription
featureData: none
experimentData: use 'experimentData(object)'
Annotation: ath1121501 

a <- vsnrma(nkid)
vsn2: 506944 x 8 matrix (1 stratum). Please use 'meanSdPlot' to verify the fit.
Calculating Expression

celFiles <- list.celfiles()
affyraw=ReadAffy(filenames = celFiles)
eset <- justvsn(celFiles)
Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘vsn2’ for signature ‘"character"’
justvsn(a)
vsn2: 22810 x 8 matrix (1 stratum). Please use 'meanSdPlot' to verify the fit.
ExpressionSet (storageMode: lockedEnvironment)
assayData: 22810 features, 8 samples 
  element names: exprs 
protocolData
  sampleNames: Col-0 24h primed.CEL.CEL Col-0 24h unprimed.CEL.CEL ... Col-0 8h unprimed.CEL.CEL (8 total)
  varLabels: ScanDate
  varMetadata: labelDescription
phenoData
  sampleNames: Col-0 24h primed.CEL.CEL Col-0 24h unprimed.CEL.CEL ... Col-0 8h unprimed.CEL.CEL (8 total)
  varLabels: sample
  varMetadata: labelDescription
featureData: none
experimentData: use 'experimentData(object)'
Annotation: ath1121501 

a <justvsn(a)
vsn2: 22810 x 8 matrix (1 stratum). Please use 'meanSdPlot' to verify the fit.
Error in a < justvsn(a) : 
  comparison (3) is possible only for atomic and list types

a <- justvsn(a)
vsn2: 22810 x 8 matrix (1 stratum). Please use 'meanSdPlot' to verify the fit.
r

4 answers

bg.correct should stand for background correct = FALSE

You read your CEL files with the ReadAffy function, and immediately apply the normalization without substracting the background. I don't think this is correct

The other attributes apply different methods, including the normalize.method where you are indicating the vsn method for normalization.

I don't know the expresso function, but it seems that it includes the possibility of doing a background substraction. Read the vignette with a ?expresso and it will clarify to you what it can do

may you please help me to write the correct?

You need to investigate the expreso function since bg.correct can mean either of two things. That a correction has not been done, therefore it must be done, or that a background correction is optative

Beyond that the code included in the vignette is the one you must follow

After loading the affy and vsn libraries..

Into R run

?expresso

You can read information about the function. In this case, this is written

bg.correct
a boolean to express whether background correction is wanted or not.

In your case, you need to run a bg.correct= TRUE

thank you so much Antonio

Hi,

I collected this code finally

# performing variance stabilization and normalization on microarray data sets
# loading required libraries
library(affy)
library(vsn)
# listing the cel files
celFiles <- list.celfiles()
# assigning the cel files to affyraw variable
affyraw=ReadAffy(filenames = celFiles)
# performing vsn normalization
vsn.data <- expresso(affyraw, normalize.method="vsn", bg.correct=F, pmcorrect.method="pmonly", summary.method="medianpolish")
# examining the normalization
boxplot(affyraw,col="red")
plot(exprs(affyraw)[,1:2], log = "xy", pch=".",
     main="all")
# writing the result
write.table(vsn.data, file = "vsn.txt", dec = ".", sep = "\t", quote = FALSE)

thank you Fereshteh, you are amazing!!!

Antonio,

Actually I did some sporadic code from internet I can't get what they mean, even finally I could not get AGI IDs and the result is with prob IDs

In brief I don't know

vsn.data <- expresso(affyraw, normalize.method="vsn", bg.correct=F, pmcorrect.method="pmonly", summary.method="medianpolish")

what means....

Log in to answer this question.