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).
Node-level network properties can be computed when calling
buildRepSeqNetwork() or its alias
node_stats = TRUE, or as a separate step using
We simulate some toy data for demonstration.
We simulate data consisting of two samples with 100 observations each, for a total of 200 observations (rows).
set.seed(42) library(NAIR) dir_out <- tempdir() toy_data <- simulateToyData() head(toy_data) #> CloneSeq CloneFrequency CloneCount SampleID #> 1 TTGAGGAAATTCG 0.007873775 3095 Sample1 #> 2 GGAGATGAATCGG 0.007777102 3057 Sample1 #> 3 GTCGGGTAATTGG 0.009094910 3575 Sample1 #> 4 GCCGGGTAATTCG 0.010160859 3994 Sample1 #> 5 GAAAGAGAATTCG 0.009336593 3670 Sample1 #> 6 AGGTGGGAATTCG 0.010369470 4076 Sample1
node_stats = TRUE is one way to compute node-level network
After using either of the methods described above, the node metadata now contains additional variables for the network properties.
The names of the node-level network properties that can be computed
are listed below. For details on the individual properties, see
cluster_id property is
By default, all of the available node-level properties are computed
When computing node properties with
addNodeStats(), the properties to compute can be
specified using the
stats_to_include = "all" computes all properties.
To specify a subset of properties,
accepts a named logical vector following a particular format. This
vector can be created with
chooseNodeStats() is one of the property names
seen above, accepting
FALSE to specify
whether the property is computed. (The default values match the default
set of node properties, so
stats_to_include = chooseNodeStats() is the same as leaving
closeness property is computed along with the
default properties except for
To include only a few properties and exclude the rest, it is easier
exclusiveNodeStats(), which behaves like
chooseNodeStats(), but all argument values are
FALSE by default.