[BioC] Example on constructing AffyBatch object

Peng Yu pengyu.ut at gmail.com
Thu Jul 1 18:29:08 CEST 2010


Hi,

I see that I can use data() to load AffyBatch object from affydata, or
I could load cel files to get AffyBatch. But I'd rather construct an
example AffyBatch object using fake data so that I can understand how
AffyBatch works.

I adapted the example from Biobase (note that I don't load any data
from a file) which help me understand exactly the member functions and
the object construction. But I don't find such a tutorial for
AffyBatch. If it is available somewhere, would you please point it me.
If it is not, would give some examples so that I can understand how
AffyBatch is constructed and how the new member functions in AffyBatch
(as AffyBatch is inherent from ExpressionSet) is related to the
construction?

library('Biobase')
nFeatures=10
nSamples=4
exprs=matrix(runif(nFeatures*nSamples), nrow=nFeatures, ncol=nSamples)
colnames(exprs)=LETTERS[1:nSamples]
rownames(exprs)=letters[1:nFeatures]

set.seed(0)

varlabels=c('gender', 'type')
pData=data.frame(
    sample(c('Female', 'Male'), nSamples, replace=T)
    , sample(c('Control', 'Case'), nSamples, replace=T)
    )
names(pData)=varlabels
row.names(pData)=LETTERS[1:nSamples]

metadata=data.frame(
    labelDescription=c('Patient gender', 'Case/control status')
    , row.names=varlabels
    )

pData
metadata

phenoData=new('AnnotatedDataFrame', data=pData, varMetadata=metadata)
str(phenoData)

experimentData=new(
    'MIAME',
    name='Pierre Fermat',
    lab='Francis Galton Lab',
    contact='pfermat at lab.not.exist',
    title='Smoking-Cancer Experiment',
    abstract='An example ExpressionSet',
    url='www.lab.not.exist',
    other=list(notes='Created from text files')
    )

annotation='hgu95av2'

eset=new('ExpressionSet', exprs=exprs, phenoData=phenoData,
experimentData=experimentData, annotation=annotation)

exprs(eset)
featureNames(eset)
sampleNames(eset)
phenoData(eset)
experimentData(eset)



-- 
Regards,
Peng



More information about the Bioconductor mailing list