Question: Convert Expression Set into a Matrix or Data Frame
gravatar for hshabbeer.09
3.9 years ago by
hshabbeer.090 wrote:

Hi all,

I have an expression set which contains the following:

## assayData: 15905 features, 276 samples 
##   element names: exprs 
## protocolData: none
## phenoData
##   sampleNames: MNC5 MNC6 ... P0892 (276 total)
##   varLabels: HIPO-ID PID ... IC50batch (114 total)
##   varMetadata: labelDescription
## featureData
##   featureNames: D_001_1 D_001_2 ... ENSG00000273488 (15905 total)
##   fvarLabels: name type id subtype
##   fvarMetadata: labelDescription

Now i know how to access various elements i.e, RNA seq or DNA methylation data but its complicated and being a new user it becomes a tad bit difficult to use for further analysis etc. To make it easier i would like to convert it in a matrix or a data frame which can contain all the relevant data. For example, rows would be patient ID and columns can be other features like drugs and their dosages or methylation probe results or RNA seq results etc. 

I know exprs gives the main data i.e, some survival data in this case, and pData or fData for phenotypic or other features. But what i want to know is whether there is a method i can combine all of them into one simple matrix or data frame? That would make analysis easier. So, is that possible?



microarray biobase affy R • 4.0k views
ADD COMMENTlink modified 3.9 years ago by Diego Diez750 • written 3.9 years ago by hshabbeer.090

I don't fully understand your problem, but you can convert your expression set to a data frame  using the function:"your expression set")--where the rows then would be the samples, and in the columns there would be all your features plus your phenoData variables.

Hope that helps,


ADD REPLYlink written 3.9 years ago by svlachavas740
Answer: Convert Expression Set into a Matrix or Data Frame
gravatar for Diego Diez
3.9 years ago by
Diego Diez750
Diego Diez750 wrote:

A possibility is as below. Note that this will create a data.frame with a lot of columns (one for each probe + the additional ones for each column in the phenoData object)

eset # ExpressionSet
m <- exprs(eset) # matrix of intensities
pdata <- pData(eset) # data.frame of phenotypic information.

d <- cbind(pdata, t(m)) # data.frame with row being samples and columns variables (including phenotypic and intensity info for each probe)
> data(sample.ExpressionSet)
> sample.ExpressionSet
ExpressionSet (storageMode: lockedEnvironment)
assayData: 500 features, 26 samples 
  element names: exprs, se.exprs 
protocolData: none
  sampleNames: A B ... Z (26 total)
  varLabels: sex type score
  varMetadata: labelDescription
featureData: none
experimentData: use 'experimentData(object)'
Annotation: hgu95av2 

> m <- exprs(sample.ExpressionSet)
> pdata <- pData(sample.ExpressionSet)
> d <- cbind(pdata, t(m))
> d[1:5,1:5]
     sex    type score AFFX-MurIL2_at AFFX-MurIL10_at
A Female Control  0.75       192.7420         97.1370
B   Male    Case  0.40        85.7533        126.1960
C   Male Control  0.73       176.7570         77.9216
D   Male    Case  0.42       135.5750         93.3713
E Female    Case  0.93        64.4939         24.3986

ADD COMMENTlink modified 3.9 years ago • written 3.9 years ago by Diego Diez750
Please log in to add an answer.


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