[Bioc-devel] Passing variable argument list to ExpressionSet

Martin Morgan mtmorgan at fhcrc.org
Thu Feb 1 17:57:51 CET 2007


Hi Sean --

Two things.

ExpressionSet expects an element named 'exprs', so if this doesn't fit
the description of your data then you'll need to look
elsewhere. Perhaps not too far, though, as "MultiSet" might do the
trick. MultiSet will give you many features of ExpressionSet (e.g.,
subsetting, sampleNames, featureNames, etc; see the help page for
MultiSet or use showMethods(classes="MultiSet")).

The assayData slot of ExpressionSet (or MultiSet) can contain lists or
environemnts, with the requirement that all elements have the same
dimensions. So

> library(Biobase)
Loading required package: tools

Welcome to Bioconductor

    Vignettes contain introductory material. To view, type
    'openVignette()' or start with 'help(Biobase)'. For details
    on reading vignettes, see the openVignette help page.

> x <- list()
> x[["cy3"]] <- matrix(rnorm(1000), nc=2)
> x[["cy5"]] <- matrix(rnorm(1000), nc=2)
> m <- new("MultiSet", assayData=x)
> m
MultiSet (storageMode: list)
assayData: 500 features, 2 samples 
  element names: cy3, cy5 
phenoData
  sampleNames: 1, 2
  varLabels and varMetadata: none
featureData
  featureNames: 1, 2, ..., 500 (500 total)
  varLabels and varMetadata: none
experimentData: use 'experimentData(object)'
Annotation character(0)

creates a new MultiSet based on your list (note 'storageMode: list' in
the output).

Probably I should stop now. But to be complete, you could have created
a MultiSet as

> new("MultiSet", cy3=matrix(rnorm(1000), nc=2), cy5=matrix(rnorm(1000), nc=2))
MultiSet (storageMode: lockedEnvironment)
assayData: 500 features, 2 samples 
  element names: cy3, cy5 
phenoData
  sampleNames: 1, 2
  varLabels and varMetadata: none
featureData
  featureNames: 1, 2, ..., 500 (500 total)
  varLabels and varMetadata: none
experimentData: use 'experimentData(object)'
Annotation character(0)

or converted your 'list'-based MultiSet to a 'lockedEnvironment'
MultiSet with storageMode(m) <- "lockedEnvironment" (a
lockedEnvironment is meant to provide beneficial storage efficiency /
copying consequences, but this might often not be important).

You could also create an envionment and stored your elements in
it

> x <- new.env()
> x[["cy3"]] <- matrix(rnorm(1000), nc=2)
> x[["cy5"]] <- matrix(rnorm(1000), nc=2)
> new("MultiSet", assayData=x)
MultiSet (storageMode: environment)
assayData: 500 features, 2 samples 
  element names: cy3, cy5 
phenoData
  sampleNames: 1, 2
  varLabels and varMetadata: none
featureData
  featureNames: 1, 2, ..., 500 (500 total)
  varLabels and varMetadata: none
experimentData: use 'experimentData(object)'
Annotation character(0)

Note that this could be VERY SURPRISING, as the data in an
'environment' is not copied the way a list is -- changing a value in
cy3 of your MultiSet will change the value in x as well, which does
not happen with lists.

Martin

Sean Davis <sdavis2 at mail.nih.gov> writes:

> This is a simple question, but I haven't found an answer.  I am reading data 
> with varying types of data that I would like to store in the assayData slot 
> of an ExpressionSet-like object.  So, I would like to go from a named list of 
> matrices to a new assayData object.  A concrete example:
>
> x <- list()
> x[['cy3']] <- matrix(rnorm(1000),nc=2)
> x[['cy5']] <- matrix(rnorm(1000),nc=2)
> ....
>
> So, can I construct a call using assayDataNew() or ExpressionSet() that uses 
> the names and values in the variable x to construct a bunch of matrices in 
> the assayData slot?  Or should I just write my own assayDataNew() function 
> (downside being keeping up with changes in API and/or implementation of 
> assayData)?
>
> Thanks,
> Sean
>
> _______________________________________________
> Bioc-devel at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

-- 
Martin Morgan
Bioconductor / Computational Biology
http://bioconductor.org



More information about the Bioc-devel mailing list