RleDataFrame-class {genoset} | R Documentation

## Class `"RleDataFrame"`

### Description

The `RleDataFrame` class serves to hold a collection of Run Length Encoded vectors (Rle objects) of the same length. For example, it could be used to hold information along the genome for a number of samples, such as sequencing coverage, DNA copy number, or GC content. This class inherits from both DataFrame and SimpleRleList (one of the AtomicVector types). This means that all of the usual subsetting and applying functions will work. Also, the AtomicList functions, like `mean` and `sum`, that automatically apply over the list elements will work. The scalar mathematical `AtomicList` methods can make this class behave much like a matrix (see Examples).

New objects can be created with the `RleDataFrame` constructor: `RleDataFrame(..., row.names=NULL)`, where `...` can be a list of Rle objects, or one or more individual Rle objects.

### Use in Biobase eSet objects

The `genoset` class defines an `annotatedDataFrameFrom` method for `DataFrame`, which makes it possible to include `DataFrames` as `assayData` elements. The column names for `DataFrame` cannot be `NULL`, which makes it impossible to use them as assays in `SummarizedExperiment` at this time.

### Row and Column Summaries

These objects will sometimes be in place of a matrix, as in the eSet example above. It is convenient to have some of the summarization methods for matrices. Each of these methods takes an RleDataFrame and returns a single Rle. The time required is similar to that required for a matrix. For an RleDataFrame x,

  `rowSums`:

Sum across 'rows'.

  `rowMeans`:

Means across 'rows'.

  `colSums`:

Sum each Rle. This is just the `sum` method for SimpleRleList.

  `colSums`:

Mean of each Rle. This is just the `mean` method for SimpleRleList.

### Slots

`rownames`:

  Object of class `"character_OR_NULL"` Names to describe each row of the DataFrame. These may end up taking more space than your collection of Rle objects, so consider leaving this NULL.

`nrows`:

  Object of class `"integer"` Number of rows.

`elementType`:

  Object of class `"character"` Notes that elements of the internal list are Rle objects.

`elementMetadata`:

  Object of class `"DataTable_OR_NULL"` Metadata on the elements, see DataFrame.

`metadata`:

  Object of class `"list"` Metadata on the whole object, see DataFrame.

`listData`:

  Object of class `"list"` Base list containing the Rle objects.

### Extends

Class `"SimpleRleList"`, directly. Class `"DataFrame"`, directly.

### Methods

as.matrix

  `signature(x = "RleDataFrame")`: Convert to matrix.

coerce

  `signature(x = "RleDataFrame")`: Convert to other classes.

colMeans

  `signature(x = "RleDataFrame")`: Mean of each column.

colSums

  `signature(x = "RleDataFrame")`: Sum of each column.

rowMeans

  `signature(x = "RleDataFrame")`: Mean of each 'row'.

rowSums

  `signature(x = "RleDataFrame")`: Sum of each 'row'.

show

  `signature(object = "RleDataFrame")`: Short and pretty description of an object of this type.

### Author(s)

Peter M. Haverty, design suggestion from Michael Lawrence.

### See Also

`DataFrame` `AtomicList` `Rle` `RleList` `rowMeans` `colMeans` `rowSums` `colSums` `view-summarization-methods`

### Examples

    showClass("RleDataFrame")

    ## Constructors
    df = new("RleDataFrame", listData=list(A=Rle(c(NA, 2:3, NA, 5), rep(2,
    5)), B=Rle(c(6:7, NA, 8:10),c(3,2,1,2,1,1))), nrows=10L)

    df2 = RleDataFrame(list(A=Rle(c(NA, 2:3, NA, 5), rep(2, 5)),
    B=Rle(c(6:7, NA, 8:10),c(3,2,1,2,1,1))))

    df3 = RleDataFrame(A=Rle(c(NA, 2:3, NA, 5), rep(2, 5)), B=Rle(c(6:7,
    NA, 8:10),c(3,2,1,2,1,1)))

    ## AtomicList Methods
    runValue(df)
    runLength(df)
    ranges(df)
    mean(df)
    sum(df)
    df + 5
    log2(df) - 1

    ## Row and Column Summaries
    rowSums(df)
    colSums(df)
    rowMeans(df)
    colMeans(df)

    ## Coercion
    as(df, "matrix")
    as(df, "list")
    as(df, "RleList")
    as(df, "DataFrame")
    as(df, "data.frame")

[Package genoset version 1.38.0 Index]