Generate a biadjacency matrix, linking the features between two tables.
Return an AnansiWeb object which contains all three.
weaveWeb() is for general use and has flexible default settings.
weaveKEGG() is a wrapper that sets link to kegg_link().
All variants are special cases of weaveWeb().
Arguments
- x, y
Character scalar, names of feature types that should be linked. Should be found in the column names oflink.- link
One of the following:
Character scalarwith value"none".data.framewith two columnslistwith two suchdata.frames.
- 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.
< For Bioconductor S4 objects >Character scalarornumeric scalar. Selects experiment corresponding totableYandtableXfromexperiments(x)ofMultiAssayExperimentobject by name or index, name is recommended. (Default slots:Y = 1L,X = 2L).- metadata
Optional
data.frameof sample metadata, to be included with output. Can be accessed fromAnansiWebgenerated byweaveWeb()withoutput@metadata.- verbose
Logical scalar. Whether to print diagnostic information (Default:TRUE).#' @param force_newbooleanIf x already has a dictionaryMatrixin metadata, ignore it and generate a new object anyway? (Default: FALSE).- typeY, typeX
Character scalarornumeric scalar. Selects assay from experiments totableYandtableXfromexperiments(x). (Default:1L- the first assay in that experiment).- experiment1, experiment2
synonymous args to
tableY,tableXfor compatibility withmiaargument style.- assay.type1, assay.type2
synonymous args to
typeY,typeXfor compatibility withmiaargument style.
Value
an AnansiWeb object, with sparse binary biadjacency matrix
with features from y as rows and features from x as columns in
dictionary slot.
Details
If the link argument is "none", all features will be considered
linked. If one or more data.frames, colnames should be as specified in
x and y.
See also
AnansiWeb: For general constructor and methods.
kegg_link(): For examples of input for link argument.
Examples
# Setup demo tables, see first vignette.
data(FMT_data)
t1 <- t(FMT_metab)
t2 <- t(FMT_KOs)
# Input objects and syntax:
## define `x` and `y` as characters
web <- weaveWeb(
x = "ko", y = "cpd", link = kegg_link(),
tableX = t2, tableY = t1,
metadata = NULL, verbose = TRUE
)
#> Dropped features in tableX: 2476 remain.
#> Warning: Argument `metadata` not provided; Please validate sample ID order.
## define `x` and `y` with a formula
web2 <- weaveWeb(
x = cpd ~ ko, link = kegg_link(),
tableX = t2, tableY = t1,
metadata = NULL, verbose = TRUE
)
#> Dropped features in tableX: 2476 remain.
#> Warning: Argument `metadata` not provided; Please validate sample ID order.
identical(web, web2)
#> [1] TRUE
# Method for MultiAssayExperiment S4 object
mae <- asMAE(web)
weaveWeb(
x = mae, link = kegg_link(),
tableY = "cpd", tableX = "ko",
force_new = FALSE
)
#> Warning: Argument `metadata` not provided; Please validate sample ID order.
#> anansi::AnansiWeb S7_object with 36 observations:
#> tableY: cpd (3 features)
#> tableX: ko (2476 features)
#> Use @ to access: tableX, tableY, dictionary, metadata.
# Method for TreeSummarizedExperiment S4 object
tse <- asTSE(web)
weaveWeb(
x = tse, link = kegg_link(),
tableY = "cpd", tableX = "ko",
force_new = FALSE
)
#> Warning: Argument `metadata` not provided; Please validate sample ID order.
#> anansi::AnansiWeb S7_object with 36 observations:
#> tableY: cpd (3 features)
#> tableX: ko (2476 features)
#> Use @ to access: tableX, tableY, dictionary, metadata.