View source: R/network_analysis.R
getClusterStats | R Documentation |
Given the node-level metadata and adjacency matrix for a network graph that has been partitioned into clusters, computes network properties for the clusters and returns them in a data frame.
addClusterStats()
is preferred to getClusterStats()
in most situations.
getClusterStats(
data,
adjacency_matrix,
seq_col = NULL,
count_col = NULL,
cluster_id_col = "cluster_id",
degree_col = NULL,
cluster_fun = deprecated(),
verbose = FALSE
)
data |
A data frame containing the node-level metadata for the network, with each row corresponding to a network node. |
adjacency_matrix |
The adjacency matrix for the network. |
seq_col |
Specifies the column(s) of |
count_col |
Specifies the column of |
cluster_id_col |
Specifies the column of |
degree_col |
Specifies the column of |
cluster_fun |
|
verbose |
Logical. If |
To use getClusterStats()
,
the network graph must first be partitioned into clusters,
which can be done using
addClusterMembership()
.
The name of the cluster membership variable in the node metadata
must be provided to the cluster_id_col
argument
when calling getClusterStats()
.
A data frame containing one row for each cluster in the network and the following variables:
cluster_id |
The cluster ID number. |
node_count |
The number of nodes in the cluster. |
mean_seq_length |
The mean sequence length in the cluster.
Only present when |
A_mean_seq_length |
The mean first sequence length in the cluster.
Only present when |
B_mean_seq_length |
The mean second sequence length in the cluster.
Only present when |
mean_degree |
The mean network degree in the cluster. |
max_degree |
The maximum network degree in the cluster. |
seq_w_max_degree |
The receptor sequence possessing the maximum degree within the cluster.
Only present when |
A_seq_w_max_degree |
The first sequence of the node possessing the maximum degree within the cluster.
Only present when |
B_seq_w_max_degree |
The second sequence of the node possessing the maximum degree within the cluster.
Only present when |
agg_count |
The aggregate count among all nodes in the cluster (based on the counts in
|
max_count |
The maximum count among all nodes in the cluster (based on the counts in
|
seq_w_max_count |
The receptor sequence possessing the maximum count within the cluster.
Only present when |
A_seq_w_max_count |
The first sequence of the node possessing the maximum count within the cluster.
Only present when |
B_seq_w_max_count |
The second sequence of the node possessing the maximum count within the cluster.
Only present when |
diameter_length |
The longest geodesic distance in the cluster, computed as the length of the
vector returned by |
assortativity |
The assortativity coefficient of the cluster's graph, based on the degree
(minus one) of each node in the cluster (with the degree computed based only
upon the nodes within the cluster). Computed using
|
global_transitivity |
The transitivity (i.e., clustering coefficient) for the cluster's graph, which
estimates the probability that adjacent vertices are connected. Computed using
|
edge_density |
The number of edges in the cluster as a fraction of the maximum possible number
of edges. Computed using |
degree_centrality_index |
The centrality index of the cluster's graph based on within-cluster network degree.
Computed as the |
closeness_centrality_index |
The centrality index of the cluster's graph based on closeness,
i.e., distance to other nodes in the cluster.
Computed using |
eigen_centrality_index |
The centrality index of the cluster's graph based on the eigenvector centrality scores,
i.e., values of the first eigenvector of the adjacency matrix for the cluster.
Computed as the |
eigen_centrality_eigenvalue |
The eigenvalue corresponding to the first eigenvector of the adjacency matrix
for the cluster. Computed as the |
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
addClusterStats()
addClusterMembership()
labelClusters()
set.seed(42)
toy_data <- simulateToyData()
net <-
generateNetworkObjects(
toy_data, "CloneSeq"
)
net <- addClusterMembership(net)
net$cluster_data <-
getClusterStats(
net$node_data,
net$adjacency_matrix,
seq_col = "CloneSeq",
count_col = "CloneCount"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.