set.seed(42)
toy_data <- simulateToyData()
net <- generateNetworkObjects(
toy_data, "CloneSeq"
)
net <- addClusterStats(
net,
count_col = "CloneCount"
)
head(net$cluster_data)
net$details
# won't change net since net$cluster_data exists
net <- addClusterStats(
net,
count_col = "CloneCount",
cluster_fun = "leiden",
verbose = TRUE
)
# overwrites values in net$cluster_data
# and cluster membership values in net$node_data$cluster_id
# with values obtained using "cluster_leiden" algorithm
net <- addClusterStats(
net,
count_col = "CloneCount",
cluster_fun = "leiden",
overwrite = TRUE
)
net$details
# overwrites existing values in net$cluster_data
# with values obtained using "cluster_louvain" algorithm
# saves cluster membership values to net$node_data$cluster_id_louvain
# (net$node_data$cluster_id retains membership values from "cluster_leiden")
net <- addClusterStats(
net,
count_col = "CloneCount",
cluster_fun = "louvain",
cluster_id_name = "cluster_id_louvain",
overwrite = TRUE
)
net$details
# perform clustering using "cluster_fast_greedy" algorithm,
# save cluster membership values to net$node_data$cluster_id_greedy
net <- addClusterMembership(
net,
cluster_fun = "fast_greedy",
cluster_id_name = "cluster_id_greedy"
)
# compute cluster properties for the clusters from previous step
# overwrites values in net$cluster_data
net <- addClusterStats(
net,
cluster_id_name = "cluster_id_greedy",
overwrite = TRUE
)
net$details
Run the code above in your browser using DataLab