knitr::opts_chunk$set( echo = TRUE, warning = FALSE, message = FALSE, collapse = TRUE, comment = "#>", fig.align = "center", fig.width = 10, fig.height = 10, out.width = "100%")
For single-cell data, cell-level network analysis can be performed based on joint similarity in alpha chain sequence and beta chain sequence.
We simulate some toy data to demonstrate the usage.
set.seed(42) library(NAIR) dat <- simulateToyData(chains = 2) head(dat)
The input data is assumed to have the following format:
Dual-chain network analysis can be performed using buildRepSeqNetwork()
(or generateNetworkObjects()
) by supplying a length-2 vector to the seq_col
parameter:
# Build network based on joint dual-chain similarity network <- buildNet(dat, seq_col = c("AlphaSeq", "BetaSeq"), count_col = "UMIs", node_stats = TRUE, stats_to_include = "all", cluster_stats = TRUE, color_nodes_by = "SampleID", size_nodes_by = "UMIs", node_size_limits = c(0.5, 3) )
We print the network graph plot with labels added for the largest two clusters:
addClusterLabels(network$plots$SampleID, network, top_n_clusters = 2, size = 8)
The list returned buildRepSeqNetwork()
the following items:
names(network)
Notice that the list contains three adjacency matrices: adjacency_matrix
corresponds to the network based on joint similarity in both chain sequences, while adj_mat_a
corresponds to the network based only on similarity in the alpha-chain sequence (and similarly for adj_mat_b
).
The cluster-level data contains sequence-based cluster statistics for each of the alpha and beta chain sequences:
head(network$cluster_data)
The remainder of the output and customization follows the general case for buildRepSeqNetwork()
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.