Question: Header Row In Write.Exprs Is File Names Instead Of Designated Sample Names
gravatar for Gotgenes
10.0 years ago by
Bethesda, MD, USA
Gotgenes460 wrote:

I am trying to obtain normalized expression values for Affymetrix microarray data that we have using bioconductor. The script I have is mostly there, however, I am irked that the row header describes the samples by the file names of the CEL files, rather than the sample names designated in Targets.txt.

Here is an excerpt of my Targets.txt file:

# file for use by limma and affylmGUI. the targets are per-condition and per-time-point.        
Name    FileName    Target
feh.rep1    FH1.CEL    feh
feh.rep2    FH2.CEL    feh
feh.rep3    FH3.CEL    feh

Here is the R script:

# phenotype data
pd <- read.AnnotatedDataFrame("Targets.txt", header=T) <- ReadAffy(filenames=pd$FileName, phenoData=pd)
# gene expression data, normalized by GCRMA
eset <- gcrma(
write.exprs(eset, "cs_hm_feh-expression-gcrma-2011-01-12.tsv", sep="\t", row)

I have tried using <- ReadAffy(filenames=pd$FileName, phenoData=pd, sampleNames=row.names(pd))

however, that was unsuccessful. Further investigation shows that row.names isn't actually getting anything at all

> row.names(pd)

which I find perplexing, given that the object shows it has row names, which are exactly what I want (and expected) as my sample labels in the final CSV table:

> pd
An object of class "AnnotatedDataFrame"
  rowNames: feh.rep1, feh.rep2, ..., cs.8d.rep3  (27 total)
  varLabels and varMetadata description:

Any help is appreciated, as I wield R fairly ignorantly and can not figure my way through this one seemingly simple task.

R bioconductor affymetrix • 3.9k views
ADD COMMENTlink written 10.0 years ago by Gotgenes460
gravatar for Brad Chapman
10.0 years ago by
Brad Chapman9.5k
Boston, MA
Brad Chapman9.5k wrote:

Is this what you are looking for?

> sampleNames(pd)
[1] "feh.rep1" "feh.rep2" "feh.rep3"

I'm not an affy expert at all; a good R trick is to look up the documentation on the object with:

> ? AnnotatedDataFrame
      ‘sampleNames(<AnnotatedDataFrame>)<-<ANY>’: Set and retrieve
      the sample names in ‘AnnotatedDataFrame’
ADD COMMENTlink modified 16 months ago by _r_am32k • written 10.0 years ago by Brad Chapman9.5k

Thanks, Brad! Excellent suggestion reading the docs. I was reading the wrong ones (for ReadAffy and read.AnnotatedDataFrame). Worked perfectly using sampleNames=sampleNames(pd). I'm still surprised I had to manually specify this, but I probably made the wrong assumptions and/or abused the method calls.

ADD REPLYlink written 10.0 years ago by Gotgenes460

Chris, agreed that it seems like it should work without manually specifying it; that's what made me so unsure I was answering your question correctly. Glad that it worked.

ADD REPLYlink written 10.0 years ago by Brad Chapman9.5k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2214 users visited in the last hour