Question: Example on constructing AffyBatch object
0
gravatar for Peng Yu
8.7 years ago by
Peng Yu940
Peng Yu940 wrote:
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
biobase affydata • 1.4k views
ADD COMMENTlink modified 8.7 years ago by James W. MacDonald49k • written 8.7 years ago by Peng Yu940
Answer: Example on constructing AffyBatch object
0
gravatar for James W. MacDonald
8.7 years ago by
United States
James W. MacDonald49k wrote:
Look at the code for read.affybatch. Best, Jim On 7/1/2010 12:29 PM, Peng Yu wrote: > 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) > > > -- James W. MacDonald, M.S. Biostatistician Douglas Lab University of Michigan Department of Human Genetics 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826 ********************************************************** Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues
ADD COMMENTlink written 8.7 years ago by James W. MacDonald49k
Please log in to add an answer.

Help
Access

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