aggregate {RNAmodR} | R Documentation

## Aggregate data per positions

### Description

The `aggregate` function is defined for each `SequenceData` object and can be used directly on a `SequenceData` object or indirectly via a `Modifier` object.

For the letter the call is redirect to the `SequenceData` object, the result summarized as defined for the individual `Modifier` class and stored in the `aggregate` slot of the `Modifier` object. The data is then used for subsequent tasks, such as search for modifications and visualization of the results.

The summarization is implemented in the `aggregateData` for each type of `Modifier` class. The stored data from the `aggregate` slot can be retrieved using the `getAggregateData` function.

Whether the aggrgeated data is already present in the `aggregate` slot can be checked using the `hasAggregateData` function.

For `SequenceDataSet`, `SequenceDataList` and `ModfierSet` classes wrapper of the `aggregate` function exist as well.

### Usage

    aggregate(x, ...)

    aggregateData(x, ...)

    getAggregateData(x)

    hasAggregateData(x)

    ## S4 method for signature 'SequenceData'
    aggregate(x, condition = c())

    ## S4 method for signature 'SequenceData'
    aggregateData(x, condition)

    ## S4 method for signature 'SequenceDataSet'
    aggregate(x, condition = "Treated")

    ## S4 method for signature 'SequenceDataList'
    aggregate(x, condition = "Treated")

    ## S4 method for signature 'Modifier'
    aggregate(x, force = FALSE)

    ## S4 method for signature 'Modifier'
    aggregateData(x)

    ## S4 method for signature 'Modifier'
    getAggregateData(x)

    ## S4 method for signature 'Modifier'
    hasAggregateData(x)

    ## S4 method for signature 'ModifierSet'
    aggregate(x, force = FALSE)

### Arguments

`x` | a `SequenceData`, `SequenceDataSet`, `SequenceDataList`, `Modifier` or `ModfierSet` object.
`...` | additional arguments
`condition` | character value, which selects, for which condition the data should be aggregated. One of the following values: `Both`, `Control`, `Treated`
`force` | whether to recreate the aggregated data, if it is already stored inside the `Modifier` object.

### Value

- `aggregate`: for `SequenceData` object the aggregated data is returned as a `SplitDataFrameList` with an element per transcript, whereas for a `Modifier` the modified input object is returned, containing the aggregated data, which can be accessed using `getAggregateData`.

- `getAggregateData`: only for `Modifier`: a `SplitDataFrameList` with an element per transcript is returned. If the aggregated data is not stored in the object, it is generated on the fly, but does not persist.

- `hasAggregateData`: TRUE or FALSE. Does the `Modifier` object already contain aggregated data?

If 'x' is a

- `SequenceData` a `SplitDataFrameList` with elments per transcript.

- `SequenceDataSet` or `SequenceDataList` a `SimpleList` with `SplitDataFrameList` as elements.

- `Modifier` or `ModifierSet` an updated `Modifier` object. The data can be accessed by using the `aggregateData` function.

### Examples

    data(e5sd,package="RNAmodR")
    data(msi,package="RNAmodR")
    # modify() triggers the search for modifications in the data contained in
    # the Modifier or ModifierSet object
    sdfl <- aggregate(e5sd)
    mi <- aggregate(msi[[1]])

[Package RNAmodR version 1.0.2 Index]