Skip to content

Commit

Permalink
Merge pull request #127 from FertigLab/krishnan_rmd_fix_134
Browse files Browse the repository at this point in the history
fixing broken links and other rmarkdown rendering issues
  • Loading branch information
jmitchell81 authored Jun 25, 2024
2 parents 8bb1db7 + 8130d79 commit 5bf6447
Show file tree
Hide file tree
Showing 158 changed files with 1,605 additions and 1,193 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

Expand All @@ -41,7 +41,7 @@ jobs:

- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4.4.1
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
clean: false
branch: gh-pages
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Authors@R: c(
person("Jennifer", "Elisseeff", role = "ctb", email = "[email protected]", comment = c(ORCID = "0000-0002-5066-1996"))
)
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.
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.
BugReports: https://github.com/FertigLab/dominoSignal/issues
Depends:
R(>= 4.2.0),
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export(summarize_linkages)
export(test_differential_linkages)
exportClasses(domino)
exportClasses(linkage_summary)
exportMethods(print)
exportMethods(show)
import(ComplexHeatmap)
import(biomaRt)
import(circlize)
Expand Down
12 changes: 6 additions & 6 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

## Bioconductor Standards

- Update to Vignettes presenting application of the DominoSignal pipeline on data formatted as a SingleCellExperiment object
- Update to vignettes presenting application of the DominoSignal pipeline on data formatted as a SingleCellExperiment object
- Implemented caching of example data by BiocCache to meet package size limits
- Removal of depreciated scripts for running SCENIC. Tutorials for running SCENIC are still present in vignettes
- Removal of deprecated scripts for running SCENIC. Tutorials for running SCENIC are still present in vignettes
- Corrected BiocCheck notes pertaining to coding practices including paste in conditional statements, functions with dontrun examples, usage of seq_len or seq_along in place of seq, and usage of vapply in place of sapply


Expand All @@ -24,17 +24,17 @@
- Plotting function for differential linkages

## Package structure
- Adjustments made to meet BioConductor standards
- Adjustments made to meet Bioconductor standards

# dominoSignal v0.2.1

## Updates to domino object construction
- Uniform formats for inputs of receptor-ligand interaction databases, transcription factor activity features, and regulon gene lists for operability with alternative databases and transcription factor activation inference methods
- Uniform formats for inputs of receptor - ligand interaction databases, transcription factor activity features, and regulon gene lists for operability with alternative databases and transcription factor activation inference methods
- Helper functions for reformatting pySCENIC outputs and CellPhoneDB database files to domino-readable uniform formats
- Assessment of transcription factor linkage with receptors that function as a heteromeric complex based on correlation between transcription factor activity and all receptor component genes
- Assessment of complex ligand expression as the mean of component gene expression for plotting functions
- Minimum threshold for the percentage of cells in a cluster expressing a receptor gene for the receptor to be called active within the cluster
- Additional linkage slots for active receptors in each cluster, transcription factor-receptor linkages for each cluster, and incoming ligands for active receptors on each cluster
- Additional linkage slots for active receptors in each cluster, transcription factor - receptor linkages for each cluster, and incoming ligands for active receptors on each cluster

## Plotting functions
- Chord plot of ligand expression targeting a specified receptor where chord widths correspond to the quantity of ligand expression by each cell cluster
Expand All @@ -43,7 +43,7 @@

## Bugfixes
- Added host option for gene ortholog conversions using `{biomaRt}` for access to maintained mirrors
- Transcription factor-target linkages are now properly stored so that receptors in a transcription factor's regulon are excluded from linkage
- Transcription factor - target linkages are now properly stored so that receptors in a transcription factor's regulon are excluded from linkage
- Ligand nodes sizes in gene networks correspond to quantity of ligand expression
- `create_domino()` can be run without providing a regulon list
- References to the host GitHub repository have been updated to [Elisseeff-Lab](https://github.com/Elisseeff-Lab/domino)
33 changes: 17 additions & 16 deletions R/class_definitions.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
#' @importClassesFrom Matrix dgCMatrix
#'
NULL
#' The domino Class
#' The domino class
#'
#' 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.
#'
#' @slot db_info List of data sets from lr database.
#' @slot db_info List of data sets from ligand - receptor database
#' @slot counts Raw count gene expression data
#' @slot z_scores Matrix of z-scored expression data with cells as columns
#' @slot clusters Named factor with cluster identity of each cell
#' @slot features Matrix of features to correlate receptor-ligand expression with. Cells are columns and features are rows.
#' @slot features Matrix of features (TFs) to correlate receptor - ligand expression with. Cells are columns and features are rows.
#' @slot cor Correlation matrix of receptor expression to features.
#' @slot linkages List of lists containing info linking cluster->tf->rec->lig
#' @slot clust_de Data frame containing differential expression results for features by cluster.
Expand All @@ -23,7 +23,7 @@ NULL
#' @name domino-class
#' @rdname domino-class
#' @exportClass domino
#' @return an instance of class `domino `
#' @return An instance of class `domino `
#'
domino <- methods::setClass(
Class = "domino",
Expand Down Expand Up @@ -74,22 +74,23 @@ linkage_summary <- setClass(
#'
#' Prints a summary of a domino object
#'
#' @param x Domino object
#' @return a printed description of the number of cell clusters in the object
#' @keywords internal
#' @param x A domino object
#' @param ... Additional arguments to be passed to other methods
#' @return A printed description of the number of cells and clusters in the domino object
#' @export
#' @examples
#' print(dominoSignal:::pbmc_dom_built_tiny)
#'
setMethod("print", "domino", function(x, ...) {
if (x@misc$build) {
message(
"A domino object of ", length(x@clusters), " cells
Contains signaling between",
length(levels(x@clusters)), "clusters
Built with a maximum of", as.integer(x@misc$build_vars["max_tf_per_clust"]),
"TFs per cluster
and a maximum of", as.integer(x@misc$build_vars["max_rec_per_tf"]),
"receptors per TF\n"
Contains signaling between ",
length(levels(x@clusters)), " clusters
Built with a maximum of ", x@misc$build_vars["max_tf_per_clust"],
" TFs per cluster
and a maximum of ", x@misc$build_vars["max_rec_per_tf"],
" receptors per TF\n"
)
} else {
message(c("A domino object of ", length(x@clusters), " cells\n", "A signaling network has not been built\n"),
Expand All @@ -101,9 +102,9 @@ setMethod("print", "domino", function(x, ...) {
#'
#' Shows content overview of domino object
#'
#' @param object Domino object
#' @return a printed description of the number of cells in a domino object and its build status
#' @keywords internal
#' @param object A domino object
#' @return A printed description of cell numbers and clusters in the object
#' @export
#' @examples
#' dominoSignal:::pbmc_dom_built_tiny
#'
Expand Down
28 changes: 11 additions & 17 deletions R/convenience_fxns.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@ NULL

#' Renames clusters in a domino object
#'
#' 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.
#' This function renames the clusters used to build a domino object
#'
#' @param dom Domino object to rename clusters in
#' @param clust_conv Named vector of conversions from old to new clusters. Values are taken as new clusters IDs and names as old cluster IDs.
#' @param warning Logical. If TRUE, will warn if a cluster is not found in the conversion table. Default is FALSE.
#' @param dom a domino object to rename clusters in
#' @param clust_conv named vector of conversions from old to new clusters. Values are taken as new clusters IDs and names as old cluster IDs.
#' @param warning logical. If TRUE, will warn if a cluster is not found in the conversion table. Default is FALSE.
#' @return A domino object with clusters renamed in all applicable slots.
#' @export
#' @examples
Expand Down Expand Up @@ -73,17 +67,17 @@ rename_clusters <- function(dom, clust_conv, warning = FALSE) {
}


#' Convert Genes Using Table
#' Convert genes using a table
#'
#' Takes a vector of gene inputs and a conversion table and returns a
#' Takes a vector of gene inputs and a conversion table and returns a
#' converted gene table
#'
#' @param genes The genes to convert.
#' @param from Gene symbol type of the input (ENSG, ENSMUSG, HGNC, MGI)
#' @param to Desired gene symbol type for the output (HGNC, MGI)
#' @param conversion_table A data.frame with column names corresponding to gene symbol types (mm.ens, hs.ens, mgi, hgnc)
#' @param genes the genes to convert
#' @param from gene symbol type of the input (ENSG, ENSMUSG, HGNC, MGI)
#' @param to desired gene symbol type for the output (HGNC, MGI)
#' @param conversion_table a data frame with column names corresponding to gene symbol types (mm.ens, hs.ens, mgi, hgnc)
#' and rows corresponding to the gene symbols themselves
#' @return Data frame of genes with original and corresponding converted symbols
#' @return A data frame of genes with original and corresponding converted symbols
#' @keywords internal
#'
table_convert_genes <- function(genes, from, to, conversion_table) {
Expand Down
24 changes: 12 additions & 12 deletions R/differential_fxns.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ NULL

#' Summarize linkages from multiple domino objects
#'
#' 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.
#' 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.
#'
#' @param domino_results list of domino result with one domino object per subject. Names from the list must match subject_names.
#' @param subject_meta dataframe that includes the subject features by which the objects could be grouped. The first column should must be subject names
#' @param domino_results list of domino result with one domino object per subject. Names from the list must match subject_names
#' @param subject_meta data frame that includes the subject features by which the objects could be grouped. The first column should must be subject names
#' @param subject_names vector of subject names in domino_results. If NULL, defaults to first column of subject_meta.
#' @return 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.
#' @return 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
#' @export
#' @examples
#' dom_ls <- dominoSignal:::dom_ls_tiny
Expand Down Expand Up @@ -99,12 +99,12 @@ summarize_linkages <- function(domino_results, subject_meta, subject_names = NUL
#'
#' Count occurrences of linkages across multiple domino results from a linkage summary
#'
#' @param linkage_summary a linkage_summary object
#' @param linkage_summary a [linkage_summary()] object
#' @param cluster the name of the cell cluster being compared across multiple domino results
#' @param group.by the name of the column in linkage_summary\@subject_meta by which to group subjects for counting. If NULL, only total counts of linkages for linkages in the cluster across all subjects is given.
#' @param linkage a stored linkage from the domino object. Can compare ('tfs', 'rec', 'incoming_lig', 'tfs_rec', 'rec_lig')
#' @param group.by the name of the column in `linkage_summary@subject_meta` by which to group subjects for counting. If NULL, only total counts of linkages for linkages in the cluster across all subjects is given.
#' @param linkage a stored linkage from the domino object. Can compare any of 'tfs', 'rec', 'incoming_lig', 'tfs_rec', or 'rec_lig'
#' @param 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.
#' @return 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.
#' @return 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.
#' @export
#' @examples
#' count_linkage(
Expand Down Expand Up @@ -145,16 +145,16 @@ count_linkage <- function(linkage_summary, cluster, group.by = NULL, linkage = "
#'
#' Statistical test for differential linkages across multiple domino results
#'
#' @param linkage_summary a linkage_summary object
#' @param linkage_summary a [linkage_summary()] object
#' @param cluster the name of the cell cluster being compared across multiple domino results
#' @param group.by the name of the column in linkage_summary\@subject_meta by which to group subjects for counting.
#' @param linkage a stored linkage from the domino object. Can compare ('tfs', 'rec', 'incoming_lig', 'tfs_rec', 'rec_lig')
#' @param group.by the name of the column in `linkage_summary@subject_meta` by which to group subjects for counting.
#' @param linkage a stored linkage from the domino object. Can compare any of 'tfs', 'rec', 'incoming_lig', 'tfs_rec', or 'rec_lig'
#' @param 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.
#' @param test_name the statistical test used for comparison.
#' \itemize{
#' \item{'fishers.exact'} : Fisher's exact test for the dependence of the proportion of subjects with an active linkage in the cluster on which group the subject belongs to in the group.by variable. Provides an odds ratio, p-value, and a Benjamini-Hochberg FDR-adjusted p-value (p.adj) for each linkage tested.
#' }
#' @return a data frame of results from the test of the differential linkages. Rows correspond to each linkage tested. Columns correspond to:
#' @return A data frame of results from the test of the differential linkages. Rows correspond to each linkage tested. Columns correspond to:
#' \itemize{
#' \item{'cluster'} : the name of the cell cluster being compared
#' \item{'linkage'} : the type of linkage being compared
Expand Down
21 changes: 11 additions & 10 deletions R/import_fxns.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#'
NULL

#' Create a receptor-ligand map from a cellphonedb signaling database
#' Create a receptor - ligand map from a CellPhoneDB signaling database
#'
#' 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.
#'
#' @param genes dataframe or file path to table of gene names in uniprot, hgnc_symbol, or ensembl format in cellphonedb database format
#' @param proteins dataframe or file path to table of protein features in cellphonedb format
#' @param interactions dataframe or file path to table of protein-protein interactions in cellphonedb format
#' @param complexes optional: dataframe or file path to table of protein complexes in cellphonedb format
#' @param genes data frame or file path to table of gene names in uniprot, hgnc_symbol, or ensembl format in CellPhoneDB database format
#' @param proteins data frame or file path to table of protein features in CellPhoneDB format
#' @param interactions data frame or file path to table of protein-protein interactions in CellPhoneDB format
#' @param complexes optional: data frame or file path to table of protein complexes in CellPhoneDB format
#' @param database_name name of the database being used, stored in output
#' @param gene_conv a tuple of (from, to) or (source, target) if gene conversion to orthologs is desired; options are ENSMUSG, ENSG, MGI, or HGNC
#' @param gene_conv_host host for conversion; default ensembl, could also use mirrors if desired
Expand Down Expand Up @@ -238,7 +238,7 @@ create_rl_map_cellphonedb <- function(
#'
#' Generates a list of transcription factors and the genes targeted by the transcription factor as part of their regulon inferred by pySCENIC
#'
#' @param regulons Dataframe or file path to the table of the output of the grn (gene regulatory network) function from pySCENIC
#' @param regulons Data frame or file path to the table of the output of the ctx function from pySCENIC
#' @return A list where names are transcription factors and the stored values are character vectors of genes in the inferred regulons
#' @export create_regulon_list_scenic
#' @examples
Expand Down Expand Up @@ -574,9 +574,9 @@ create_domino <- function(
#'
#' @param genes Vector of genes to convert.
#' @param from Format of gene input (ENSMUSG, ENSG, MGI, or HGNC)
#' @param to Format of gene output (MGI, or HGNC)
#' @param to Format of gene output (MGI or HGNC)
#' @param host Host to connect to. Defaults to https://www.ensembl.org following the useMart default, but can be changed to archived hosts if useMart fails to connect.
#' @return A data frame with input genes as col 1 and output as col 2
#' @return A data frame with input genes as column 1 and converted genes as column 2
#' @keywords internal
#'
convert_genes <- function(
Expand Down Expand Up @@ -662,11 +662,12 @@ add_rl_column <- function(map, map_ref, conv, new_name) {
new_map <- data.frame(new_map, stringsAsFactors = FALSE)
}

#' Calculate mean ligand expression as a data.frame for plotting in circos plot
#' Calculate mean ligand expression as a data frame for plotting in circos plot
#'
#' 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

#' @param x Gene by cell expression matrix
#' @param ligands Character vector of ligand genes to be quantified
#' @param cell_ident Vector of cell type (identity) names for which to calculate mean ligand gene expression
Expand Down
Loading

0 comments on commit 5bf6447

Please sign in to comment.