View source: R/network_analysis.R
addNodeNetworkStats | R Documentation |
Given the node metadata and igraph
for a network,
computes a specified set of network properties for the network nodes.
The node metadata is returned
with each property added as a variable.
This function was deprecated in favor of
addNodeStats()
in NAIR 1.0.1.
The new function accepts and returns the entire list of network
objects returned by buildRepSeqNetwork()
or by generateNetworkObjects()
.
It can compute cluster membership and add the values to the node metadata.
It additionally updates the list element details
with further
information linking the node-level and cluster-level metadata.
addNodeNetworkStats(
data,
net,
stats_to_include = chooseNodeStats(),
cluster_fun = "fast_greedy",
cluster_id_name = "cluster_id",
overwrite = FALSE,
verbose = FALSE,
...
)
data |
A data frame containing the node-level metadata for the network, with each row corresponding to a network node. |
net |
The network |
stats_to_include |
Specifies which network properties to compute.
Accepts a vector created using
|
cluster_fun |
A character string specifying the clustering algorithm to use when
computing cluster membership.
Applicable only when |
cluster_id_name |
A character string specifying the name of the cluster membership variable
to be added to |
overwrite |
Logical. If |
verbose |
Logical. If |
... |
Named optional arguments to the function specified by |
Node-level network properties are properties that pertain to each individual node in the network graph.
Some are local properties, meaning that their value for a given node depends only on a subset of the nodes in the network. One example is the network degree of a given node, which represents the number of other nodes that are directly joined to the given node by an edge connection.
Other properties are global properties, meaning that their value for a given node
depends on all of the nodes in the network. An example is the authority score of
a node, which is computed using the entire graph adjacency matrix (if we denote
this matrix by A
, then the principal eigenvector of A^T A
represents
the authority scores of the network nodes).
See chooseNodeStats()
for a list of the available node-level network properties.
A copy of data
with with an additional column for each
new network property computed.
See chooseNodeStats()
for the network property names,
which are used as the column names,
except for the cluster membership variable,
whose name is the value of cluster_id_name
.
Brian Neal (Brian.Neal@ucsf.edu)
Hai Yang, Jason Cham, Brian Neal, Zenghua Fan, Tao He and Li Zhang. (2023). NAIR: Network Analysis of Immune Repertoire. Frontiers in Immunology, vol. 14. doi: 10.3389/fimmu.2023.1181825
addNodeStats()
chooseNodeStats()
set.seed(42)
toy_data <- simulateToyData()
net <-
generateNetworkObjects(
toy_data,
"CloneSeq"
)
net$node_data <-
addNodeNetworkStats(
net$node_data,
net$igraph
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.