memorize: Create a new NChannelSet instance by selecting specific...

Description Usage Arguments Value Note Author(s) See Also Examples

Description

This function converts BigMatrix objects stored in the assayData slot of NChannelSets into standard matrices, loading them fully into memory. Standard in-memory objects are returned unchanged. Requires bigmemoryExtras package to process BigMatrix objects.

Usage

1
memorize(object, names, ...)

Arguments

object

An NChannelSet object.

names

Character vector of named channels (default: all channels are returned).

...

Additional arguments.

Value

Instance of the same class as 'object'.

Note

This function can be applied to any class inheriting from the virtual eSet class. For non NChannelSets, meta data may not be transferred correctly.

Author(s)

Thomas Sandmann

See Also

eSet memorize selectChannels

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
if( suppressWarnings(require("bigmemoryExtras", 
     quietly=TRUE, character.only=TRUE))){
## load ExpressionSet
data("sample.ExpressionSet") ## from Biobase
sample.ExpressionSet ## two assayDataElements: exprs, se

## 'exprs' data matrix
class( assayDataElement( sample.ExpressionSet, "exprs" ) )

## convert assayData to BigMatrix objects
storage.file <- tempfile() ## create path & basemane for BigMatrices
storage.file

on.disk <- eSetOnDisk( sample.ExpressionSet, storage.file )
on.disk ## ExpressionSet
dir(dirname( storage.file )) ## created 3 files per channel

class( assayDataElement( on.disk, "exprs" ) ) ## BigMatrix object

## BigMatrix objects are loaded only upon subsetting
assayDataElement( on.disk, "exprs") ## retrieves BigMatrix, NOT matrix
head( assayDataElement( on.disk, "exprs")[,] ) ## retrieves matrix

## convert back to standard in-memory ExpressionSet
in.memory <- memorize( on.disk ) ## all channels
class( assayDataElement( in.memory, "exprs" ) ) ## matrix object
assayDataElementNames( in.memory )

in.memory <- memorize( on.disk, names="exprs" ) ## channel "exprs" only
assayDataElementNames( in.memory )

## remove tempfiles generated for this example
unlink(paste(storage.file,"*", sep=""))  
}

gCMAP documentation built on April 29, 2020, 3:54 a.m.