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()
.
Usage
weaveWeb(x, ...)
# S4 method for class 'character'
weaveWeb(
x,
y,
link = NULL,
tableX = NULL,
tableY = NULL,
metadata = NULL,
verbose = TRUE,
...
)
# S4 method for class 'formula'
weaveWeb(x, link = NULL, tableX = NULL, tableY = NULL, ...)
weaveKEGG(x, ...)
# S4 method for class 'MultiAssayExperiment'
weaveWeb(
x,
link = NULL,
...,
tableY = NULL,
tableX = NULL,
typeY = NULL,
typeX = NULL,
force_new = FALSE,
experiment1 = NULL,
experiment2 = NULL,
assay.type1 = NULL,
assay.type2 = NULL
)
# S4 method for class 'SingleCellExperiment'
weaveWeb(
x,
link = NULL,
...,
tableY = NULL,
tableX = NULL,
typeY = NULL,
typeX = NULL,
force_new = FALSE,
experiment1 = NULL,
experiment2 = NULL,
assay.type1 = NULL,
assay.type2 = NULL
)
Arguments
- x, y
Character scalar
, names of feature types that should be linked. Should be found in the column names oflink
.- ...
additional parameters passed to
AnansiWeb()
.- link
One of the following:
Character scalar
with value"none"
.data.frame
with two columnslist
with two suchdata.frame
s.
- tableY, tableX
Character scalar
ornumeric scalar
. Selects experiment corresponding totableY
andtableX
fromexperiments(x)
ofMultiAssayExperiment
object by name or index, name is recommended. (Default slots:Y = 1L
,X = 2L
).- metadata
Optional
data.frame
of sample metadata, to be included with output. Can be accessed fromAnansiWeb
generated byweaveWeb()
withmetadata(output)
.- verbose
Logical scalar
. Whether to print diagnostic information (Default:TRUE
).- typeY, typeX
Character scalar
ornumeric scalar
. Selects assay from experiments totableY
andtableX
fromexperiments(x)
. (Default:1L
- the first assay in that experiment).- force_new
boolean
If x already has a dictionaryMatrix
in metadata, ignore it and generate a new object anyway? (Default: FALSE).- experiment1, experiment2
synonymous args to
tableY,tableX
for compatibility withmia
argument style.- assay.type1, assay.type2
synonymous args to
typeY,typeX
for compatibility withmia
argument style.- formula
formula
of the form y ~ x, denoting desired output format; assigns y to rows and columns to x. Equivalent to usingx
andy
arguments.
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.frame
s, 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
ec2ko <- kegg_link()[["ec2ko"]]
ec2cpd <- kegg_link()[["ec2cpd"]]
# Basic usage
weaveWeb(cpd ~ ko, link = kegg_link())
#> AnansiWeb S4 object with 1 observations:
#> tableY: cpd (6754 features)
#> tableX: ko (7270 features)
#> Accessors: tableX(), tableY(), dictionary(), metadata().
weaveWeb(x = "ko", y = "ec", link = ec2ko)
#> AnansiWeb S4 object with 1 observations:
#> tableY: ec (5581 features)
#> tableX: ko (8817 features)
#> Accessors: tableX(), tableY(), dictionary(), metadata().
weaveWeb(ec ~ cpd, link = ec2cpd)
#> AnansiWeb S4 object with 1 observations:
#> tableY: ec (5934 features)
#> tableX: cpd (7802 features)
#> Accessors: tableX(), tableY(), dictionary(), metadata().
# A wrapper is available for kegg ko, ec and cpd data
generic <- weaveWeb(cpd ~ ko, link = kegg_link())
kegg_wrapper <- weaveKEGG(cpd ~ ko)
identical(generic, kegg_wrapper)
#> [1] TRUE
# The following are equivalent to transposition:
a <- weaveWeb(ko ~ cpd, link = kegg_link()) |> dictionary()
b <- weaveWeb(cpd ~ ko, link = kegg_link()) |> dictionary()
identical(a, Matrix::t(b))
#> [1] TRUE