LongTable-class: LongTable class definition

LongTable-classR Documentation

LongTable class definition

Description

Define a private constructor method to be used to build a LongTable object.

This is used as an alternative to R attributes for storing structural metadata of an S4 objects.

Add or replace an assay in a LongTable by name. Currently this function only works when the assay has all columns in row and column data tables (i.e., when assays is retured withDimnames=TRUE).

Select an assay from within a LongTable object.

Usage

## S4 method for signature 'LongTable'
rowIDs(object, data = FALSE, key = FALSE)

## S4 method for signature 'LongTable'
rowMeta(object, data = FALSE, key = FALSE)

## S4 method for signature 'LongTable'
colIDs(object, data = FALSE, key = FALSE)

## S4 method for signature 'LongTable'
colMeta(object, data = FALSE, key = FALSE)

## S4 method for signature 'LongTable'
idCols(object)

## S4 method for signature 'LongTable'
assayIndex(x)

## S4 method for signature 'LongTable'
assayKeys(x, i)

## S4 method for signature 'LongTable'
assayCols(object, i)

## S4 method for signature 'LongTable,character'
getIntern(object, x)

## S4 method for signature 'LongTable,missing'
getIntern(object, x)

## S4 method for signature 'LongTable'
rowData(x, key = FALSE, use.names = FALSE, ...)

## S4 replacement method for signature 'LongTable'
rowData(x, ...) <- value

## S4 method for signature 'LongTable'
colData(x, key = FALSE, dimnames = FALSE, ...)

## S4 replacement method for signature 'LongTable,ANY'
colData(x, ...) <- value

## S4 method for signature 'LongTable'
assays(
  x,
  withDimnames = TRUE,
  metadata = withDimnames,
  key = !withDimnames,
  ...
)

## S4 replacement method for signature 'LongTable,list'
assays(x, withDimnames = TRUE, ...) <- value

## S4 method for signature 'LongTable,ANY'
assay(
  x,
  i,
  withDimnames = TRUE,
  summarize = withDimnames,
  metadata = !summarize,
  key = !(summarize || withDimnames),
  ...
)

## S4 replacement method for signature 'LongTable,ANY'
assay(x, i) <- value

## S4 method for signature 'LongTable'
assayNames(x)

## S4 method for signature 'LongTable,ANY,ANY'
x[[i]]

## S4 method for signature 'LongTable'
dim(x)

## S4 method for signature 'LongTable'
colnames(x)

## S4 method for signature 'LongTable'
rownames(x)

## S4 method for signature 'LongTable'
dimnames(x)

Arguments

object

LongTable

data

logical Should the colData for the metadata columns be returned instead of the column names? Default is FALSE.

key

logical Should the key columns also be returned? Defaults to !withDimnames. This is incompatible with summarize=TRUE, which will drop the key columns regardless of the value of this argument.

x

The LongTable object to retrieve the dimnames for.

i

character(1) name or integer index of the desired assay.

use.names

logical This parameter is just here to stop matching the positional argument to use.names from the rowData generic. It doesn't do anything at this time and can be ignored.

...

For developer use only! Pass raw=TRUE to return the slot for modification by reference.

value

A data.frame or data.table to update the assay data with. This must at minumum contain the row and column data identifier columns to allow correctly mapping the assay keys. We recommend modifying the results returned by assay(longTable, 'assayName', withDimnames=TRUE). For convenience, both the [[ and $ LongTable accessors return an assay with the dimnames.

withDimnames

logical(1) Should the dimension names be returned joined to the assay. This retrieves both the row and column identifiers and returns them joined to the assay. For

metadata

logical(1) Should all of the metadata also be joined to the assay. This is useful when modifying assays as the resulting list has all the information needed to recreated the LongTable object. Defaults to withDimnames.

summarize

logical(1) If the assays is a summary where some of idCols(x) are not in assayKeys(x, i), then those missing columns are dropped. Defaults to FALSE. When metadata is TRUE, only metadata columns with 1:1 cardinality with the assay keys for i.

`x`

A LongTable or inheriting class.

`i`

An optional valid assay name or index in x.

Value

LongTable object containing the assay data from a treatment response experiment

A character vector of rowData column names if data is FALSE, otherwise a data.table with the data from the rowData id columns.

A character vector of rowData column names if data is FALSE, otherwise a data.table with the data from the rowData metadta columns.

A character vector of colData column names if data is FALSE, otherwise a data.table with the data from the colData id columns.

A character vector of colData column names if data is FALSE, otherwise a data.table with the data from the colData metadta columns.

character A character vector containing the unique rowIDs and colIDs in a LongTable object.

A mutable copy of the "assayIndex" for x

A mutable copy of the "assyKeys" for x

A list of character vectors containing the value column names for each assay if i is missing, otherwise a character vector of value column names for the selected assay.

immutable value of x if length(x) == 1 else named list of values for all symbols in x.

An immutable list.

A data.table containing rowID, row identifiers, and row metadata.

A copy of the LongTable object with the rowData slot updated.

A data.table containing row identifiers and metadata.

A copy of the LongTable object with the colData slot updated.

A list of data.table objects, one per assay in the object.

A copy of the LongTable with the assays modified.

LongTable With updated assays slot.

character Names of the assays contained in the LongTable.

numeric Vector of object dimensions.

character Vector of column names.

character Vector of row names.

list List with two character vectors, one for row and one for column names.

Methods (by generic)

  • rowMeta(LongTable): Get the names of the non-id columns from rowData.

  • colIDs(LongTable): Get the names of the columns in colData required to uniquely identify each row.

  • colMeta(LongTable): Get the names of the non-id columns in the colData data.table.

  • idCols(LongTable): Get the names of all id columns.

  • assayIndex(LongTable): Get the assayIndex item from the objects internal metadata.

  • assayKeys(LongTable): Get the assayKeys item from the objects internal metadata.

  • assayCols(LongTable): Get a list of column names for each assay in the object.

  • getIntern(object = LongTable, x = character): Access structural metadata present within a LongTable object. This is mostly for developmer use.

  • getIntern(object = LongTable, x = missing): Access all structural metadata present within a LongTable object. This is primarily for developmer use.

  • rowData(LongTable): Get the row level annotations for a LongTable object.

  • rowData(LongTable) <- value: Update the row annotations for a LongTable object. Currently requires that all columns in rowIDs(longTable) be present in value.

  • colData(LongTable): Get the column level annotations for a LongTable object.

  • colData(x = LongTable) <- value: Update the colData of a LongTable object. Currently requires that all of the colIDs(longTable) be in the value object.

  • assays(LongTable): Get a list containing all the assays in a LongTable.

  • assays(x = LongTable) <- value: Update the assays in a LongTable object. The rowIDs and colIDs must be present in all assays to allow successfully remapping the keys. We recommend modifying the list returned by assays(longTable, withDimnames=TRUE) and the reassigning to the LongTable.

  • assay(x = LongTable, i = ANY): Retrieve an assay data.table object from the assays slot of a LongTable object.

  • assay(x = LongTable, i = ANY) <- value:

  • assayNames(LongTable): Return the names of the assays contained in a LongTable

  • x[[i: Get an assay from a LongTable object. This method returns the row and column annotations by default to make assignment and aggregate operations easiers.

  • dim(LongTable): Get the number of row annotations by the number of column annotations from a LongTable object. Please note that row x columns does not necessarily equal the number of rows in an assay, since it is not required for each assay to have every row or column present.

  • colnames(LongTable): Retrieve the pseudo-colnames of a LongTable object, these are constructed by pasting together the colIDs(longTable) and can be used in the subset method for regex based queries.

  • rownames(LongTable): Retrieve the pseudo-rownames of a LongTable object, these are constructed by pasting together the rowIDs(longTable) and can be used in the subset method for regex based queries.

  • dimnames(LongTable): Get the pseudo-dimnames for a LongTable object. See colnames and rownames for more information.

Slots

rowData

See Slots section.

colData

See Slots section.

assays

See Slots section.

metadata

See Slots section.

.intern

See Slots section.

Slots

  • rowData: A data.table containing the metadata associated with the row dimension of a LongTable.

  • colData: A data.table containing the metadata associated with the column dimension of a LongTable.

  • assays: A list of data.tables, one for each assay in a LongTable.

  • metadata: An optional list of additional metadata for a LongTable which doesn't map to one of the dimensions.

  • .intern: An immutable list that holds internal structural metadata about a LongTable object, such as which columns are required to key the object.

Examples

rowIDs(merckLongTable)

rowMeta(merckLongTable)

colIDs(merckLongTable)

colMeta(merckLongTable)

idCols(merckLongTable)

assayIndex(nci_TRE_small)

assayKeys(nci_TRE_small)
assayKeys(nci_TRE_small, "sensitivity")
assayKeys(nci_TRE_small, 1)

assayCols(merckLongTable)

getIntern(merckLongTable, 'rowIDs')
getIntern(merckLongTable, c('colIDs', 'colMeta'))

getIntern(merckLongTable)

rowData(merckLongTable)

rowData(merckLongTable) <- rowData(merckLongTable)

colData(merckLongTable)

# Get the keys as well, mostly for internal use
colData(merckLongTable, key=TRUE)

colData(merckLongTable) <- colData(merckLongTable)

assays(merckLongTable)

assays(merckLongTable) <- assays(merckLongTable, withDimnames=TRUE)

# Default annotations, just the key columns
assay(merckLongTable, 'sensitivity')
assay(merckLongTable, 1)

# With identifiers joined
assay(merckLongTable, 'sensitivity', withDimnames=TRUE)

# With identifiers and metadata
assay(merckLongTable, 'profiles', withDimnames=TRUE, metadata=TRUE)

assay(merckLongTable, 'sensitivity') <-
     assay(merckLongTable, 'sensitivity', withDimnames=TRUE)
assay(merckLongTable, 'sensitivity') <- merckLongTable$sensitivity

assayNames(merckLongTable)
names(merckLongTable)

merckLongTable[['sensitivity']]

dim(merckLongTable)

dim(merckLongTable)

head(colnames(merckLongTable))

head(rownames(merckLongTable))

lapply(dimnames(merckLongTable), head)


bhklab/CoreGx documentation built on March 14, 2024, 3:04 a.m.