pa_dep_matrix | R Documentation |
Obtains a presence-absence dependency matrix for the given set of terms. The
resulting matrix M will have values 1 and 0, where M[i,j] = 1 iff the
presence if term i implies the presence of term j. Note that it follows that
M[i,j] = 1 iff the absence of term j implies the absence of term i.
Note also that the matrix is asymmetric; that is, M[i,j] = 1 does not imply
M[j,i] = 1 for i\neq j
. Terms i and j (i\neq j
)
for which M[i,j] = M[j,i] = 1 are sometimes referred to as super-dependent.
pa_dep_matrix(
terms,
.names = c("ID", "IRI", "label"),
.labels = NULL,
preserveOrder = FALSE,
verbose = FALSE
)
terms |
character, the list of terms for which to compute the dependency matrix. Can be given as term IRIs or term labels, and the list can contain both. Terms given as labels will first be resolved to IRIs, assuming they are from an anatomy ontology. |
.names |
character, how to name the rows and columns of the resulting matrix.
|
.labels |
character, the labels for terms where known. Only used if
|
preserveOrder |
logical, whether to return rows (and columns) in the same
order as |
verbose |
logical, whether to print informative messages about certain potentially time-consuming operations. |
A data.fram M with M[i,j] = 1 iff the presence of term i implies the presence of term j, and 0 otherwise.
The matrix will have additional attributes depending on the choice of how to
name rows and columns. If .names = "ID"
(the default), the matrix will have
an attribute prefixes
giving the URL prefixes removed from the term IRIs
to yield the IDs, in the order of the rows. If .names = "label"
, it will
have attribute term.iris
, giving the term IRIs for the rows (and columns).
Note that these extra attributes will be lost upon subsetting the returned
matrix.
tl <- c("http://purl.obolibrary.org/obo/UBERON_0000981",
"http://purl.obolibrary.org/obo/UBERON_0002103",
"http://purl.obolibrary.org/obo/UBERON_0000976",
"http://purl.obolibrary.org/obo/UBERON_0002102")
m <- pa_dep_matrix(tl)
m # term IDs as row and column names
id_prefixes <- attr(m, "prefixes")
id_prefixes # 4x "http://purl.obolibrary.org/obo/"
m <- pa_dep_matrix(tl, .names = "label")
m # term labels as row and column names
mat_terms <- attr(m, "term.iris")
mat_terms # term IRIs in the same order as rows (and columns)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.