Title: | Cell Communication Analysis for Single Cell RNA Sequencing |
---|---|
Description: | dominoSignal is a package developed to analyze cell signaling through ligand - receptor - transcription factor networks in scRNAseq data. It takes as input information transcriptomic data, requiring counts, z-scored counts, and cluster labels, as well as information on transcription factor activation (such as from SCENIC) and a database of ligand and receptor pairings (such as from CellPhoneDB). This package creates an object storing ligand - receptor - transcription factor linkages by cluster and provides several methods for exploring, summarizing, and visualizing the analysis. |
Authors: | Christopher Cherry [aut] , Jacob T Mitchell [aut, cre] , Sushma Nagaraj [aut] , Kavita Krishnan [aut] , Dmitrijs Lvovs [aut], Elana Fertig [ctb] , Jennifer Elisseeff [ctb] |
Maintainer: | Jacob T Mitchell <[email protected]> |
License: | GPL-3 | file LICENSE |
Version: | 1.1.0 |
Built: | 2024-10-30 05:49:00 UTC |
Source: | https://github.com/bioc/dominoSignal |
This function adds a column to the internal rl 'map' used to map all receptor and receptor complexes to all ligand and ligand complexes.
add_rl_column(map, map_ref, conv, new_name)
add_rl_column(map, map_ref, conv, new_name)
map |
RL signaling data frame. |
map_ref |
Name of column to match new data to |
conv |
Data frame matching current data in map to new data. |
new_name |
Name of new column to be created in RL map |
An updated RL signaling data frame
example(create_rl_map_cellphonedb, echo = FALSE) lr_name <- data.frame("abbrev" = c("L", "R"), "full" = c("Ligand", "Receptor")) rl_map_expanded <- add_rl_column(map = rl_map_tiny, map_ref = "type_A", conv = lr_name, new_name = "type_A_full")
example(create_rl_map_cellphonedb, echo = FALSE) lr_name <- data.frame("abbrev" = c("L", "R"), "full" = c("Ligand", "Receptor")) rl_map_expanded <- add_rl_column(map = rl_map_tiny, map_ref = "type_A", conv = lr_name, new_name = "type_A_full")
This function calculates a signaling network. It requires a domino object preprocessed from create_domino and returns a domino object prepared for plotting with the various plotting functions in this package.
build_domino( dom, max_tf_per_clust = 5, min_tf_pval = 0.01, max_rec_per_tf = 5, rec_tf_cor_threshold = 0.15, min_rec_percentage = 0.1 )
build_domino( dom, max_tf_per_clust = 5, min_tf_pval = 0.01, max_rec_per_tf = 5, rec_tf_cor_threshold = 0.15, min_rec_percentage = 0.1 )
dom |
Domino object from |
max_tf_per_clust |
Maximum number of transcription factors called active in a cluster. |
min_tf_pval |
Minimum p-value from differential feature score test to call a transcription factor active in a cluster. |
max_rec_per_tf |
Maximum number of receptors to link to each transcription factor. |
rec_tf_cor_threshold |
Minimum Spearman correlation used to consider a receptor linked with a transcription factor. Increasing this will decrease the number of receptors linked to each transcription factor. |
min_rec_percentage |
Minimum percentage of cells in cluster expressing a receptor for the receptor to be linked to trancription factors in that cluster. |
A domino object with a signaling network built
example(create_domino, echo = FALSE) #a relaxed example pbmc_dom_built_tiny <- build_domino( dom = pbmc_dom_tiny, min_tf_pval = .05, max_tf_per_clust = Inf, max_rec_per_tf = Inf, rec_tf_cor_threshold = .1, min_rec_percentage = 0.01 )
example(create_domino, echo = FALSE) #a relaxed example pbmc_dom_built_tiny <- build_domino( dom = pbmc_dom_tiny, min_tf_pval = .05, max_tf_per_clust = Inf, max_rec_per_tf = Inf, rec_tf_cor_threshold = .1, min_rec_percentage = 0.01 )
A list of four subsets of CellPhoneDB data.
data("CellPhoneDB")
data("CellPhoneDB")
A list of:
A subet of CellPhoneDB gene_input.csv
A subset of CellPhoneDB protein_input.csv
A subset of CellPhoneDB complex_input.csv
A subset of CellPhoneDB interaction_input.csv
https://github.com/ventolab/cellphonedb-data/archive/refs/tags/v4.0.0.tar.gz
Creates a chord plot of expression of ligands that can activate a specified receptor where chord widths correspond to mean ligand expression by the cluster.
circos_ligand_receptor( dom, receptor, ligand_expression_threshold = 0.01, cell_idents = NULL, cell_colors = NULL )
circos_ligand_receptor( dom, receptor, ligand_expression_threshold = 0.01, cell_idents = NULL, cell_colors = NULL )
dom |
Domino object that has undergone network building with |
receptor |
Name of a receptor active in at least one cell type in the domino object |
ligand_expression_threshold |
Minimum mean expression value of a ligand by a cell type for a chord to be rendered between the cell type and the receptor |
cell_idents |
Vector of cell types from cluster assignments in the domino object to be included in the plot. |
cell_colors |
Named vector of color names or hex codes where names correspond to the plotted cell types and the color values |
Renders a circos plot to the active graphics device
example(build_domino, echo = FALSE) #basic usage circos_ligand_receptor(pbmc_dom_built_tiny, receptor = "CXCR3") #specify colors cols = c("red", "orange", "green") names(cols) = dom_clusters(pbmc_dom_built_tiny) circos_ligand_receptor(pbmc_dom_built_tiny, receptor = "CXCR3", cell_colors = cols)
example(build_domino, echo = FALSE) #basic usage circos_ligand_receptor(pbmc_dom_built_tiny, receptor = "CXCR3") #specify colors cols = c("red", "orange", "green") names(cols) = dom_clusters(pbmc_dom_built_tiny) circos_ligand_receptor(pbmc_dom_built_tiny, receptor = "CXCR3", cell_colors = cols)
Creates a heatmap of correlation values between receptors and transcription factors either with boolean threshold or with continuous values displayed
cor_heatmap( dom, bool = FALSE, bool_thresh = 0.15, title = TRUE, feats = NULL, recs = NULL, mark_connections = FALSE, ... )
cor_heatmap( dom, bool = FALSE, bool_thresh = 0.15, title = TRUE, feats = NULL, recs = NULL, mark_connections = FALSE, ... )
dom |
Domino object with network built ( |
bool |
Boolean indicating whether the heatmap should be continuous or boolean. If boolean then bool_thresh will be used to determine how to define activity as positive or negative. |
bool_thresh |
Numeric indicating the threshold separating 'on' or 'off' for feature activity if making a boolean heatmap. |
title |
Either a string to use as the title or a boolean describing whether to include a title. In order to pass the 'main' parameter to |
feats |
Either a vector of features to include in the heatmap or 'all' for all features. If left NULL then the features selected for the signaling network will be shown. |
recs |
Either a vector of receptors to include in the heatmap or 'all' for all receptors. If left NULL then the receptors selected in the signaling network connected to the features plotted will be shown. |
mark_connections |
Boolean indicating whether to add an 'x' in cells where there is a connected receptor or TF. Default FALSE. |
... |
Other parameters to pass to |
A heatmap rendered to the active graphics device
example(build_domino, echo = FALSE) #basic usage cor_heatmap(pbmc_dom_built_tiny, title = "PBMC R-TF Correlations") #show correlations above a specific value cor_heatmap(pbmc_dom_built_tiny, bool = TRUE, bool_thresh = 0.1) #identify combinations that are connected cor_heatmap(pbmc_dom_built_tiny, bool = FALSE, mark_connections = TRUE)
example(build_domino, echo = FALSE) #basic usage cor_heatmap(pbmc_dom_built_tiny, title = "PBMC R-TF Correlations") #show correlations above a specific value cor_heatmap(pbmc_dom_built_tiny, bool = TRUE, bool_thresh = 0.1) #identify combinations that are connected cor_heatmap(pbmc_dom_built_tiny, bool = FALSE, mark_connections = TRUE)
Create a correlation plot between transcription factor activation score and receptor expression
cor_scatter(dom, tf, rec, remove_rec_dropout = TRUE, ...)
cor_scatter(dom, tf, rec, remove_rec_dropout = TRUE, ...)
dom |
Domino object with network built ( |
tf |
Target TF for plottting AUC score |
rec |
Target receptor for plotting expression |
remove_rec_dropout |
Whether to remove cells with zero expression for plot. This should match the same setting as in |
... |
Other parameters to pass to |
A ggplot scatter plot rendered in the active graphics device
example(build_domino, echo = FALSE) cor_scatter(pbmc_dom_built_tiny, "FLI1","CXCR3")
example(build_domino, echo = FALSE) cor_scatter(pbmc_dom_built_tiny, "FLI1","CXCR3")
Count occurrences of linkages across multiple domino results from a linkage summary
count_linkage( linkage_summary, cluster, group.by = NULL, linkage = "rec_lig", subject_names = NULL )
count_linkage( linkage_summary, cluster, group.by = NULL, linkage = "rec_lig", subject_names = NULL )
linkage_summary |
a |
cluster |
the name of the cell cluster being compared across multiple domino results |
group.by |
the name of the column in |
linkage |
a stored linkage from the domino object. Can compare any of 'tfs', 'rec', 'incoming_lig', 'tfs_rec', or 'rec_lig' |
subject_names |
a vector of subject_names from the linkage_summary to be compared. If NULL, all subject_names in the linkage summary are included in counting. |
A data frame with columns for the unique linkage features and the counts of how many times the linkage occured across the compared domino results. If group.by is used, counts of the linkages are also provided as columns named by the unique values of the group.by variable.
count_linkage( linkage_summary = mock_linkage_summary(), cluster = "C1", group.by = "group", linkage = "rec")
count_linkage( linkage_summary = mock_linkage_summary(), cluster = "C1", group.by = "group", linkage = "rec")
This function reads in a receptor ligand signaling database, cell level
features of some kind (ie. output from pySCENIC), z-scored single cell data,
and cluster id for single cell data, calculates a correlation matrix between
receptors and other features (this is transcription factor module scores if
using pySCENIC), and finds features enriched by cluster. It will return a
domino object prepared for build_domino()
, which will calculate a signaling
network.
create_domino( rl_map, features, counts = NULL, z_scores = NULL, clusters = NULL, use_clusters = TRUE, tf_targets = NULL, verbose = TRUE, use_complexes = TRUE, rec_min_thresh = 0.025, remove_rec_dropout = TRUE, tf_selection_method = "clusters", tf_variance_quantile = 0.5 )
create_domino( rl_map, features, counts = NULL, z_scores = NULL, clusters = NULL, use_clusters = TRUE, tf_targets = NULL, verbose = TRUE, use_complexes = TRUE, rec_min_thresh = 0.025, remove_rec_dropout = TRUE, tf_selection_method = "clusters", tf_variance_quantile = 0.5 )
rl_map |
Data frame where each row describes a receptor-ligand interaction with required columns gene_A & gene_B including the gene names for the receptor and ligand and type_A & type_B annotating if genes A and B are a ligand (L) or receptor (R) |
features |
Either a path to a csv containing cell level features of interest (ie. the auc matrix from pySCENIC) or named matrix with cells as columns and features as rows. |
counts |
Counts matrix for the data. This is only used to threshold receptors on dropout. |
z_scores |
Matrix containing z-scored expression data for all cells with cells as columns and features as rows. |
clusters |
Named factor containing cell cluster with names as cells. |
use_clusters |
Boolean indicating whether to use clusters. |
tf_targets |
Optional. A list where names are transcription factors and the stored values are character vectors of genes in the transcription factor's regulon. |
verbose |
Boolean indicating whether or not to print progress during computation. |
use_complexes |
Boolean indicating whether you wish to use receptor/ligand complexes in the receptor ligand signaling database. If FALSE, receptor/ligand pairs where either functions as a protein complex will not be considered when constructing the signaling network. |
rec_min_thresh |
Minimum expression level of receptors by cell. Default is 0.025 or 2.5 percent of all cells in the data set. This is important when calculating correlation to connect receptors to transcription activation. If this threshold is too low then correlation calculations will proceed with very few cells with non-zero expression. |
remove_rec_dropout |
Whether to remove receptors with 0 expression counts when calculating correlations. This can reduce false positive correlation calculations when receptors have high dropout rates. |
tf_selection_method |
Selection of which method to target transcription factors. If 'clusters' then differential expression for clusters will be calculated. If 'variable' then the most variable transcription factors will be selected. If 'all' then all transcription factors in the feature matrix will be used. Default is 'clusters'. Note that if you wish to use clusters for intercellular signaling downstream to MUST choose clusters. |
tf_variance_quantile |
What proportion of variable features to take if using variance to threshold features. Default is 0.5. Higher numbers will keep more features. Ignored if tf_selection_method is not 'variable' |
A domino object
example(create_rl_map_cellphonedb, echo = FALSE) example(create_regulon_list_scenic, echo = FALSE) data(SCENIC) data(PBMC) pbmc_dom_tiny <- create_domino( rl_map = rl_map_tiny, features = SCENIC$auc_tiny, counts = PBMC$RNA_count_tiny, z_scores = PBMC$RNA_zscore_tiny, clusters = PBMC$clusters_tiny, tf_targets = regulon_list_tiny, use_clusters = TRUE, use_complexes = TRUE, remove_rec_dropout = FALSE, verbose = FALSE ) pbmc_dom_tiny_no_clusters <- create_domino( rl_map = rl_map_tiny, features = SCENIC$auc_tiny, counts = PBMC$RNA_count_tiny, z_scores =PBMC$RNA_zscore_tiny, clusters = PBMC$clusters_tiny, tf_targets = regulon_list_tiny, use_clusters = FALSE, use_complexes = FALSE, rec_min_thresh = 0.1, remove_rec_dropout = TRUE, tf_selection_method = "all", verbose = FALSE )
example(create_rl_map_cellphonedb, echo = FALSE) example(create_regulon_list_scenic, echo = FALSE) data(SCENIC) data(PBMC) pbmc_dom_tiny <- create_domino( rl_map = rl_map_tiny, features = SCENIC$auc_tiny, counts = PBMC$RNA_count_tiny, z_scores = PBMC$RNA_zscore_tiny, clusters = PBMC$clusters_tiny, tf_targets = regulon_list_tiny, use_clusters = TRUE, use_complexes = TRUE, remove_rec_dropout = FALSE, verbose = FALSE ) pbmc_dom_tiny_no_clusters <- create_domino( rl_map = rl_map_tiny, features = SCENIC$auc_tiny, counts = PBMC$RNA_count_tiny, z_scores =PBMC$RNA_zscore_tiny, clusters = PBMC$clusters_tiny, tf_targets = regulon_list_tiny, use_clusters = FALSE, use_complexes = FALSE, rec_min_thresh = 0.1, remove_rec_dropout = TRUE, tf_selection_method = "all", verbose = FALSE )
Generates a list of transcription factors and the genes targeted by the transcription factor as part of their regulon inferred by pySCENIC
create_regulon_list_scenic(regulons)
create_regulon_list_scenic(regulons)
regulons |
Data frame or file path to the table of the output of the ctx function from pySCENIC |
A list where names are transcription factors and the stored values are character vectors of genes in the inferred regulons
data(SCENIC) regulon_list_tiny <- create_regulon_list_scenic(regulons = SCENIC$regulons_tiny)
data(SCENIC) regulon_list_tiny <- create_regulon_list_scenic(regulons = SCENIC$regulons_tiny)
Generates a data frame of ligand-receptor interactions from a CellPhoneDB database annotating the genes encoding the interacting ligands and receptors to be queried in transcriptomic data.
create_rl_map_cellphonedb( genes, proteins, interactions, complexes = NULL, database_name = "CellPhoneDB", gene_conv = NULL, gene_conv_host = "https://www.ensembl.org", alternate_convert = FALSE, alternate_convert_table = NULL )
create_rl_map_cellphonedb( genes, proteins, interactions, complexes = NULL, database_name = "CellPhoneDB", gene_conv = NULL, gene_conv_host = "https://www.ensembl.org", alternate_convert = FALSE, alternate_convert_table = NULL )
genes |
data frame or file path to table of gene names in uniprot, hgnc_symbol, or ensembl format in CellPhoneDB database format |
proteins |
data frame or file path to table of protein features in CellPhoneDB format |
interactions |
data frame or file path to table of protein-protein interactions in CellPhoneDB format |
complexes |
optional: data frame or file path to table of protein complexes in CellPhoneDB format |
database_name |
name of the database being used, stored in output |
gene_conv |
a tuple of (from, to) or (source, target) if gene conversion to orthologs is desired; options are ENSMUSG, ENSG, MGI, or HGNC |
gene_conv_host |
host for conversion; default ensembl, could also use mirrors if desired |
alternate_convert |
boolean if you would like to use a non-ensembl method of conversion (must supply table; not recommended, use only if ensembl is down) |
alternate_convert_table |
supplied table for non-ensembl method of conversion |
Data frame where each row describes a possible receptor-ligand interaction
data(CellPhoneDB) rl_map_tiny <- create_rl_map_cellphonedb(genes = CellPhoneDB$genes_tiny, proteins = CellPhoneDB$proteins_tiny, interactions = CellPhoneDB$interactions_tiny, complexes =CellPhoneDB$complexes_tiny)
data(CellPhoneDB) rl_map_tiny <- create_rl_map_cellphonedb(genes = CellPhoneDB$genes_tiny, proteins = CellPhoneDB$proteins_tiny, interactions = CellPhoneDB$interactions_tiny, complexes =CellPhoneDB$complexes_tiny)
A function to pull cluster information from a domino object
dom_clusters(dom, labels = FALSE)
dom_clusters(dom, labels = FALSE)
dom |
a domino object that has been created with |
labels |
a boolean for whether to return the cluster labels for each cell or the clusters used for inferring communication |
A vector containing either the names of the clusters used OR factors of the cluster label for each individual cell
example(build_domino, echo = FALSE) cluster_names <- dom_clusters(pbmc_dom_built_tiny) cell_cluster_label <- dom_clusters(pbmc_dom_built_tiny, labels = TRUE)
example(build_domino, echo = FALSE) cluster_names <- dom_clusters(pbmc_dom_built_tiny) cell_cluster_label <- dom_clusters(pbmc_dom_built_tiny, labels = TRUE)
A function to pull receptor-transcription factor correlations from a domino object
dom_correlations(dom, type = "rl")
dom_correlations(dom, type = "rl")
dom |
a domino object that has been created with |
type |
either "rl" or "complex", to select between the receptor-ligand or complex correlation matrix |
A matrix containing the correlation values for each receptor (row) by transcription factor (column)
example(build_domino, echo = FALSE) cor_matrix <- dom_correlations(pbmc_dom_built_tiny, "rl")
example(build_domino, echo = FALSE) cor_matrix <- dom_correlations(pbmc_dom_built_tiny, "rl")
A function to pull gene expression from a domino object
dom_counts(dom)
dom_counts(dom)
dom |
a domino object that has been created with |
A matrix containing the gene expression values for each gene (row) by cell (column)
example(build_domino, echo = FALSE) counts <- dom_counts(pbmc_dom_built_tiny)
example(build_domino, echo = FALSE) counts <- dom_counts(pbmc_dom_built_tiny)
A function to pull database information from a domino object
dom_database(dom, name_only = TRUE)
dom_database(dom, name_only = TRUE)
dom |
a domino object that has been created |
name_only |
a boolean for whether to return only the name of the database used or the entire database that is stored. Default TRUE. |
A vector of unique databases used in building the domino object OR a data frame that includes the database information used in the domino object creation
example(build_domino, echo = FALSE) database_name <- dom_database(pbmc_dom_built_tiny) full_database <- dom_database(pbmc_dom_built_tiny, name_only = FALSE)
example(build_domino, echo = FALSE) database_name <- dom_database(pbmc_dom_built_tiny) full_database <- dom_database(pbmc_dom_built_tiny, name_only = FALSE)
A function to pull differential expression p-values from a domino object
dom_de(dom)
dom_de(dom)
dom |
a domino object that has been created with |
A matrix containing the p-values for differential expression of transcription factors (rows) in each cluster (columns)
example(build_domino, echo = FALSE) de_mat <- dom_de(pbmc_dom_built_tiny)
example(build_domino, echo = FALSE) de_mat <- dom_de(pbmc_dom_built_tiny)
A function to pull the parameters used when running build_domino()
from a domino object
dom_info(dom)
dom_info(dom)
dom |
a domino object that has been created with |
A list containing booleans for whether the object has been created and built and a list of the
build parameters that were used in build_domino()
to infer the signaling network
example(build_domino, echo = FALSE) build_details <- dom_info(pbmc_dom_built_tiny)
example(build_domino, echo = FALSE) build_details <- dom_info(pbmc_dom_built_tiny)
A function to pull linkages from a domino object
dom_linkages( dom, link_type = c("complexes", "receptor-ligand", "tf-target", "tf-receptor", "receptor", "incoming-ligand"), by_cluster = FALSE )
dom_linkages( dom, link_type = c("complexes", "receptor-ligand", "tf-target", "tf-receptor", "receptor", "incoming-ligand"), by_cluster = FALSE )
dom |
a domino object that has been created with |
link_type |
one value (out of "complexes", "receptor-ligand", "tf-target", "tf-receptor", "receptor", "incoming-ligand") used to select the desired type of linkage |
by_cluster |
a boolean to indicate whether the linkages should be returned overall or by cluster |
A list containing linkages between some combination of receptors, ligands, transcription factors, and clusters
example(build_domino, echo = FALSE) complexes <- dom_linkages(pbmc_dom_built_tiny, "complexes") tf_rec_by_cluster <- dom_linkages(pbmc_dom_built_tiny, "tf-receptor", TRUE)
example(build_domino, echo = FALSE) complexes <- dom_linkages(pbmc_dom_built_tiny, "complexes") tf_rec_by_cluster <- dom_linkages(pbmc_dom_built_tiny, "tf-receptor", TRUE)
This function collates all of the features, receptors, or ligands found in a
signaling network anywhere in a list of clusters. This can be useful for
comparing signaling networks across two separate conditions. In order to run
this build_domino()
must be run on the object previously.
dom_network_items(dom, clusters = NULL, return = NULL)
dom_network_items(dom, clusters = NULL, return = NULL)
dom |
a domino object containing a signaling network (i.e. |
clusters |
vector indicating clusters to collate network items from. If left as NULL then all clusters will be included. |
return |
string indicating whether to collate "features", "receptors", or "ligands". If "all" then a list of all three will be returned. |
A vector containing all features, receptors, or ligands in the data set or a list containing all three.
example(build_domino, echo = FALSE) monocyte_receptors <- dom_network_items(pbmc_dom_built_tiny, "CD14_monocyte", "receptors") all_tfs <- dom_network_items(pbmc_dom_built_tiny, return = "features")
example(build_domino, echo = FALSE) monocyte_receptors <- dom_network_items(pbmc_dom_built_tiny, "CD14_monocyte", "receptors") all_tfs <- dom_network_items(pbmc_dom_built_tiny, return = "features")
A function to pull signaling matrices from a domino object
dom_signaling(dom, cluster = NULL)
dom_signaling(dom, cluster = NULL)
dom |
a domino object that has been created with |
cluster |
either NULL to indicate global signaling or a specific cluster for which a signaling matrix is desired |
A data frame containing the signaling score through each ligand (row) by each cluster (column) OR a data frame containing the global summed signaling scores between receptors (rows) and ligands (columns) of each cluster
example(build_domino, echo = FALSE) monocyte_signaling <- dom_signaling(pbmc_dom_built_tiny, cluster = "CD14_monocyte")
example(build_domino, echo = FALSE) monocyte_signaling <- dom_signaling(pbmc_dom_built_tiny, cluster = "CD14_monocyte")
A function to pull transcription factor activation scores from a domino object
dom_tf_activation(dom)
dom_tf_activation(dom)
dom |
a domino object that has been created with |
A matrix containing the transcription factor activation scores for each TF (row) by cell (column)
example(build_domino, echo = FALSE) tf_activation <- dom_tf_activation(pbmc_dom_built_tiny)
example(build_domino, echo = FALSE) tf_activation <- dom_tf_activation(pbmc_dom_built_tiny)
A function to pull z-scored expression from a domino object
dom_zscores(dom)
dom_zscores(dom)
dom |
a domino object that has been created with |
A matrix containing the z-scored gene expression values for each gene (row) by cell (column)
example(build_domino, echo = FALSE) zscores <- dom_zscores(pbmc_dom_built_tiny)
example(build_domino, echo = FALSE) zscores <- dom_zscores(pbmc_dom_built_tiny)
The domino class contains all information necessary to calculate receptor-ligand signaling. It contains z-scored expression, cell cluster labels, feature values, and a referenced receptor-ligand database formatted as a receptor-ligand map. Calculated intermediate values are also stored.
An instance of class domino
db_info
List of data sets from ligand - receptor database
counts
Raw count gene expression data
z_scores
Matrix of z-scored expression data with cells as columns
clusters
Named factor with cluster identity of each cell
features
Matrix of features (TFs) to correlate receptor - ligand expression with. Cells are columns and features are rows.
cor
Correlation matrix of receptor expression to features.
linkages
List of lists containing info linking cluster->tf->rec->lig
clust_de
Data frame containing differential expression results for features by cluster.
misc
List of miscellaneous info pertaining to run parameters etc.
cl_signaling_matrices
Incoming signaling matrix for each cluster
signaling
Signaling matrix between all clusters.
Creates a heatmap of transcription factor activation scores by cells grouped by cluster.
feat_heatmap( dom, feats = NULL, bool = FALSE, bool_thresh = 0.2, title = TRUE, norm = FALSE, cols = NULL, ann_cols = TRUE, min_thresh = NULL, max_thresh = NULL, ... )
feat_heatmap( dom, feats = NULL, bool = FALSE, bool_thresh = 0.2, title = TRUE, norm = FALSE, cols = NULL, ann_cols = TRUE, min_thresh = NULL, max_thresh = NULL, ... )
dom |
Domino object with network built ( |
feats |
Either a vector of features to include in the heatmap or 'all' for all features. If left NULL then the features selected for the signaling network will be shown. |
bool |
Boolean indicating whether the heatmap should be continuous or boolean. If boolean then bool_thresh will be used to determine how to define activity as positive or negative. |
bool_thresh |
Numeric indicating the threshold separating 'on' or 'off' for feature activity if making a boolean heatmap. |
title |
Either a string to use as the title or a boolean describing whether to include a title. In order to pass the 'main' parameter to |
norm |
Boolean indicating whether or not to normalize the transcrption factors to their max value. |
cols |
Named vector of colors to annotate cells by cluster color. Values are taken as colors and names as cluster. If left as NULL then default ggplot colors will be generated. |
ann_cols |
Boolean indicating whether to include cell cluster as a column annotation. Colors can be defined with cols. If FALSE then custom annotations can be passed to |
min_thresh |
Minimum threshold for color scaling if not a boolean heatmap |
max_thresh |
Maximum threshold for color scaling if not a boolean heatmap |
... |
Other parameters to pass to |
A heatmap rendered to the active graphics device
#basic usage example(build_domino, echo = FALSE) feat_heatmap(pbmc_dom_built_tiny) #using thresholds feat_heatmap( pbmc_dom_built_tiny, min_thresh = 0.1, max_thresh = 0.6, norm = TRUE, bool = FALSE)
#basic usage example(build_domino, echo = FALSE) feat_heatmap(pbmc_dom_built_tiny) #using thresholds feat_heatmap( pbmc_dom_built_tiny, min_thresh = 0.1, max_thresh = 0.6, norm = TRUE, bool = FALSE)
Create a gene association network for genes from a given cluster. The selected cluster acts as the receptor for the gene association network, so only ligands, receptors, and features associated with the receptor cluster will be included in the plot.
gene_network( dom, clust = NULL, OutgoingSignalingClust = NULL, class_cols = c(lig = "#FF685F", rec = "#47a7ff", feat = "#39C740"), cols = NULL, lig_scale = 1, layout = "grid", ... )
gene_network( dom, clust = NULL, OutgoingSignalingClust = NULL, class_cols = c(lig = "#FF685F", rec = "#47a7ff", feat = "#39C740"), cols = NULL, lig_scale = 1, layout = "grid", ... )
dom |
Domino object with network built ( |
clust |
Receptor cluster to create the gene association network for. A vector of clusters may be provided. |
OutgoingSignalingClust |
Vector of clusters to plot the outgoing signaling from |
class_cols |
Named vector of colors used to color classes of vertices. Values must be colors and names must be classes ('rec', 'lig', and 'feat' for receptors, ligands, and features.). |
cols |
Named vector of colors for individual genes. Genes not included in this vector will be colored according to class_cols. |
lig_scale |
FALSE or a numeric value to scale the size of ligand vertices based on z-scored expression in the data set. |
layout |
Type of layout to use. Options are 'grid', 'random', 'sphere', 'circle', 'fr' for Fruchterman-Reingold force directed layout, and 'kk' for Kamada Kawai for directed layout. |
... |
Other parameters to pass to plot() with an igraph object. See igraph manual for options. |
An igraph plot rendered to the active graphics device
#basic usage example(build_domino, echo = FALSE) gene_network( pbmc_dom_built_tiny, clust = "CD8_T_cell", OutgoingSignalingClust = "CD14_monocyte")
#basic usage example(build_domino, echo = FALSE) gene_network( pbmc_dom_built_tiny, clust = "CD8_T_cell", OutgoingSignalingClust = "CD14_monocyte")
Creates a heatmap of a cluster incoming signaling matrix. Each cluster has a list of ligands capable of activating its enriched transcription factors. The function creates a heatmap of cluster average expression for all of those ligands. A list of all cluster incoming signaling matrices can be found in the cl_signaling_matrices slot of a domino option as an alternative to this plotting function.
incoming_signaling_heatmap( dom, rec_clust, clusts = NULL, min_thresh = -Inf, max_thresh = Inf, scale = "none", normalize = "none", title = TRUE, ... )
incoming_signaling_heatmap( dom, rec_clust, clusts = NULL, min_thresh = -Inf, max_thresh = Inf, scale = "none", normalize = "none", title = TRUE, ... )
dom |
Domino object with network built ( |
rec_clust |
Which cluster to select as the receptor. Must match naming of clusters in the domino object. |
clusts |
Vector of clusters to be included. If NULL then all clusters are used. |
min_thresh |
Minimum signaling threshold for plotting. Defaults to -Inf for no threshold. |
max_thresh |
Maximum signaling threshold for plotting. Defaults to Inf for no threshold. |
scale |
How to scale the values (after thresholding). Options are 'none', 'sqrt' for square root, or 'log' for log10. |
normalize |
Options to normalize the matrix. Accepted inputs are 'none' for no normalization, 'rec_norm' to normalize to the maximum value with each receptor cluster, or 'lig_norm' to normalize to the maximum value within each ligand cluster |
title |
Either a string to use as the title or a boolean describing whether to include a title. In order to pass the 'main' parameter to |
... |
Other parameters to pass to |
a Heatmap rendered to the active graphics device
example(build_domino, echo = FALSE) #incoming signaling of the CD8 T cells incoming_signaling_heatmap(pbmc_dom_built_tiny, "CD8_T_cell")
example(build_domino, echo = FALSE) #incoming signaling of the CD8 T cells incoming_signaling_heatmap(pbmc_dom_built_tiny, "CD8_T_cell")
The linkage summary class contains linkages established in multiple domino objects through gene regulatory network inference and reference to receptor- ligand data bases. A data frame summarizing meta features that describe the domino objects compared in the linkage summary facilitates comparisons of established linkages and differential signaling interactions across categorical sample covariates.
an instance of class linkage_summary
subject_names
unique names for each domino result included in the summary
subject_meta
data.frame with each row describing one subject and columns describing features of the subjects by which to draw comparisons of signaling networks
subject_linkages
nested list of linkages inferred for each subject. Lists are stored in a heirarchical structure of subject-cluster-linkage where linkages include transcription factors (tfs), linkages between transcription factors and receptors (tfs_rec), active receptors (rec), possible receptor-ligand interactions (rec_lig), and incoming ligands (incoming_lig)
Creates a data frame of mean ligand expression for use in plotting a circos plot of ligand expression and saving tables of mean expression. us
mean_ligand_expression(x, ligands, cell_ident, cell_barcodes, destination)
mean_ligand_expression(x, ligands, cell_ident, cell_barcodes, destination)
x |
Gene by cell expression matrix |
ligands |
Character vector of ligand genes to be quantified |
cell_ident |
Vector of cell type (identity) names for which to calculate mean ligand gene expression |
cell_barcodes |
Vector of cell barcodes (colnames of x) belonging to cell_ident to calculate mean expression across |
destination |
Name of the receptor with which each ligand interacts |
A data frame of ligand expression targeting the specified receptor
example(build_domino, echo = FALSE) counts <- dom_counts(pbmc_dom_built_tiny) mean_exp <- mean_ligand_expression(counts, ligands = c("PTPRC", "FASLG"), cell_ident = "CD14_monocyte", cell_barcodes = colnames(counts), destination = "FAS")
example(build_domino, echo = FALSE) counts <- dom_counts(pbmc_dom_built_tiny) mean_exp <- mean_ligand_expression(counts, ligands = c("PTPRC", "FASLG"), cell_ident = "CD14_monocyte", cell_barcodes = colnames(counts), destination = "FAS")
Create a mock linkage summary object
mock_linkage_summary()
mock_linkage_summary()
obj a linkage summary object
A subset of the results of PBMC RNA-seq data.
data("PBMC")
data("PBMC")
A list of::
A subset of PBMC RNA-seq data: counts assay
A subset of PBMC RNA-seq data: zscore assay
A subset of PBMC RNA-seq data: clusters as defined by cell_type
https://zenodo.org/records/10951634/files/pbmc3k_sce.rds
Plot differential linkages among domino results ranked by a comparative statistic
plot_differential_linkages( differential_linkages, test_statistic, stat_range = c(0, 1), stat_ranking = c("ascending", "descending"), group_palette = NULL )
plot_differential_linkages( differential_linkages, test_statistic, stat_range = c(0, 1), stat_ranking = c("ascending", "descending"), group_palette = NULL )
differential_linkages |
a data frame output from the |
test_statistic |
column name of differential_linkages where the test statistic used for ranking linkages is stored (ex. 'p.value') |
stat_range |
a two value vector of the minimum and maximum values of test_statistic for plotting linkage features |
stat_ranking |
'ascending' (lowest value of test statisic is colored red and plotted at the top) or 'descending' (highest value of test statistic is colored red and plotted at the top). |
group_palette |
a named vector of colors to use for each group being compared |
A heatmap-class object of features ranked by test_statistic annotated with the proportion of subjects that showed active linkage of the features.
example(build_domino, echo = FALSE) example(test_differential_linkages, echo = FALSE) plot_differential_linkages( differential_linkages = tiny_differential_linkage_c1, test_statistic = "p.value", stat_ranking = "ascending" )
example(build_domino, echo = FALSE) example(test_differential_linkages, echo = FALSE) plot_differential_linkages( differential_linkages = tiny_differential_linkage_c1, test_statistic = "p.value", stat_ranking = "ascending" )
Prints a summary of a domino object
## S4 method for signature 'domino' print(x, ...)
## S4 method for signature 'domino' print(x, ...)
x |
A domino object |
... |
Additional arguments to be passed to other methods |
A printed description of the number of cells and clusters in the domino object
example(build_domino, echo = FALSE) print(pbmc_dom_built_tiny)
example(build_domino, echo = FALSE) print(pbmc_dom_built_tiny)
This function renames the clusters used to build a domino object
rename_clusters(dom, clust_conv, warning = FALSE)
rename_clusters(dom, clust_conv, warning = FALSE)
dom |
a domino object to rename clusters in |
clust_conv |
named vector of conversions from old to new clusters. Values are taken as new clusters IDs and names as old cluster IDs. |
warning |
logical. If TRUE, will warn if a cluster is not found in the conversion table. Default is FALSE. |
A domino object with clusters renamed in all applicable slots.
example(build_domino, echo = FALSE) new_clust <- c("CD8_T_cell" = "CD8+ T Cells", "CD14_monocyte" = "CD14+ Monocytes", "B_cell" = "B Cells") pbmc_dom_built_tiny <- rename_clusters(pbmc_dom_built_tiny, new_clust)
example(build_domino, echo = FALSE) new_clust <- c("CD8_T_cell" = "CD8+ T Cells", "CD14_monocyte" = "CD14+ Monocytes", "B_cell" = "B Cells") pbmc_dom_built_tiny <- rename_clusters(pbmc_dom_built_tiny, new_clust)
A subset of SCENIC AUCs as applied to PBMC data.
data("SCENIC")
data("SCENIC")
A list of:
A subset of SCENIC AUCs
A subset of SCENIC regulons
https://zenodo.org/records/10951634/files
Shows content overview of domino object
## S4 method for signature 'domino' show(object)
## S4 method for signature 'domino' show(object)
object |
A domino object |
A printed description of cell numbers and clusters in the object
example(build_domino, echo = FALSE) show(pbmc_dom_built_tiny)
example(build_domino, echo = FALSE) show(pbmc_dom_built_tiny)
Creates a heatmap of the signaling network. Alternatively, the network
matrix can be accessed directly in the signaling slot of a domino object using
the dom_signaling()
function.
signaling_heatmap( dom, clusts = NULL, min_thresh = -Inf, max_thresh = Inf, scale = "none", normalize = "none", ... )
signaling_heatmap( dom, clusts = NULL, min_thresh = -Inf, max_thresh = Inf, scale = "none", normalize = "none", ... )
dom |
domino object with network built ( |
clusts |
vector of clusters to be included. If NULL then all clusters are used. |
min_thresh |
minimum signaling threshold for plotting. Defaults to -Inf for no threshold. |
max_thresh |
maximum signaling threshold for plotting. Defaults to Inf for no threshold. |
scale |
how to scale the values (after thresholding). Options are 'none', 'sqrt' for square root, or 'log' for log10. |
normalize |
options to normalize the matrix. Normalization is done after thresholding and scaling. Accepted inputs are 'none' for no normalization, 'rec_norm' to normalize to the maximum value with each receptor cluster, or 'lig_norm' to normalize to the maximum value within each ligand cluster |
... |
other parameters to pass to |
A heatmap rendered to the active graphics device
example(build_domino, echo = FALSE) #basic usage signaling_heatmap(pbmc_dom_built_tiny) #scale signaling_heatmap(pbmc_dom_built_tiny, scale = "sqrt") #normalize signaling_heatmap(pbmc_dom_built_tiny, normalize = "rec_norm")
example(build_domino, echo = FALSE) #basic usage signaling_heatmap(pbmc_dom_built_tiny) #scale signaling_heatmap(pbmc_dom_built_tiny, scale = "sqrt") #normalize signaling_heatmap(pbmc_dom_built_tiny, normalize = "rec_norm")
Creates a network diagram of signaling between clusters. Nodes are clusters and directed edges indicate signaling from one cluster to another. Edges are colored based on the color scheme of the ligand expressing cluster
signaling_network( dom, cols = NULL, edge_weight = 0.3, clusts = NULL, showOutgoingSignalingClusts = NULL, showIncomingSignalingClusts = NULL, min_thresh = -Inf, max_thresh = Inf, normalize = "none", scale = "sq", layout = "circle", scale_by = "rec_sig", vert_scale = 3, plot_title = NULL, ... )
signaling_network( dom, cols = NULL, edge_weight = 0.3, clusts = NULL, showOutgoingSignalingClusts = NULL, showIncomingSignalingClusts = NULL, min_thresh = -Inf, max_thresh = Inf, normalize = "none", scale = "sq", layout = "circle", scale_by = "rec_sig", vert_scale = 3, plot_title = NULL, ... )
dom |
a domino object with network built ( |
cols |
named vector indicating the colors for clusters. Values are colors and names must match clusters in the domino object. If left as NULL then ggplot colors are generated for the clusters |
edge_weight |
weight for determining thickness of edges on plot. Signaling values are multiplied by this value |
clusts |
vector of clusters to be included in the network plot |
showOutgoingSignalingClusts |
vector of clusters to plot the outgoing signaling from |
showIncomingSignalingClusts |
vector of clusters to plot the incoming signaling on |
min_thresh |
minimum signaling threshold. Values lower than the threshold will be set to the threshold. Defaults to -Inf for no threshold |
max_thresh |
maximum signaling threshold for plotting. Values higher than the threshold will be set to the threshold. Defaults to Inf for no threshold |
normalize |
options to normalize the signaling matrix. Accepted inputs are 'none' for no normalization, 'rec_norm' to normalize to the maximum value with each receptor cluster, or 'lig_norm' to normalize to the maximum value within each ligand cluster |
scale |
how to scale the values (after thresholding). Options are 'none', 'sqrt' for square root, 'log' for log10, or 'sq' for square |
layout |
type of layout to use. Options are 'random', 'sphere', 'circle', 'fr' for Fruchterman-Reingold force directed layout, and 'kk' for Kamada Kawai for directed layout |
scale_by |
how to size vertices. Options are 'lig_sig' for summed outgoing signaling, 'rec_sig' for summed incoming signaling, and 'none'. In the former two cases the values are scaled with asinh after summing all incoming or outgoing signaling |
vert_scale |
integer used to scale size of vertices with our without variable scaling from size_verts_by. |
plot_title |
text for the plot's title. |
... |
other parameters to be passed to plot when used with an igraph object. |
An igraph plot rendered to the active graphics device
example(build_domino, echo = FALSE) #basic usage signaling_network(pbmc_dom_built_tiny, edge_weight = 2) # scaling, thresholds, layouts, selecting clusters signaling_network( pbmc_dom_built_tiny, showOutgoingSignalingClusts = "CD14_monocyte", scale = "none", norm = "none", layout = "fr", scale_by = "none", vert_scale = 5, edge_weight = 2)
example(build_domino, echo = FALSE) #basic usage signaling_network(pbmc_dom_built_tiny, edge_weight = 2) # scaling, thresholds, layouts, selecting clusters signaling_network( pbmc_dom_built_tiny, showOutgoingSignalingClusts = "CD14_monocyte", scale = "none", norm = "none", layout = "fr", scale_by = "none", vert_scale = 5, edge_weight = 2)
Creates a linkage_summary()
object storing the linkages learned in different domino objects as nested lists to facilitate comparisons of networks learned by domino across subject covariates.
summarize_linkages(domino_results, subject_meta, subject_names = NULL)
summarize_linkages(domino_results, subject_meta, subject_names = NULL)
domino_results |
list of domino result with one domino object per subject. Names from the list must match subject_names |
subject_meta |
data frame that includes the subject features by which the objects could be grouped. The first column should must be subject names |
subject_names |
vector of subject names in domino_results. If NULL, defaults to first column of subject_meta. |
A linkage summary class object consisting of nested lists of the active transcription factors, active receptors, and incoming ligands for each cluster across multiple domino results
example(build_domino, echo = FALSE) #create alternative clustering by shuffling cluster assignments clusters_tiny_alt <- setNames( PBMC$clusters_tiny[c(121:240, 1:120, 241:360)], names(PBMC$clusters_tiny) ) clusters_tiny_alt <- as.factor(clusters_tiny_alt) #build an alternative domino object pbmc_dom_tiny_alt <- create_domino( rl_map = rl_map_tiny, features = SCENIC$auc_tiny, counts = PBMC$RNA_count_tiny, z_scores = PBMC$RNA_zscore_tiny, clusters = clusters_tiny_alt, tf_targets = regulon_list_tiny, use_clusters = TRUE, use_complexes = TRUE, remove_rec_dropout = FALSE ) pbmc_dom_built_tiny_alt <- build_domino( dom = pbmc_dom_tiny_alt, min_tf_pval = .05, max_tf_per_clust = Inf, max_rec_per_tf = Inf, rec_tf_cor_threshold = .1, min_rec_percentage = 0.01 ) #create a list of domino objects dom_ls <- list( dom1 = pbmc_dom_built_tiny, dom2 = pbmc_dom_built_tiny_alt ) #compare the linkages across the two domino objects meta_df <- data.frame("ID" = c("dom1", "dom2"), "group" = c("A", "B")) summarize_linkages( domino_results = dom_ls, subject_meta = meta_df, subject_names = meta_df$ID )
example(build_domino, echo = FALSE) #create alternative clustering by shuffling cluster assignments clusters_tiny_alt <- setNames( PBMC$clusters_tiny[c(121:240, 1:120, 241:360)], names(PBMC$clusters_tiny) ) clusters_tiny_alt <- as.factor(clusters_tiny_alt) #build an alternative domino object pbmc_dom_tiny_alt <- create_domino( rl_map = rl_map_tiny, features = SCENIC$auc_tiny, counts = PBMC$RNA_count_tiny, z_scores = PBMC$RNA_zscore_tiny, clusters = clusters_tiny_alt, tf_targets = regulon_list_tiny, use_clusters = TRUE, use_complexes = TRUE, remove_rec_dropout = FALSE ) pbmc_dom_built_tiny_alt <- build_domino( dom = pbmc_dom_tiny_alt, min_tf_pval = .05, max_tf_per_clust = Inf, max_rec_per_tf = Inf, rec_tf_cor_threshold = .1, min_rec_percentage = 0.01 ) #create a list of domino objects dom_ls <- list( dom1 = pbmc_dom_built_tiny, dom2 = pbmc_dom_built_tiny_alt ) #compare the linkages across the two domino objects meta_df <- data.frame("ID" = c("dom1", "dom2"), "group" = c("A", "B")) summarize_linkages( domino_results = dom_ls, subject_meta = meta_df, subject_names = meta_df$ID )
Statistical test for differential linkages across multiple domino results
test_differential_linkages( linkage_summary, cluster, group.by, linkage = "rec_lig", subject_names = NULL, test_name = "fishers.exact" )
test_differential_linkages( linkage_summary, cluster, group.by, linkage = "rec_lig", subject_names = NULL, test_name = "fishers.exact" )
linkage_summary |
a |
cluster |
the name of the cell cluster being compared across multiple domino results |
group.by |
the name of the column in |
linkage |
a stored linkage from the domino object. Can compare any of 'tfs', 'rec', 'incoming_lig', 'tfs_rec', or 'rec_lig' |
subject_names |
a vector of subject_names from the linkage_summary to be compared. If NULL, all subject_names in the linkage summary are included in counting. |
test_name |
the statistical test used for comparison.
|
A data frame of results from the test of the differential linkages. Rows correspond to each linkage tested. Columns correspond to:
'cluster' : the name of the cell cluster being compared
'linkage' : the type of linkage being compared
'group.by' : the grouping variable
'test_name' : the test used for comparison
'feature' : individual linkages compared
'test statistics' : test statistics provided are based on test method. 'fishers.exact' provides a odds ratio, p-value, and fdr-adjusted p-value.
'total_count' : total number of subjects where the linkage is active
'X_count' : number of subjects in each category of group.by (X) where the linkage is active
'total_n' : number of total subjects compared
'X_n' : total number of subjects in each category of group.by (X)
tiny_differential_linkage_c1 <- test_differential_linkages( linkage_summary = mock_linkage_summary(), cluster = "C1", group.by = "group", linkage = "rec", test_name = "fishers.exact" )
tiny_differential_linkage_c1 <- test_differential_linkages( linkage_summary = mock_linkage_summary(), cluster = "C1", group.by = "group", linkage = "rec", test_name = "fishers.exact" )