Base R6 class to handle a dataset that can queue execute operations on it

This is an abstract class. See DelayedDatasetRAM and DelayedDatasetDisk for specific implementations.

This class is not exported, but if you want to use it reach us at https://github.com/sipss/GCIMS/issues/ and we will export it.

Active bindings

sampleNames

The character vector with unique sample names (virtual method)

Methods


Method realize()

Execute all the queued operations

Usage

DelayedDatasetBase$realize(..., dataset)

Arguments

...

Arguments used by children classes, passed on to realize_impl(...)

dataset

The dataset where extracted results will be aggregated on


Method new()

Create a new object, initialize the slots

Usage

DelayedDatasetBase$new(sample_class = NULL)

Arguments

sample_class

The class of the samples in the dataset, used just to validate the contract between the delayed actions and the samples. If NULL action return values are not checked


Method registerOptimization()

The list of queued operations are usually processed sequentially over each sample when the delayed dataset is realized.

In some cases we want to operate on the list of queued operations before processing them, for instance to remove redundant operations or change their order, to improve performance.

Write a function that takes and returns a list of queued operations when used as follows:

queued_ops <- your_function(queued_ops)

And call obj$registerOptimization(your_function) to register it, so every time obj$realize() is called, the list of queued operations will be passed to your function and optimized accordingly.

You can register as many optimizations as you like.

Usage

DelayedDatasetBase$registerOptimization(optimization)

Arguments

optimization

A function that takes a list of queued operations and returns a more optimized version of it.

Returns

The object


Method appendDelayedOp()

Queues an operation to the dataset so it will run afterwards

Usage

DelayedDatasetBase$appendDelayedOp(operation)

Arguments

operation

A DelayedOperation object

Returns

The modified dataset object


Method hasDelayedOps()

Find out if the dataset has pending operations

Usage

DelayedDatasetBase$hasDelayedOps()

Returns

Returns TRUE if the dataset has pending operations, FALSE otherwise


Method getSample()

Get a sample from the dataset

Usage

DelayedDatasetBase$getSample(sample, dataset)

Arguments

sample

Either an integer (sample index) or a string (sample name)

dataset

The dataset object so we can realize it if needed

Returns

The sample object


Method history_as_list()

Get a list that describes the already executed operations

Usage

DelayedDatasetBase$history_as_list()

Returns

A list, with the operations


Method pending_as_list()

Get a list that describes the queued operations

Usage

DelayedDatasetBase$pending_as_list()

Returns

A list, with the operations


Method clone()

The objects of this class are cloneable with this method.

Usage

DelayedDatasetBase$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.