View source: R/AnansiWeb-constructors.R
AnansiWeb | R Documentation |
AnansiWeb
is an S4 class containing two feature tables as well as a
dictionary to link them. AnansiWeb
is the main container that will
hold your input data throughout the anansi
pipeline.
Typical use of the anansi
package will involve generating an AnansiWeb
object using the weaveWeb()
function.
The function AnansiWeb()
constructs an AnansiWeb
object from two
feature tables and an adjacency matrix.
## Constructor for `AnansiWeb` objects
AnansiWeb(tableX, tableY, dictionary, metadata = list(), ...)
## Accessors
## S4 method for signature 'AnansiWeb'
dimnames(x)
## S4 method for signature 'AnansiWeb'
dim(x)
## S4 method for signature 'AnansiWeb'
names(x)
## S4 method for signature 'AnansiWeb'
tableY(x, ...)
## S4 replacement method for signature 'AnansiWeb'
tableY(x, ...) <- value
## S4 method for signature 'AnansiWeb'
tableX(x, ...)
## S4 replacement method for signature 'AnansiWeb'
tableX(x, ...) <- value
## S4 method for signature 'AnansiWeb'
dictionary(x, ...)
## S4 replacement method for signature 'AnansiWeb'
dictionary(x, ...) <- value
## S4 method for signature 'AnansiWeb'
metadata(x, simplify = TRUE, ...)
## S4 replacement method for signature 'AnansiWeb'
metadata(x, simplify = TRUE, ...) <- value
## Coercion
asMAE(x)
## S4 method for signature 'AnansiWeb'
as.list(x, ...)
## S4 method for signature 'AnansiWeb'
as.data.frame(
x, row.names = NULL, optional = FALSE, ...
)
## Utilities on feature pairs
## S4 method for signature 'AnansiWeb'
which(x, arr.ind = TRUE, useNames = FALSE)
## S4 method for signature 'AnansiWeb'
getFeaturePairs(
x, which = NULL, with.metadata = FALSE, ...
)
## S4 method for signature 'AnansiWeb'
mapply(
FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE
)
## S4 method for signature 'AnansiWeb'
show(object)
tableY , tableX |
A table containing features of interest. Rows should be samples and columns should be features. Y and X refer to the position of the features in a formula: Y ~ X. |
dictionary |
A binary adjacency matrix of class |
metadata |
|
... |
additional arguments (currently not used). |
x , object |
an |
simplify |
|
value |
replacement |
arr.ind , useNames |
See ?base::which. |
FUN |
a function with at least two arguments. The variables |
MoreArgs , SIMPLIFY , USE.NAMES |
see ?base::mapply |
which |
|
with.metadata |
|
row.names , optional |
Ignored, for S4 generic. See ?base::as.data.frame. |
an AnansiWeb
object, with sparse binary biadjacency matrix
with features from y
as rows and features from x
as columns in
dictionary
slot.
A list of data.frames with the paired data
tableY,tableX
Two matrix
objects of measurements, data. Rows are
samples and columns are features. Access with tableY()
and tableX()
.
dictionary
Matrix
, binary adjacency matrix. Optionally sparse.
Typically generated using the weaveWeb()
function. Access with
dictionary()
.
metadata
Optional data.frame
of sample metadata. Access with
metadata()
.
kegg_link()
: For examples of input for link argument.
getWeb()
: For
MultiAssayExperiment::MultiAssayExperiment()
methods.
weaveWeb()
: for general use.
# Use AnansiWeb() to consrtuct an AnansiWeb object from components:
tX <- `dimnames<-`(replicate(5, (rnorm(36))),
value = list(
as.character(seq_len(36)),
letters[1:5]
)
)
tY <- `dimnames<-`(replicate(3, (rnorm(36))),
value = list(
as.character(seq_len(36)),
LETTERS[1:3]
)
)
d <- matrix(TRUE,
nrow = NCOL(tY), ncol = NCOL(tX),
# Note: Dictionary should have named dimensions
dimnames = list(
y_names = colnames(tY),
x_names = colnames(tX)
)
)
web <- AnansiWeb(tableX = tX, tableY = tY, dictionary = d)
# Methods for AnansiWeb
dimnames(web)
dim(web)
names(web)
tableX(web)
tableY(web)
dictionary(web)
# Assign some random metadata
metadata(web) <- data.frame(
id = row.names(tableY(web)),
a = rnorm(36),
b = sample(c("a", "b"), 36, TRUE),
row.names = "id"
)
metadata(web)
# coerce To list
weblist <- as.list(web)
# Coerce to MultiAssayExperiment
asMAE(web)
# Extract data.frames in pairs (only show first)
getFeaturePairs(web)[1L]
mapply(
FUN = function(x, y) cor(x, y),
web
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.