[BioC] how do I add pheno data after making AffyBatch object

James MacDonald jmacdon at med.umich.edu
Tue Feb 3 21:29:59 MET 2004

Hi Hao,

There are probably better ways to do this, but here is how I have done
it in the past.

tmp <- pData(A)  ## this will give you the existing phenoData object

Now, tmp is a data.frame, and you will most likely want to have
everything you add be a factor. Here is an example using some random cel

>dat <- ReadAffy()
> tmp <- pData(dat)
> tmp
12_13_02_U133A_Mer_Latin_Square_Expt1_R1.CEL       1
12_13_02_U133A_Mer_Latin_Square_Expt1_R2.CEL       2
12_13_02_U133A_Mer_Latin_Square_Expt1_R3.CEL       3
12_13_02_U133A_Mer_Latin_Square_Expt10_R1.CEL      4
12_13_02_U133A_Mer_Latin_Square_Expt10_R2.CEL      5
12_13_02_U133A_Mer_Latin_Square_Expt10_R3.CEL      6
12_13_02_U133A_Mer_Latin_Square_Expt11_R1.CEL      7
12_13_02_U133A_Mer_Latin_Square_Expt11_R2.CEL      8
12_13_02_U133A_Mer_Latin_Square_Expt11_R3.CEL      9
12_13_02_U133A_Mer_Latin_Square_Expt12_R1.CEL     10

This is what you get if you never put in any phenoData in the first
place. Now, if I used two different scanners, I could add a column like

>tmp <- cbind(tmp, scanner = factor(c(1,1,1,1,1,2,2,2,2,2)))
> tmp
                                              sample scanner
12_13_02_U133A_Mer_Latin_Square_Expt1_R1.CEL       1       1
12_13_02_U133A_Mer_Latin_Square_Expt1_R2.CEL       2       1
12_13_02_U133A_Mer_Latin_Square_Expt1_R3.CEL       3       1
12_13_02_U133A_Mer_Latin_Square_Expt10_R1.CEL      4       1
12_13_02_U133A_Mer_Latin_Square_Expt10_R2.CEL      5       1
12_13_02_U133A_Mer_Latin_Square_Expt10_R3.CEL      6       2
12_13_02_U133A_Mer_Latin_Square_Expt11_R1.CEL      7       2
12_13_02_U133A_Mer_Latin_Square_Expt11_R2.CEL      8       2
12_13_02_U133A_Mer_Latin_Square_Expt11_R3.CEL      9       2
12_13_02_U133A_Mer_Latin_Square_Expt12_R1.CEL     10       2

Once you have the phenoData set up the way you like, you can put it
back like this:

pData(A) <- tmp

As for a good tutorial, you might look at End2End by Rafael Irizarry
and Robert Gentleman. It gives a step-by-step tutorial that is quite




James W. MacDonald
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109

>>> Hao Liu <liuha at umdnj.edu> 02/03/04 12:39PM >>>
Dear All:

I used AffyBatch(), and made an AffyBatch object named A by getting
the CEL files in the directory (which has about 150 cel files).
However, I
wonder if I can add pheno object to this object after its creation.

And, if possible, where can I get some good tutorials on using Affy?
materials I found are hard to understand, I need some step by step or
examples. I am new in R and Bioconductor, please help.


Hao Liu, Ph. D

Bioconductor mailing list
Bioconductor at stat.math.ethz.ch 

More information about the Bioconductor mailing list