├── .Rbuildignore ├── .gitignore ├── DESCRIPTION ├── LICENSE ├── LICENSE.md ├── NAMESPACE ├── NEWS.md ├── R ├── boxplot_group_interaction.R ├── celltalk.R ├── circos_plot.R ├── compare_group_interactions.R ├── data.R └── utils.R ├── README.Rmd ├── README.md ├── data-raw ├── create_example_data.R ├── create_ramilowski_pairs_data.R ├── download_gene_expression_data.R └── filter_hca_bm_umap_cells.R ├── data ├── filtered_lig_rec.rda ├── hca_bm_umap_cell_types.rda ├── overall_metadata.rda ├── overall_umap.rda └── ramilowski_pairs.rda ├── docs ├── 404.html ├── LICENSE-text.html ├── LICENSE.html ├── articles │ ├── celltalker.html │ ├── celltalker_files │ │ ├── figure-html │ │ │ ├── setup-1.png │ │ │ └── setup-2.png │ │ └── header-attrs-2.9 │ │ │ └── header-attrs.js │ ├── consistent_interactions.html │ ├── consistent_interactions_files │ │ ├── figure-html │ │ │ ├── setup-1.png │ │ │ ├── unnamed-chunk-2-1.png │ │ │ ├── unnamed-chunk-2-2.png │ │ │ └── unnamed-chunk-3-1.png │ │ └── header-attrs-2.9 │ │ │ └── header-attrs.js │ └── index.html ├── authors.html ├── docsearch.css ├── docsearch.js ├── index.html ├── link.svg ├── news │ └── index.html ├── pkgdown.css ├── pkgdown.js ├── pkgdown.yml └── reference │ ├── boxplot_group_interaction.html │ ├── celltalk.html │ ├── circos_plot.html │ ├── compare_group_interactions.html │ ├── figures │ ├── README-example-1.png │ └── README-example-2.png │ ├── filtered_lig_rec.html │ ├── hca_bm_umap_cell_types.html │ ├── index.html │ ├── overall_metadata.html │ ├── overall_umap.html │ └── ramilowski_pairs.html ├── index.md ├── man ├── boxplot_group_interaction.Rd ├── celltalk.Rd ├── circos_plot.Rd ├── compare_group_interactions.Rd ├── figures │ ├── README-example-1.png │ └── README-example-2.png ├── filtered_lig_rec.Rd ├── hca_bm_umap_cell_types.Rd ├── overall_metadata.Rd ├── overall_umap.Rd └── ramilowski_pairs.Rd └── vignettes ├── .gitignore ├── celltalker.Rmd └── consistent_interactions.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^LICENSE\.md$ 2 | ^data-raw$ 3 | ^README\.Rmd$ 4 | ^docs$ 5 | ^index\.md$ 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # History files 2 | .Rhistory 3 | .Rapp.history 4 | 5 | # Session Data files 6 | .RData 7 | 8 | # User-specific files 9 | .Ruserdata 10 | 11 | # Example code in package build process 12 | *-Ex.R 13 | 14 | # Output files from R CMD build 15 | /*.tar.gz 16 | 17 | # Output files from R CMD check 18 | /*.Rcheck/ 19 | 20 | # RStudio files 21 | .Rproj.user/ 22 | 23 | # produced vignettes 24 | vignettes/*.html 25 | vignettes/*.pdf 26 | 27 | # OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3 28 | .httr-oauth 29 | 30 | # knitr and R markdown default cache directories 31 | *_cache/ 32 | /cache/ 33 | 34 | # Temporary files created by R markdown 35 | *.utf8.md 36 | *.knit.md 37 | 38 | # R Environment Variables 39 | .Renviron 40 | 41 | # Exclude raw data files under data-raw 42 | HD_* 43 | 44 | inst/doc 45 | 46 | # Other mac nonsense 47 | .DS_Store 48 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: celltalker 2 | Title: Analysis of cell-cell communication from single-cell RNAseq data 3 | Version: 0.0.7.9000 4 | Authors@R: 5 | person(given = "Anthony", 6 | family = "Cillo", 7 | role = c("aut", "cre"), 8 | email = "arc85@pitt.edu", 9 | comment = c(ORCID = "0000-0002-3213-3129")) 10 | Description: This package uses a count matrix and metadata generated by single-cell RNAseq to evaluate putative cell-cell communication. It does this by utilizing a list of interacting ligand and receptor pairs described in "A draft network of ligand-receptor-mediated multicellular signaling in human" (Ramilowski JA et al, Nature Communications 2015). Briefly, celltalker accomplishes this by building lists of expressed ligands and receptors across cell types and sample groups, then looks for cognate ligand/receptor expression within and between cell types. Methods are provided for visualization of unique and differentially expressed ligand and receptor interactions. 11 | License: MIT + file LICENSE 12 | Encoding: UTF-8 13 | LazyData: true 14 | Depends: 15 | R (>= 3.5.0) 16 | Imports: 17 | dplyr (>= 1.0.3), 18 | magrittr (>= 1.5), 19 | circlize (>= 0.4.6), 20 | Matrix (>= 1.2-18), 21 | tibble (>= 3.0.5), 22 | tidyr (>= 1.0.0), 23 | ggplot2 (>= 3.2.0), 24 | purrr (>= 0.3.3), 25 | rlang (>= 0.4.10) 26 | Suggests: 27 | knitr (>= 1.0), 28 | RColorBrewer (>= 1.1.0), 29 | rmarkdown (>= 1.0), 30 | Seurat (>= 2.3.0), 31 | testthat (>= 3.1.1), 32 | SeuratData (>= 0.2.1) 33 | VignetteBuilder: knitr 34 | RoxygenNote: 7.1.1 35 | Config/testthat/edition: 3 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2019 2 | COPYRIGHT HOLDER: Anthony R Cillo 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2019 Anthony R Cillo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | export(boxplot_group_interaction) 4 | export(celltalk) 5 | export(circos_plot) 6 | export(compare_group_interactions) 7 | importFrom(circlize,CELL_META) 8 | importFrom(circlize,circos.clear) 9 | importFrom(circlize,circos.initialize) 10 | importFrom(circlize,circos.link) 11 | importFrom(circlize,circos.par) 12 | importFrom(circlize,circos.rect) 13 | importFrom(circlize,circos.text) 14 | importFrom(circlize,circos.track) 15 | importFrom(dplyr,arrange) 16 | importFrom(dplyr,distinct) 17 | importFrom(dplyr,filter) 18 | importFrom(dplyr,group_by) 19 | importFrom(dplyr,group_split) 20 | importFrom(dplyr,left_join) 21 | importFrom(dplyr,mutate) 22 | importFrom(dplyr,pull) 23 | importFrom(dplyr,recode) 24 | importFrom(dplyr,select) 25 | importFrom(dplyr,summarize) 26 | importFrom(ggplot2,aes) 27 | importFrom(ggplot2,geom_boxplot) 28 | importFrom(ggplot2,geom_jitter) 29 | importFrom(ggplot2,ggplot) 30 | importFrom(ggplot2,theme_bw) 31 | importFrom(ggplot2,ylab) 32 | importFrom(magrittr,"%>%") 33 | importFrom(purrr,map) 34 | importFrom(rlang,.data) 35 | importFrom(stats,lm) 36 | importFrom(stats,sd) 37 | importFrom(tibble,as_tibble) 38 | importFrom(tidyr,gather) 39 | -------------------------------------------------------------------------------- /NEWS.md: -------------------------------------------------------------------------------- 1 | # celltalker 0.0.5.9000 2 | * Added new functionality to identify consistently different ligand receptor interactions when groups of samples are present 3 | * Added plotting functionality for specific ligand receptor interactions across groups of samples 4 | 5 | # celltalker 0.0.4.9000 6 | * Refactored celltalker to use a simpler interface for identifying top ligands and receptors between conditions 7 | * Built new code for circos plotting of ligand and receptor interactions 8 | * New vignette built using the 40,000 cell Human Cell Atlas Bone Marrow dataset 9 | 10 | # celltalker 0.0.3.9000 11 | * Updated celltalker to use the tidyverse and tibbles. Adds speed and ease of access to data. 12 | 13 | # celltalker 0.0.1.9000 14 | * Initial release of celltalker on github! Stay tuned for more updates soon. 15 | -------------------------------------------------------------------------------- /R/boxplot_group_interaction.R: -------------------------------------------------------------------------------- 1 | #' Create a boxplot of the joint mean score for a specific ligand receptor 2 | #' interaction between two groups of samples 3 | #' 4 | #' @param seurat_object Seurat object containing expression levels across all 5 | #' cells and sample types 6 | #' 7 | #' @param interaction_stats Tibble of interaction statistics from a sample group 8 | #' 9 | #' @param interaction_stats Tibble from celltalk function, usually filtered to 10 | #' the top significant ligand and receptor interactions of interest 11 | #' 12 | #' @param sample_replicates Name of the meta.data column in a Seurat object that 13 | #' has the samples of the individual replicate samples 14 | #' 15 | #' @param sample_groups Name of the meta.data column in a Seurat object that 16 | #' has the name of the sample group 17 | #' 18 | #' @param metadata_grouping Name of the meta.data column in a Seurat object that 19 | #' has the name of the groups of cells to evaluate (e.g. "cell_types" containing 20 | #' previously identified cell types) 21 | #' 22 | #' @param ligand Name of the ligand in the ligand/receptor pair of interest 23 | #' 24 | #' @param receptor Name of the receptor in the ligand/receptor pair of interest 25 | #' 26 | #' @param cell_type1 Name of the cell type expressing the ligand in the ligand/ 27 | #' receptor pair of interest 28 | #' 29 | #' @param cell_type2 Name of the cell type expressing the receptor in the ligand/ 30 | #' receptor pair of interest 31 | #' 32 | #' @return A ggplot boxplot of the joint mean for a ligand/receptor interaction 33 | #' in each sample group. 34 | #' 35 | #' @importFrom ggplot2 ggplot aes geom_boxplot geom_jitter theme_bw ylab 36 | #' 37 | #' @export 38 | 39 | boxplot_group_interaction <- function(seurat_object, 40 | interaction_stats, 41 | sample_replicates, 42 | sample_groups, 43 | metadata_grouping, 44 | ligand, 45 | receptor, 46 | cell_type1, 47 | cell_type2) { 48 | 49 | `Sample group` <- scores <- `.` <- NULL 50 | 51 | interactions_compare <- id_interactions(interaction_stats) 52 | 53 | extracted_sample_groups <- extract_sample_group_replicates(seurat_object,sample_groups,sample_replicates) 54 | 55 | replicate_scores_frame <- cell_type_lig_rec_frame(interactions_compare,seurat_object,sample_replicates,sample_groups,metadata_grouping) 56 | # Replace dots with dashes in column names 57 | colnames(replicate_scores_frame) <- gsub("\\.","-",colnames(replicate_scores_frame)) 58 | 59 | interaction_scores_frame <- cell_type_ligand_receptor_score(replicate_scores_frame,interactions_compare, 60 | extracted_sample_groups,sample_replicates,sample_groups) 61 | 62 | interaction_scores_frame %>% 63 | filter(cell_type1=={{cell_type1}}) %>% 64 | filter(cell_type2=={{cell_type2}}) %>% 65 | filter(ligand=={{ligand}}) %>% 66 | filter(receptor=={{receptor}}) %>% 67 | mutate(`Sample group`=sample_groups) %>% 68 | ggplot(.,aes(x=`Sample group`,y=scores,colour=`Sample group`)) + 69 | geom_boxplot(outlier.shape=NA) + 70 | geom_jitter(width=0.1,height=0) + 71 | theme_bw() + 72 | ylab("Joint ligand/receptor interaction") 73 | 74 | } 75 | -------------------------------------------------------------------------------- /R/celltalk.R: -------------------------------------------------------------------------------- 1 | #' Assess ligand and receptor interactions across groups of cells 2 | #' 3 | #' @param input_object Seurat object to create ligand receptor matrices from 4 | #' 5 | #' @param metadata_grouping Grouping variable in the Seurat object metadata used 6 | #' to define the groups of cells. Default is "cell_types". 7 | #' 8 | #' @param ligand_receptor_pairs Data.frame of ligands, receptors and 9 | #' interactions in the format of ramilowski_pairs provided by this package. 10 | #' Defaults is "ramilowski_pairs". 11 | #' 12 | #' @param number_cells_required Number of cells per group required to perform 13 | #' analysis of ligand/receptor interactions. Defaults to 100. 14 | #' 15 | #' @param min_expression Minimum expression in counts to consider a ligand or 16 | #' receptor for interactions analysis. A sensible default is set to 1000, but is 17 | #' dataset dependent. This is meant to filter out lowly expressed ligands and 18 | #' receptors. 19 | #' 20 | #' @param max_expression Maxmium expression in counts to consider a ligand or 21 | #' receptor for interactions analysis. A sensible default is set to 20000, but is 22 | #' dataset dependent. This is meant to filter out ubiquitously expressed ligands 23 | #' and receptors. 24 | #' 25 | #' @param scramble_times Number of times to scamble ligand/receptor interactions to 26 | #' create a background distribution for statistical comparison. 27 | #' 28 | #' @return Comprehensive tibble of cognate ligand and receptor interactions and 29 | #' statistical significance of these interactions across cell types. 30 | #' 31 | #' @export 32 | 33 | celltalk <- function(input_object, 34 | metadata_grouping=cell_types, 35 | ligand_receptor_pairs=ramilowski_pairs, 36 | number_cells_required=100, 37 | min_expression=1000, 38 | max_expression=20000, 39 | scramble_times=10 40 | ) { 41 | 42 | cell_types <- ramilowski_pairs <- NULL 43 | 44 | expr_mat_list <- create_expression_matrices(input_object, 45 | metadata_grouping, 46 | ligand_receptor_pairs, 47 | number_cells_required, 48 | min_expression, 49 | max_expression) 50 | 51 | lig_rec_means <- ligand_receptor_means(ligand_mean_dataframe=expr_mat_list[[1]], 52 | receptor_mean_dataframe=expr_mat_list[[2]], 53 | ligand_receptor_pairs) 54 | 55 | lig_rec_scram <- ligand_receptor_scramble(lig_rec_means, 56 | expr_mat_list[[1]], 57 | expr_mat_list[[2]], 58 | ligand_receptor_pairs, 59 | scramble_times) 60 | 61 | ligand_receptor_stats(lig_rec_means,lig_rec_scram) 62 | 63 | } 64 | -------------------------------------------------------------------------------- /R/circos_plot.R: -------------------------------------------------------------------------------- 1 | #' Creates a circos plot from the list of ligands and receptors 2 | #' 3 | #' @param ligand_receptor_frame Resulting tibble (usually filtered in some way) 4 | #' from the celltalk function. 5 | #' 6 | #' @param cell_group_colors Colors used for the groups of cells in the outer 7 | #' track of the circos plot. 8 | #' 9 | #' @param ligand_color Color to use for ligands. Defaults to "blue". 10 | #' 11 | #' @param receptor_color Color to use for the receptors. Defaults to "red". 12 | #' 13 | #' @param cex_outer Size of the text for the cell groups in the outer layer of 14 | #' the circos plot. Default is 0.5. 15 | #' 16 | #' @param cex_inner Size of the text for the ligand and receptors in the 17 | #' inner layer of the circos plot. Default is 0.4. 18 | #' 19 | #' @return Generates a circos plot connecting ligands and receptors across cell types for a given sample group 20 | #' 21 | #' @importFrom magrittr %>% 22 | #' @importFrom dplyr mutate 23 | #' @importFrom dplyr select 24 | #' @importFrom dplyr group_split 25 | #' @importFrom dplyr summarize 26 | #' @importFrom dplyr arrange 27 | #' @importFrom dplyr left_join 28 | #' @importFrom dplyr filter 29 | #' @importFrom dplyr pull 30 | #' @importFrom dplyr group_by 31 | #' @importFrom dplyr distinct 32 | #' @importFrom circlize CELL_META 33 | #' @importFrom circlize circos.link 34 | #' @importFrom circlize circos.track 35 | #' @importFrom circlize circos.clear 36 | #' @importFrom circlize circos.par 37 | #' @importFrom circlize circos.initialize 38 | #' @importFrom circlize circos.rect 39 | #' @importFrom circlize circos.text 40 | #' 41 | #' @export 42 | 43 | circos_plot <- function(ligand_receptor_frame, 44 | cell_group_colors, 45 | ligand_color="blue", 46 | receptor_color="red", 47 | cex_outer=0.5, 48 | cex_inner=0.4) { 49 | 50 | # Bind variables 51 | cell_type1 <- lig <- cell_type2 <- rec <- classes <- ranges <- 52 | max_range <- to_class <- to_rec <- lig_rec <- ordered_lig_rec <- type <- 53 | lig.rec <- to.class <- to.rec <- ordered.lig.rec <- NULL 54 | 55 | # Reformat data 56 | part1 <- ligand_receptor_frame %>% 57 | mutate(lig=sapply(strsplit(interaction,split="_"),function(x) x[[1]])) %>% 58 | mutate(rec=sapply(strsplit(interaction,split="_"),function(x) x[[2]])) %>% 59 | select(cell_type1,lig) %>% 60 | distinct() %>% 61 | mutate(type="lig") 62 | part2 <- ligand_receptor_frame %>% 63 | mutate(lig=sapply(strsplit(interaction,split="_"),function(x) x[[1]])) %>% 64 | mutate(rec=sapply(strsplit(interaction,split="_"),function(x) x[[2]])) %>% 65 | select(cell_type2,rec) %>% 66 | distinct() %>% 67 | mutate(type="rec") 68 | colnames(part1) <- colnames(part2) <- c("classes","lig.rec","type") 69 | 70 | part12 <- rbind(part1,part2) %>% 71 | group_by(classes) %>% 72 | group_split() 73 | 74 | part12 <- lapply(part12,function(x) { 75 | 76 | x <- x %>% 77 | mutate(ordered.lig.rec=paste(type,lig.rec,sep="_")) %>% 78 | mutate(ranges=as.numeric(as.factor(ordered.lig.rec))) %>% 79 | select(-ordered.lig.rec) 80 | 81 | }) 82 | 83 | part12 <- do.call(rbind,part12) 84 | 85 | to.join <- ligand_receptor_frame %>% 86 | mutate(lig=sapply(strsplit(interaction,split="_"),function(x) x[[1]])) %>% 87 | mutate(rec=sapply(strsplit(interaction,split="_"),function(x) x[[2]])) %>% 88 | select(cell_type1,cell_type2,lig,rec) 89 | 90 | colnames(to.join)[1:3] <- c("classes","to.class","lig.rec") 91 | 92 | part3 <- part12 93 | 94 | joined <- left_join(part3,to.join,by=c("classes","lig.rec")) 95 | joined$to.rec <- NA 96 | 97 | for (i in 1:nrow(joined)) { 98 | 99 | sub.group <- joined[i,] 100 | sub.joined <- joined %>% filter(classes==sub.group$to.class) 101 | joined$to.rec[i] <- sub.joined[match(sub.group$rec,sub.joined$lig.rec),"ranges"] %>% pull() 102 | 103 | } 104 | 105 | final.construct <- joined 106 | 107 | # Repair single class 108 | single.class <- final.construct %>% 109 | group_by(classes) %>% 110 | summarize(max_range=max(ranges)) %>% 111 | filter(max_range==1) %>% 112 | pull(classes) 113 | 114 | if (!length(single.class)==0) { 115 | 116 | for (i in 1:length(single.class)) { 117 | 118 | row.add <- final.construct[final.construct$classes==single.class[i],][1,] 119 | row.add$ranges <- 2 120 | 121 | final.construct <- rbind(final.construct,row.add) 122 | final.construct <- final.construct %>% 123 | arrange(classes) 124 | 125 | } 126 | 127 | } 128 | 129 | final.construct <- final.construct %>% 130 | arrange(classes,ranges) 131 | 132 | circos.clear() 133 | circos.par(gap.degree=10,track.margin=c(0,0.2)) 134 | circos.initialize(factors=final.construct$classes,x=final.construct$ranges) 135 | 136 | suppressMessages({ 137 | circos.track(ylim = c(0, 1),track.height=0.1,panel.fun = function(x, y) { 138 | circos.rect(CELL_META$cell.xlim[1],CELL_META$cell.ylim[1],CELL_META$cell.xlim[2],CELL_META$cell.ylim[2],col=cell_group_colors[CELL_META$sector.numeric.index]) 139 | circos.text(CELL_META$xcenter, y=2.5, CELL_META$sector.index, 140 | facing = "downward",cex=cex_outer) 141 | }) 142 | }) 143 | 144 | ## Build interior track with ligand/receptors colors and gene labels 145 | circos.track(ylim = c(0, 1),track.height=0.05,bg.border="white") 146 | 147 | # Define multiplers for each sector 148 | final.construct2 <- final.construct %>% 149 | select(classes,lig.rec,ranges,type) %>% 150 | distinct() %>% 151 | arrange(classes,ranges) 152 | ref.tab <- unname(table(final.construct2$classes)) 153 | sec.multi <- (ref.tab-1)/ref.tab 154 | names(sec.multi) <- names(table(final.construct2$classes)) 155 | 156 | # Loop to construct all sectors 157 | # Ligands first 158 | # Split into list of sectors 159 | int.types.list <- final.construct2 %>% 160 | group_split(classes) 161 | 162 | names(int.types.list) <- sapply(int.types.list,function(x) x$classes[1]) 163 | 164 | int.types.list.multi <- int.types.list.individ <- list("NA") 165 | 166 | int.types.list.multi <- int.types.list[!names(int.types.list) %in% single.class] 167 | 168 | int.types.list.individ <- int.types.list[names(int.types.list) %in% single.class] 169 | 170 | for (i in 1:length(int.types.list.multi)) { 171 | 172 | for (a in 1:nrow(int.types.list.multi[[i]])) { 173 | 174 | if (a==1) { 175 | 176 | sec.multi.use <- sec.multi[names(sec.multi)==int.types.list.multi[[i]]$classes[1]] 177 | 178 | suppressMessages({ 179 | circos.rect(1,0,1+sec.multi.use*a,1,sector.index=int.types.list.multi[[i]]$classes[a], 180 | col=ifelse(int.types.list.multi[[i]]$type[a]=="lig",ligand_color,receptor_color),track.index = 2) 181 | circos.text(1+sec.multi.use*a/2,4,sector.index=int.types.list.multi[[i]]$classes[a], 182 | labels=int.types.list.multi[[i]]$lig.rec[a],track.index = 2,facing="downward",cex=cex_inner) 183 | }) 184 | } else { 185 | 186 | sec.multi.use <- sec.multi[names(sec.multi)==int.types.list.multi[[i]]$classes[1]] 187 | 188 | suppressMessages({ 189 | circos.rect(1+sec.multi.use*(a-1),0,1+sec.multi.use*a,1,sector.index=int.types.list.multi[[i]]$classes[a], 190 | col=ifelse(int.types.list.multi[[i]]$type[a]=="lig",ligand_color,receptor_color),track.index = 2) 191 | circos.text(1+sec.multi.use*a-sec.multi.use/2,4,sector.index=int.types.list.multi[[i]]$classes[a], 192 | labels=int.types.list.multi[[i]]$lig.rec[a],track.index = 2,facing="downward",cex=cex_inner) 193 | }) 194 | } 195 | 196 | } 197 | 198 | } 199 | 200 | if (length(int.types.list.individ)>0) { 201 | 202 | for (i in 1:length(int.types.list.individ)) { 203 | 204 | circos.rect(1,0,2,1,sector.index=int.types.list.individ[[i]]$classes[1], 205 | col=ifelse(int.types.list.individ[[i]]$type[1]=="lig",ligand_color,receptor_color),track.index = 2) 206 | circos.text(1.5,4,sector.index=int.types.list.individ[[i]]$classes[1], 207 | labels=int.types.list.individ[[i]]$lig.rec[1],track.index = 2,facing="downward",cex=cex_inner) 208 | 209 | } 210 | 211 | } 212 | 213 | 214 | ## Draw links 215 | final.construct3 <- joined %>% 216 | select(classes,lig.rec,ranges,to.class,to.rec) %>% 217 | distinct() 218 | 219 | split.construct <- final.construct3 %>% 220 | split(.$classes) 221 | 222 | final.construct3 <- lapply(split.construct,function(x) { 223 | class.length <- length(unique(x$ranges)) 224 | if (class.length==1) { 225 | x[,"ranges"] <- 1.5 226 | x 227 | } else { 228 | x 229 | } 230 | }) %>% 231 | do.call(rbind,.) 232 | 233 | int.types.list <- final.construct3 %>% 234 | group_split(classes) 235 | 236 | names(int.types.list) <- sapply(int.types.list,function(x) x$classes[1]) 237 | 238 | 239 | for (i in 1:length(int.types.list)) { 240 | 241 | for (a in 1:nrow(int.types.list[[i]])) { 242 | 243 | target <- which(!is.na(match(names(int.types.list),int.types.list[[i]]$to.class[[a]]))) 244 | 245 | if (length(target)==0) { 246 | 247 | } else { 248 | 249 | if (!int.types.list[[i]]$to.class[[a]] %in% single.class) { 250 | 251 | circos.link(int.types.list[[i]]$classes[a], 1+sec.multi[i]*int.types.list[[i]]$ranges[a]-sec.multi[i]/2, 252 | int.types.list[[i]]$to.class[[a]], 1+sec.multi[target]*int.types.list[[i]]$to.rec[a]-sec.multi[target]/2, 253 | 0.43, 0.43, directional=1, lwd=3, arr.length=0.2, arr.width=(3*0.1)/2) 254 | 255 | } else { 256 | 257 | circos.link(int.types.list[[i]]$classes[a], 1+sec.multi[i]*int.types.list[[i]]$ranges[a]-sec.multi[i]/2, 258 | int.types.list[[i]]$to.class[[a]], 1.5, 259 | 0.43, 0.43, directional=1, lwd=3, arr.length=0.2, arr.width=(3*0.1)/2) 260 | } 261 | 262 | 263 | } 264 | 265 | } 266 | 267 | } 268 | 269 | } 270 | -------------------------------------------------------------------------------- /R/compare_group_interactions.R: -------------------------------------------------------------------------------- 1 | #' Statistically compare interactions between groups of samples 2 | #' 3 | #' @param seurat_object Seurat object containing expression data acorss all 4 | #' samples and cells 5 | #' 6 | #' @param interaction_stats Tibble from celltalk function, usually filtered to 7 | #' the top significant ligand and receptor interactions of interest 8 | #' 9 | #' @param sample_replicates Name of the meta.data column in a Seurat object that 10 | #' has the samples of the individual replicate samples 11 | #' 12 | #' @param sample_groups Name of the meta.data column in a Seurat object that 13 | #' has the name of the sample group 14 | #' 15 | #' @param metadata_grouping Name of the meta.data column in a Seurat object that 16 | #' has the name of the groups of cells to evaluate (e.g. "cell_types" containing 17 | #' previously identified cell types) 18 | #' 19 | #' @return A list of linear models containing the coefficients and statistics for 20 | #' assessing differences in joint ligand and receptor expression between sample 21 | #' groups. Note that this requires replicate samples from each samples group. 22 | #' 23 | #' @importFrom magrittr %>% 24 | #' @importFrom dplyr mutate 25 | #' @importFrom purrr map 26 | #' @importFrom dplyr recode 27 | #' @importFrom stats lm 28 | #' 29 | #' @export 30 | 31 | compare_group_interactions <- function(seurat_object, 32 | interaction_stats, 33 | sample_replicates, 34 | sample_groups, 35 | metadata_grouping) { 36 | 37 | cell_type1 <- cell_type2 <- ligand <- receptor <- `.`<- NULL 38 | 39 | interactions_compare <- id_interactions(interaction_stats) 40 | 41 | extracted_sample_groups <- extract_sample_group_replicates(seurat_object,sample_groups,sample_replicates) 42 | 43 | replicate_scores_frame <- cell_type_lig_rec_frame(interactions_compare,seurat_object,sample_replicates,sample_groups,metadata_grouping) 44 | # Replace dots with dashes in column names e.g. HLA.F should be HLA-F 45 | colnames(replicate_scores_frame) <- gsub("\\.","-",colnames(replicate_scores_frame)) 46 | 47 | interaction_scores_frame <- cell_type_ligand_receptor_score(replicate_scores_frame,interactions_compare, 48 | extracted_sample_groups,sample_replicates,sample_groups) 49 | 50 | input_formula <- stats::as.formula(paste("scores~sample_groups",sep="")) 51 | 52 | mod_res <- interaction_scores_frame %>% 53 | mutate(unique_group=paste(cell_type1,ligand,cell_type2,receptor,sep="_")) %>% 54 | split(.$unique_group) %>% 55 | map(~lm(input_formula,data=.)) 56 | 57 | } 58 | -------------------------------------------------------------------------------- /R/data.R: -------------------------------------------------------------------------------- 1 | #' Expressed ligands and receptors. 2 | #' 3 | #' A dataset containing the filtered expressed of ligands and receptors from 4 | #' a series of peripheral blood from 5 healthy donors and tonsil from 5 5 | #' healthy donors undergoing tonsilectomy. 6 | #' 7 | #' @format A sparse matrix with 192 genes (rows) and 23734 cells (columns) 8 | #' @source \url{https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE139324/} 9 | "filtered_lig_rec" 10 | 11 | 12 | #' UMAP of cells from 5 health blood donors and 5 healthy tonsil donors. 13 | #' 14 | #' The UMAP_1 and UMAP_2 coordinates of cells resulting from dimensionality 15 | #' reduction of all cells from 5 healthy peripheral blood donors and 5 tonsil 16 | #' tissue donors. 17 | #' 18 | #' @format A matrix with 23734 cells (rows) and 2 dimensions of UMAP embedding 19 | #' (columns) 20 | #' @source \url{https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE139324/} 21 | "overall_umap" 22 | 23 | 24 | #' Metadata from 5 health blood donors and 5 healthy tonsil donors. 25 | #' 26 | #' Overall metadata from analysis of 5 healthy blood donors and 5 healthy 27 | #' tonsil tissue donors. 28 | #' 29 | #' @format A data.frame with 23734 cells (rows) and 8 variables: 30 | #' \describe{ 31 | #' \item{orig.ident}{name assigned by default to the Seurat object} 32 | #' \item{nCount_RNA}{number of RNA molecules counted per cell (1038--74386)} 33 | #' \item{nFeature_RNA}{number of RNA molecules counted per cell (41--6582)} 34 | #' \item{sample_id}{individual donor samples, HD_PBMC 1 to 5 and HD_Tonsil 1 to 5} 35 | #' \item{sample_type}{tissue of origin, either PBMC or Tonsil} 36 | #' \item{RNA_snn_res.0.3}{Louvian clustering results, clusters 0 to 13} 37 | #' \item{seurat_clusters}{clusters assigned by default, same as RNA_snn_res.0.3} 38 | #' \item{cell_types}{cell types identified by canonical gene expression (B cells, 39 | #' CD14-CD16+ monocytes, CD14+CD16- monocytes, CD1C+ DCs, CD4 T cells, 40 | #' CD8 T cells, NK cells, pDCs, Plasmablasts, RBCs)} 41 | #' } 42 | #' @source \url{https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE139324/} 43 | "overall_metadata" 44 | 45 | 46 | #' List of known ligands, receptors and their iteractions. 47 | #' 48 | #' This is a curated list of ligands, receptors and their potential interactions. 49 | #' The list is derived from a manuscript from Ramilowski et al. There are other 50 | #' potential lists that could be used in place of or in addition to this list. 51 | #' Notably, the CellPhoneDB (https://github.com/ventolab/CellphoneDB) package 52 | #' has an extensively curated list including multiple receptor components. 53 | #' 54 | #' @format A data.frame with 2557 rows and 3 variables: 55 | #' \describe{ 56 | #' \item{ligand}{expressed ligands, total of 708 unique ligands} 57 | #' \item{receptor}{expressed receptors, total of 691 receptors} 58 | #' \item{pair}{interaction between and ligand and receptor, total of 2557 59 | #' unique interactions} 60 | #' } 61 | #' @source \url{https://www.nature.com/articles/ncomms8866} 62 | "ramilowski_pairs" 63 | 64 | #' UMAP embedding and cell types from HCA BM 40k dataset 65 | #' 66 | #' This is the UMAP embedding and the canonical immune lineages from the Human 67 | #' Cell Atlast BM 40k dataset, which is available through the SeuratData package. 68 | #' This is useful as a small dataset to demonstrate a use case for celltalker. 69 | #' 70 | #' @format A data.frame with 33839 rows and 3 variables: 71 | #' \describe{ 72 | #' \item{UMAP_1}{first dimension of the UMAP} 73 | #' \item{UMAP_2}{second dimension of the UMAP} 74 | #' \item{cell_types}{annotated cell types from the HCA BM 40K dataset} 75 | #' } 76 | #' @source \url{https://github.com/satijalab/seurat-data} 77 | "hca_bm_umap_cell_types" 78 | -------------------------------------------------------------------------------- /README.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | output: github_document 3 | --- 4 | 5 | 6 | 7 | ```{r, include = FALSE} 8 | knitr::opts_chunk$set( 9 | collapse = TRUE, 10 | comment = "#>", 11 | fig.path = "man/figures/README-", 12 | out.width = "100%" 13 | ) 14 | ``` 15 | 16 | # ARCHIVE NOTICE 17 | 18 | This celltalker repository is archived and no longer maintained. Please check up the celltalker repository at CilloLaboratory/celltalker for the maintained version. 19 | 20 | # celltalker 21 | 22 | The goal of celltalker is to infer putative ligand and receptor interactions from single-cell RNAseq data. This is accomplished by evaluating known cognate ligand/receptor interactions across groups of cells. Interactions are scored by jointly weighting the expression levels of ligands and receptors, and significance is evaluated by comparing to a background distribution of scrambled ligands and receptors. 23 | 24 | A recent refactoring of this package has made the interface much simpler to use. We also provide a wrapper to the functionality of the [circlize package](https://jokergoo.github.io/circlize_book/book/) for creating circos plots of ligands and receptors. 25 | 26 | ## Installation 27 | 28 | You can install the development version from [GitHub](https://github.com/) with: 29 | 30 | ``` r 31 | # install.packages("devtools") 32 | devtools::install_github("arc85/celltalker") 33 | ``` 34 | 35 | ## TL;DR example use 36 | 37 | Here's a basic use case for celltalker based on a subset of the 40,000 bone marrow single-cell dataset available from the Human Cell Atlas. Check out SeuratData [here](https://github.com/satijalab/seurat-data) to download the example dataset. 38 | 39 | Note that we have identified canonical immune cell types and filtered the dataset for ease of analysis. A vignette documenting this processing is coming soon, but please utilize the **hca_bm_umap_cell_types** data.frame for the vignette below. 40 | 41 | ```{r example} 42 | # Load packages 43 | suppressMessages({ 44 | library(celltalker) 45 | library(Seurat) 46 | suppressWarnings( 47 | library(SeuratData) 48 | ) 49 | library(tidyverse) 50 | }) 51 | 52 | # Load Human Cell Atlast Bone Marrow from SeuratData 53 | data(hcabm40k) 54 | 55 | # Filter cell and assign cell types to the dataset 56 | # NB: hca_bm_umap_cell_types has cell types and UMAP embeddings 57 | hca_bm <- hcabm40k[,rownames(hca_bm_umap_cell_types)] 58 | hca_bm[["cell_types"]] <- hca_bm_umap_cell_types$cell_types 59 | 60 | # Process data 61 | hca_bm <- NormalizeData(hca_bm) 62 | 63 | # Add UMAP coordinates 64 | hca_bm[["umap"]] <- CreateDimReducObject(embeddings=as.matrix(hca_bm_umap_cell_types[,1:2]), 65 | key="UMAP_",assay="RNA") 66 | 67 | # View cell types 68 | DimPlot(hca_bm,group.by="cell_types") 69 | 70 | ## Run celltalker 71 | hca_bm_interactions <- celltalk(input_object=hca_bm, 72 | metadata_grouping="cell_types", 73 | ligand_receptor_pairs=ramilowski_pairs, 74 | number_cells_required=100, 75 | min_expression=1000, 76 | max_expression=20000, 77 | scramble_times=10) 78 | 79 | ## Identify top statistically significant interactions 80 | top_stats <- hca_bm_interactions %>% 81 | mutate(fdr=p.adjust(p_val,method="fdr")) %>% 82 | filter(fdr<0.05) %>% 83 | group_by(cell_type1) %>% 84 | top_n(3,interact_ratio) %>% 85 | ungroup() 86 | 87 | ## Generate a circos plot 88 | colors_use <- RColorBrewer::brewer.pal(n=length(unique(hca_bm$cell_types)),"Set2") 89 | 90 | circos_plot(ligand_receptor_frame=top_stats, 91 | cell_group_colors=colors_use, 92 | ligand_color="blue", 93 | receptor_color="red", 94 | cex_outer=0.5, 95 | cex_inner=0.4) 96 | 97 | ``` 98 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Archive Notice 2 | 3 | Please note that this reposity is *not actively maintained* and is achived. Please check out the active celltalker repository at [CilloLaboratory/celltalker](https://github.com/CilloLaboratory/celltalker). 4 | 5 | 6 | 7 | # celltalker 8 | 9 | The goal of celltalker is to infer putative ligand and receptor 10 | interactions from single-cell RNAseq data. This is accomplished by 11 | evaluating known cognate ligand/receptor interactions across groups of 12 | cells. Interactions are scored by jointly weighting the expression 13 | levels of ligands and receptors, and significance is evaluated by 14 | comparing to a background distribution of scrambled ligands and 15 | receptors. 16 | -------------------------------------------------------------------------------- /data-raw/create_example_data.R: -------------------------------------------------------------------------------- 1 | ## Preprocessing of samples for celltalker analysis 2 | ## Dec 22 2021 3 | 4 | ## Load Seurat 5 | library(Seurat) 6 | 7 | ## Read in samples and create metdata 8 | files.to.read <- grep("\\.R",list.files("data-raw"),invert=TRUE,value=TRUE) 9 | ser.list <- vector("list",length=length(files.to.read)) 10 | 11 | for (i in 1:length(files.to.read)) { 12 | 13 | tmp.sample <- Read10X(paste("data-raw",files.to.read[i],sep="/")) 14 | tmp.meta <- data.frame(sample_id=rep(NA,ncol(tmp.sample)),sample_type=rep(NA,ncol(tmp.sample))) 15 | tmp.meta$sample_id <- rep(files.to.read[i],length(tmp.meta$sample_id)) 16 | tmp.meta$sample_type <- ifelse(grepl("PBMC",tmp.meta$sample_id),"PBMC","Tonsil") 17 | rownames(tmp.meta) <- colnames(tmp.sample) 18 | 19 | ser.list[[i]] <- CreateSeuratObject(tmp.sample,meta.data=tmp.meta) 20 | 21 | } 22 | 23 | ## Merge into one Seurat Object 24 | ser <- merge(ser.list[[1]],ser.list[2:length(ser.list)]) 25 | 26 | ## Seruat clustering and visualization workflow 27 | ser <- NormalizeData(ser) 28 | ser <- FindVariableFeatures(ser) 29 | ser <- ScaleData(ser) 30 | ser <- RunPCA(ser) 31 | ElbowPlot(ser) 32 | 33 | ser <- RunUMAP(ser,dims=1:10) 34 | ser <- FindNeighbors(ser,dims=1:10) 35 | ser <- FindClusters(ser,res=0.3) 36 | 37 | ## Identify cell types 38 | DimPlot(ser,group.by="sample_type") 39 | DimPlot(ser,label=T) 40 | FeaturePlot(ser,c("CD3D","CD8A","CD4", 41 | "CD14","FCGR3A", 42 | "MS4A1","MZB1", 43 | "IL3RA","CLEC10A", 44 | "HBB","PPBP")) 45 | 46 | ## Add cell type metadata 47 | data.to.add <- vector("logical",length=ncol(ser)) 48 | 49 | data.to.add[ser@meta.data$RNA_snn_res.0.3=="0" | 50 | ser@meta.data$RNA_snn_res.0.3=="6" | 51 | ser@meta.data$RNA_snn_res.0.3=="7"] <- "B cells" 52 | 53 | data.to.add[ser@meta.data$RNA_snn_res.0.3=="10"] <- "Plasmablasts" 54 | 55 | data.to.add[ser@meta.data$RNA_snn_res.0.3=="1" | 56 | ser@meta.data$RNA_snn_res.0.3=="2" | 57 | ser@meta.data$RNA_snn_res.0.3=="3" | 58 | ser@meta.data$RNA_snn_res.0.3=="5" | 59 | ser@meta.data$RNA_snn_res.0.3=="8" ] <- "NK and T cells" 60 | 61 | data.to.add[ser@meta.data$RNA_snn_res.0.3=="4"] <- "CD14+CD16- monocytes" 62 | 63 | data.to.add[ser@meta.data$RNA_snn_res.0.3=="9"] <- "CD14-CD16+ monocytes" 64 | 65 | data.to.add[ser@meta.data$RNA_snn_res.0.3=="11"] <- "CD1C+ DCs" 66 | 67 | data.to.add[ser@meta.data$RNA_snn_res.0.3=="12"] <- "pDCs" 68 | 69 | data.to.add[ser@meta.data$RNA_snn_res.0.3=="13"] <- "RBCs" 70 | 71 | ser[["cell_types"]] <- data.to.add 72 | 73 | ## Visualize cell types 74 | DimPlot(ser,group.by="cell_types",split.by="sample_type") 75 | 76 | ## Subcluster to identify NK and T cells 77 | ser.t <- ser[,ser@meta.data$cell_types=="NK and T cells"] 78 | ser.t <- FindVariableFeatures(ser.t) 79 | ser.t <- ScaleData(ser.t) 80 | ser.t <- RunPCA(ser.t) 81 | ElbowPlot(ser.t) 82 | 83 | ser.t <- RunUMAP(ser.t,dims=1:10) 84 | ser.t <- FindNeighbors(ser.t,dims=1:10) 85 | ser.t <- FindClusters(ser.t,res=0.7) 86 | 87 | DimPlot(ser.t,label=T) 88 | FeaturePlot(ser.t,c("CD3D","CD8A","CD4","FCGR3A")) 89 | 90 | ## Add T cell and NK cell types 91 | data.to.add <- vector("logical",length=ncol(ser.t)) 92 | 93 | data.to.add[ser.t@meta.data$RNA_snn_res.0.7=="0" | 94 | ser.t@meta.data$RNA_snn_res.0.7=="1" | 95 | ser.t@meta.data$RNA_snn_res.0.7=="2" | 96 | ser.t@meta.data$RNA_snn_res.0.7=="4" | 97 | ser.t@meta.data$RNA_snn_res.0.7=="5" | 98 | ser.t@meta.data$RNA_snn_res.0.7=="7" | 99 | ser.t@meta.data$RNA_snn_res.0.7=="10" | 100 | ser.t@meta.data$RNA_snn_res.0.7=="11"] <- "CD4 T cells" 101 | 102 | data.to.add[ser.t@meta.data$RNA_snn_res.0.7=="3" | 103 | ser.t@meta.data$RNA_snn_res.0.7=="8" | 104 | ser.t@meta.data$RNA_snn_res.0.7=="9" | 105 | ser.t@meta.data$RNA_snn_res.0.7=="12"] <- "CD8 T cells" 106 | 107 | data.to.add[ser.t@meta.data$RNA_snn_res.0.7=="6" | 108 | ser.t@meta.data$RNA_snn_res.0.7=="13"] <- "NK cells" 109 | 110 | ser.t[["cell_types"]] <- data.to.add 111 | 112 | ## Check out T cell types 113 | DimPlot(ser.t,group.by="cell_types") 114 | 115 | ## Add back to overall object 116 | ser@meta.data$cell_types[match(colnames(ser.t),colnames(ser))] <- ser.t@meta.data$cell_types 117 | DimPlot(ser,group.by="cell_types",split.by="sample_type") 118 | 119 | ## Metadata 120 | overall.metadata <- ser@meta.data 121 | format(object.size(overall.metadata),unit="MB") 122 | 123 | ## UMAP 124 | overall.umap <- Embeddings(ser,reduction="umap") 125 | format(object.size(overall.umap),unit="MB") 126 | 127 | ## Ligand/receptor matrix 128 | load("data/ramilowski_pairs.rda") 129 | ligs.recs.all <- unique(c(unique(as.character(ramilowski_pairs$ligand)), 130 | unique(as.character(ramilowski_pairs$receptor)))) 131 | ligs.recs.use <- ligs.recs.all[ligs.recs.all %in% rownames(ser)] 132 | overall.lig.rec <- GetAssayData(ser,slot="data",assay="RNA")[ligs.recs.use,] 133 | 134 | # Filter to those expressed >1000 counts and <20000 counts 135 | ligs.keep <- apply(overall.lig.rec,1,sum)[apply(overall.lig.rec,1,sum)>1000 & 136 | apply(overall.lig.rec,1,sum)<20000] 137 | filtered.lig.rec <- overall.lig.rec[names(ligs.keep),] 138 | format(object.size(filtered.lig.rec),unit="MB") 139 | 140 | ## Enforce consistent naming 141 | overall_metadata <- overall.metadata 142 | overall_umap <- overall.umap 143 | filtered_lig_rec <- filtered.lig.rec 144 | 145 | ## Save minimum files 146 | save(overall_metadata,file="data/overall_metadata.rda") 147 | save(overall_umap,file="data/overall_umap.rda") 148 | save(filtered_lig_rec,file="data/filtered_lig_rec.rda") 149 | -------------------------------------------------------------------------------- /data-raw/create_ramilowski_pairs_data.R: -------------------------------------------------------------------------------- 1 | ## Code used to prepare the ligands and receptor list goes here 2 | 3 | # Read in curated Supplementary Table 3 from "A draft network of ligand-receptor-mediated multicellular signalling in human" from Nature Communications, July 2015 by Jordan Ramilowski et al. This table contains ligands, receptors, and receptor/ligand pairs 4 | 5 | ramilowski_pairs <- read.csv("ramilowski-supplementary_s3_all_pairs.txt",sep="\t") 6 | ramilowski_pairs <- ramilowski_pairs[,c(2,3,1)] 7 | colnames(ramilowski_pairs) <- c("ligand","receptor","pair") 8 | 9 | usethis::use_data(ramilowski_pairs) 10 | -------------------------------------------------------------------------------- /data-raw/download_gene_expression_data.R: -------------------------------------------------------------------------------- 1 | ## Download samples from Gene Expression Omnibus 2 | ## GSE139324 3 | ## https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE139324 4 | ## Dec 22 2021 5 | 6 | ## Identify samples from GEO 7 | gds <- GEOquery::getGEO("GSE139324") 8 | samples.use <- c("HD_PBMC_1","HD_PBMC_2","HD_PBMC_3","HD_PBMC_4","HD_PBMC_5", 9 | "HD_Tonsil_1","HD_Tonsil_2","HD_Tonsil_3","HD_Tonsil_4","HD_Tonsil_5") 10 | data.use <- Biobase::phenoData(gds[[1]])@data[Biobase::phenoData(gds[[1]])@data$title %in% samples.use,] 11 | 12 | ## Create overall directory, subdirectories, and download from GEO 13 | for (i in 1:nrow(data.use)) { 14 | 15 | dir.name <- paste("data-raw",data.use$title[i],sep="/") 16 | dir.create(dir.name) 17 | 18 | tmp.dwnload1 <- as.character(data.use[i,which(grepl("supplementary_file",colnames(data.use)))[1]]) 19 | tmp.dwnload2 <- as.character(data.use[i,which(grepl("supplementary_file",colnames(data.use)))[2]]) 20 | tmp.dwnload3 <- as.character(data.use[i,which(grepl("supplementary_file",colnames(data.use)))[3]]) 21 | 22 | download.file(tmp.dwnload1,destfile=paste(dir.name,"barcodes.tsv.gz",sep="/")) 23 | download.file(tmp.dwnload2,destfile=paste(dir.name,"features.tsv.gz",sep="/")) 24 | download.file(tmp.dwnload3,destfile=paste(dir.name,"matrix.mtx.gz",sep="/")) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /data-raw/filter_hca_bm_umap_cells.R: -------------------------------------------------------------------------------- 1 | ## Cluster and filter HCA BM dataset from Seurat Data 2 | ## Mar 28 2022 3 | 4 | ## Load packages 5 | library(celltalker) 6 | library(Seurat) 7 | library(SeuratData) 8 | library(tidyverse) 9 | 10 | ## Load CMBC data 11 | data(hcabm40k) 12 | 13 | ## Data processing 14 | cbmc <- hcabm40k %>% 15 | NormalizeData() %>% 16 | FindVariableFeatures() %>% 17 | ScaleData() %>% 18 | RunPCA() 19 | 20 | ElbowPlot(cbmc) 21 | 22 | cbmc <- RunUMAP(cbmc,dims=1:8) %>% 23 | FindNeighbors(.,dims=1:8) %>% 24 | FindClusters(.,res=0.7) 25 | 26 | ## ID cell types 27 | # Check out clusters 28 | DimPlot(cbmc,group.by="RNA_snn_res.0.7",label=T) 29 | 30 | FeaturePlot(cbmc,c("CD34","CD14","FCGR3A","MS4A1","CD1C","IL3RA")) 31 | FeaturePlot(cbmc,c("CD3D","CD4","CD8A","FCGR3A","HBB")) 32 | 33 | # Assign cell types 34 | cell_types <- vector("logical",length=ncol(cbmc)) 35 | names(cell_types) <- colnames(cbmc) 36 | 37 | cell_types[cbmc@meta.data$RNA_snn_res.0.7=="0" | 38 | cbmc@meta.data$RNA_snn_res.0.7=="2" | 39 | cbmc@meta.data$RNA_snn_res.0.7=="6" ] <- "CD4 T cells" 40 | 41 | cell_types[cbmc@meta.data$RNA_snn_res.0.7=="3"] <- "CD8 T cells" 42 | 43 | cell_types[cbmc@meta.data$RNA_snn_res.0.7=="5"] <- "NK cells" 44 | 45 | cell_types[cbmc@meta.data$RNA_snn_res.0.7=="8" | 46 | cbmc@meta.data$RNA_snn_res.0.7=="11"] <- "RBCs" 47 | 48 | cell_types[cbmc@meta.data$RNA_snn_res.0.7=="1"] <- "CD14 monocytes" 49 | 50 | cell_types[cbmc@meta.data$RNA_snn_res.0.7=="14"] <- "CD16 monocytes" 51 | 52 | cell_types[cbmc@meta.data$RNA_snn_res.0.7=="15"] <- "CD1C DC" 53 | 54 | cell_types[cbmc@meta.data$RNA_snn_res.0.7=="10"] <- "CD34 HPSC" 55 | 56 | cell_types[cbmc@meta.data$RNA_snn_res.0.7=="4"] <- "B cells" 57 | 58 | cbmc[["cell_types"]] <- cell_types 59 | 60 | # Filter cells - remove transitional cell populations and RBCs 61 | cbmc_filtered <- cbmc[,!cbmc[["cell_types"]]=="FALSE"] 62 | cbmc_filtered <- cbmc_filtered[,!cbmc_filtered[["cell_types"]]=="RBCs"] 63 | 64 | # Check out final object 65 | DimPlot(cbmc_filtered,group.by="cell_types") 66 | 67 | # Save UMAP embeddings and cell types 68 | hca_bm_umap_cell_types <- data.frame(Embeddings(cbmc_filtered,reduction="umap"), 69 | cell_types=cbmc_filtered[["cell_types"]]) 70 | 71 | ## Save data 72 | usethis::use_data(hca_bm_umap_cell_types) 73 | -------------------------------------------------------------------------------- /data/filtered_lig_rec.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/data/filtered_lig_rec.rda -------------------------------------------------------------------------------- /data/hca_bm_umap_cell_types.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/data/hca_bm_umap_cell_types.rda -------------------------------------------------------------------------------- /data/overall_metadata.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/data/overall_metadata.rda -------------------------------------------------------------------------------- /data/overall_umap.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/data/overall_umap.rda -------------------------------------------------------------------------------- /data/ramilowski_pairs.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/data/ramilowski_pairs.rda -------------------------------------------------------------------------------- /docs/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Page not found (404) • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
58 |
59 | 111 | 112 | 113 | 114 |
115 | 116 |
117 |
118 | 121 | 122 | Content not found. Please use links in the navbar. 123 | 124 |
125 | 126 |
127 | 128 | 129 | 130 | 140 |
141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | -------------------------------------------------------------------------------- /docs/LICENSE-text.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | License • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
58 |
59 | 111 | 112 | 113 | 114 |
115 | 116 |
117 |
118 | 121 | 122 |
YEAR: 2019
123 | COPYRIGHT HOLDER: Anthony R Cillo
124 | 
125 | 126 |
127 | 128 |
129 | 130 | 131 | 132 | 142 |
143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /docs/LICENSE.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | MIT License • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
58 |
59 | 111 | 112 | 113 | 114 |
115 | 116 |
117 |
118 | 121 | 122 |
123 | 124 |

Copyright (c) 2019 Anthony R Cillo

125 |

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

126 |

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

127 |

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

128 |
129 | 130 |
131 | 132 |
133 | 134 | 135 | 136 | 146 |
147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /docs/articles/celltalker_files/figure-html/setup-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/docs/articles/celltalker_files/figure-html/setup-1.png -------------------------------------------------------------------------------- /docs/articles/celltalker_files/figure-html/setup-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/docs/articles/celltalker_files/figure-html/setup-2.png -------------------------------------------------------------------------------- /docs/articles/celltalker_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/consistent_interactions_files/figure-html/setup-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/docs/articles/consistent_interactions_files/figure-html/setup-1.png -------------------------------------------------------------------------------- /docs/articles/consistent_interactions_files/figure-html/unnamed-chunk-2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/docs/articles/consistent_interactions_files/figure-html/unnamed-chunk-2-1.png -------------------------------------------------------------------------------- /docs/articles/consistent_interactions_files/figure-html/unnamed-chunk-2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/docs/articles/consistent_interactions_files/figure-html/unnamed-chunk-2-2.png -------------------------------------------------------------------------------- /docs/articles/consistent_interactions_files/figure-html/unnamed-chunk-3-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/docs/articles/consistent_interactions_files/figure-html/unnamed-chunk-3-1.png -------------------------------------------------------------------------------- /docs/articles/consistent_interactions_files/header-attrs-2.9/header-attrs.js: -------------------------------------------------------------------------------- 1 | // Pandoc 2.9 adds attributes on both header and div. We remove the former (to 2 | // be compatible with the behavior of Pandoc < 2.8). 3 | document.addEventListener('DOMContentLoaded', function(e) { 4 | var hs = document.querySelectorAll("div.section[class*='level'] > :first-child"); 5 | var i, h, a; 6 | for (i = 0; i < hs.length; i++) { 7 | h = hs[i]; 8 | if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6 9 | a = h.attributes; 10 | while (a.length > 0) h.removeAttribute(a[0].name); 11 | } 12 | }); 13 | -------------------------------------------------------------------------------- /docs/articles/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Articles • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
58 |
59 | 111 | 112 | 113 | 114 |
115 | 116 |
117 |
118 | 121 | 122 |
123 |

All vignettes

124 |

125 | 126 | 130 |
131 |
132 |
133 | 134 | 135 | 145 |
146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /docs/authors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Authors • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
58 |
59 | 111 | 112 | 113 | 114 |
115 | 116 |
117 |
118 | 121 | 122 |
    123 |
  • 124 |

    Anthony Cillo. Author, maintainer. ORCID 125 |

    126 |
  • 127 |
128 | 129 |
130 | 131 |
132 | 133 | 134 | 135 | 145 |
146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /docs/docsearch.css: -------------------------------------------------------------------------------- 1 | /* Docsearch -------------------------------------------------------------- */ 2 | /* 3 | Source: https://github.com/algolia/docsearch/ 4 | License: MIT 5 | */ 6 | 7 | .algolia-autocomplete { 8 | display: block; 9 | -webkit-box-flex: 1; 10 | -ms-flex: 1; 11 | flex: 1 12 | } 13 | 14 | .algolia-autocomplete .ds-dropdown-menu { 15 | width: 100%; 16 | min-width: none; 17 | max-width: none; 18 | padding: .75rem 0; 19 | background-color: #fff; 20 | background-clip: padding-box; 21 | border: 1px solid rgba(0, 0, 0, .1); 22 | box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .175); 23 | } 24 | 25 | @media (min-width:768px) { 26 | .algolia-autocomplete .ds-dropdown-menu { 27 | width: 175% 28 | } 29 | } 30 | 31 | .algolia-autocomplete .ds-dropdown-menu::before { 32 | display: none 33 | } 34 | 35 | .algolia-autocomplete .ds-dropdown-menu [class^=ds-dataset-] { 36 | padding: 0; 37 | background-color: rgb(255,255,255); 38 | border: 0; 39 | max-height: 80vh; 40 | } 41 | 42 | .algolia-autocomplete .ds-dropdown-menu .ds-suggestions { 43 | margin-top: 0 44 | } 45 | 46 | .algolia-autocomplete .algolia-docsearch-suggestion { 47 | padding: 0; 48 | overflow: visible 49 | } 50 | 51 | .algolia-autocomplete .algolia-docsearch-suggestion--category-header { 52 | padding: .125rem 1rem; 53 | margin-top: 0; 54 | font-size: 1.3em; 55 | font-weight: 500; 56 | color: #00008B; 57 | border-bottom: 0 58 | } 59 | 60 | .algolia-autocomplete .algolia-docsearch-suggestion--wrapper { 61 | float: none; 62 | padding-top: 0 63 | } 64 | 65 | .algolia-autocomplete .algolia-docsearch-suggestion--subcategory-column { 66 | float: none; 67 | width: auto; 68 | padding: 0; 69 | text-align: left 70 | } 71 | 72 | .algolia-autocomplete .algolia-docsearch-suggestion--content { 73 | float: none; 74 | width: auto; 75 | padding: 0 76 | } 77 | 78 | .algolia-autocomplete .algolia-docsearch-suggestion--content::before { 79 | display: none 80 | } 81 | 82 | .algolia-autocomplete .ds-suggestion:not(:first-child) .algolia-docsearch-suggestion--category-header { 83 | padding-top: .75rem; 84 | margin-top: .75rem; 85 | border-top: 1px solid rgba(0, 0, 0, .1) 86 | } 87 | 88 | .algolia-autocomplete .ds-suggestion .algolia-docsearch-suggestion--subcategory-column { 89 | display: block; 90 | padding: .1rem 1rem; 91 | margin-bottom: 0.1; 92 | font-size: 1.0em; 93 | font-weight: 400 94 | /* display: none */ 95 | } 96 | 97 | .algolia-autocomplete .algolia-docsearch-suggestion--title { 98 | display: block; 99 | padding: .25rem 1rem; 100 | margin-bottom: 0; 101 | font-size: 0.9em; 102 | font-weight: 400 103 | } 104 | 105 | .algolia-autocomplete .algolia-docsearch-suggestion--text { 106 | padding: 0 1rem .5rem; 107 | margin-top: -.25rem; 108 | font-size: 0.8em; 109 | font-weight: 400; 110 | line-height: 1.25 111 | } 112 | 113 | .algolia-autocomplete .algolia-docsearch-footer { 114 | width: 110px; 115 | height: 20px; 116 | z-index: 3; 117 | margin-top: 10.66667px; 118 | float: right; 119 | font-size: 0; 120 | line-height: 0; 121 | } 122 | 123 | .algolia-autocomplete .algolia-docsearch-footer--logo { 124 | background-image: url("data:image/svg+xml;utf8,"); 125 | background-repeat: no-repeat; 126 | background-position: 50%; 127 | background-size: 100%; 128 | overflow: hidden; 129 | text-indent: -9000px; 130 | width: 100%; 131 | height: 100%; 132 | display: block; 133 | transform: translate(-8px); 134 | } 135 | 136 | .algolia-autocomplete .algolia-docsearch-suggestion--highlight { 137 | color: #FF8C00; 138 | background: rgba(232, 189, 54, 0.1) 139 | } 140 | 141 | 142 | .algolia-autocomplete .algolia-docsearch-suggestion--text .algolia-docsearch-suggestion--highlight { 143 | box-shadow: inset 0 -2px 0 0 rgba(105, 105, 105, .5) 144 | } 145 | 146 | .algolia-autocomplete .ds-suggestion.ds-cursor .algolia-docsearch-suggestion--content { 147 | background-color: rgba(192, 192, 192, .15) 148 | } 149 | -------------------------------------------------------------------------------- /docs/docsearch.js: -------------------------------------------------------------------------------- 1 | $(function() { 2 | 3 | // register a handler to move the focus to the search bar 4 | // upon pressing shift + "/" (i.e. "?") 5 | $(document).on('keydown', function(e) { 6 | if (e.shiftKey && e.keyCode == 191) { 7 | e.preventDefault(); 8 | $("#search-input").focus(); 9 | } 10 | }); 11 | 12 | $(document).ready(function() { 13 | // do keyword highlighting 14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */ 15 | var mark = function() { 16 | 17 | var referrer = document.URL ; 18 | var paramKey = "q" ; 19 | 20 | if (referrer.indexOf("?") !== -1) { 21 | var qs = referrer.substr(referrer.indexOf('?') + 1); 22 | var qs_noanchor = qs.split('#')[0]; 23 | var qsa = qs_noanchor.split('&'); 24 | var keyword = ""; 25 | 26 | for (var i = 0; i < qsa.length; i++) { 27 | var currentParam = qsa[i].split('='); 28 | 29 | if (currentParam.length !== 2) { 30 | continue; 31 | } 32 | 33 | if (currentParam[0] == paramKey) { 34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20")); 35 | } 36 | } 37 | 38 | if (keyword !== "") { 39 | $(".contents").unmark({ 40 | done: function() { 41 | $(".contents").mark(keyword); 42 | } 43 | }); 44 | } 45 | } 46 | }; 47 | 48 | mark(); 49 | }); 50 | }); 51 | 52 | /* Search term highlighting ------------------------------*/ 53 | 54 | function matchedWords(hit) { 55 | var words = []; 56 | 57 | var hierarchy = hit._highlightResult.hierarchy; 58 | // loop to fetch from lvl0, lvl1, etc. 59 | for (var idx in hierarchy) { 60 | words = words.concat(hierarchy[idx].matchedWords); 61 | } 62 | 63 | var content = hit._highlightResult.content; 64 | if (content) { 65 | words = words.concat(content.matchedWords); 66 | } 67 | 68 | // return unique words 69 | var words_uniq = [...new Set(words)]; 70 | return words_uniq; 71 | } 72 | 73 | function updateHitURL(hit) { 74 | 75 | var words = matchedWords(hit); 76 | var url = ""; 77 | 78 | if (hit.anchor) { 79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor; 80 | } else { 81 | url = hit.url + '?q=' + escape(words.join(" ")); 82 | } 83 | 84 | return url; 85 | } 86 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Analysis of cell-cell communication from single-cell RNAseq data • celltalker 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 20 | 21 | 22 |
23 |
74 | 75 | 76 | 77 | 78 |
79 |
80 |
81 | 83 |
84 |

85 | Welcome to the celltalker package website

86 |
    87 |
  • Check out the core functionality of the package in the vignette under “Get Started”!
  • 88 |
  • If you have groups of samples with replicates in each group (e.g. disease vs control) and want to identify interactions that are statistically different between groups, check out the “Identify significantly different interactions across groups with replicate samples” vignette under Articles.
  • 89 |
90 |

Image1

91 |

Image2

92 |
93 |
94 |
95 | 96 | 112 |
113 | 114 | 115 | 124 |
125 | 126 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /docs/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /docs/news/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Changelog • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
58 |
59 | 111 | 112 | 113 | 114 |
115 | 116 |
117 |
118 | 122 | 123 |
124 |

125 | celltalker 0.0.5.9000

126 |
    127 |
  • Added new functionality to identify consistently different ligand receptor interactions when groups of samples are present
  • 128 |
  • Added plotting functionality for specific ligand receptor interactions across groups of samples
  • 129 |
130 |
131 |
132 |

133 | celltalker 0.0.4.9000

134 |
    135 |
  • Refactored celltalker to use a simpler interface for identifying top ligands and receptors between conditions
  • 136 |
  • Built new code for circos plotting of ligand and receptor interactions
  • 137 |
  • New vignette built using the 40,000 cell Human Cell Atlas Bone Marrow dataset
  • 138 |
139 |
140 |
141 |

142 | celltalker 0.0.3.9000

143 |
    144 |
  • Updated celltalker to use the tidyverse and tibbles. Adds speed and ease of access to data.
  • 145 |
146 |
147 |
148 |

149 | celltalker 0.0.1.9000

150 |
    151 |
  • Initial release of celltalker on github! Stay tuned for more updates soon.
  • 152 |
153 |
154 |
155 | 156 | 167 | 168 |
169 | 170 | 171 | 181 |
182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | -------------------------------------------------------------------------------- /docs/pkgdown.css: -------------------------------------------------------------------------------- 1 | /* Sticky footer */ 2 | 3 | /** 4 | * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ 5 | * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css 6 | * 7 | * .Site -> body > .container 8 | * .Site-content -> body > .container .row 9 | * .footer -> footer 10 | * 11 | * Key idea seems to be to ensure that .container and __all its parents__ 12 | * have height set to 100% 13 | * 14 | */ 15 | 16 | html, body { 17 | height: 100%; 18 | } 19 | 20 | body > .container { 21 | display: flex; 22 | height: 100%; 23 | flex-direction: column; 24 | } 25 | 26 | body > .container .row { 27 | flex: 1 0 auto; 28 | } 29 | 30 | footer { 31 | margin-top: 45px; 32 | padding: 35px 0 36px; 33 | border-top: 1px solid #e5e5e5; 34 | color: #666; 35 | display: flex; 36 | flex-shrink: 0; 37 | } 38 | footer p { 39 | margin-bottom: 0; 40 | } 41 | footer div { 42 | flex: 1; 43 | } 44 | footer .pkgdown { 45 | text-align: right; 46 | } 47 | footer p { 48 | margin-bottom: 0; 49 | } 50 | 51 | img.icon { 52 | float: right; 53 | } 54 | 55 | img { 56 | max-width: 100%; 57 | } 58 | 59 | /* Fix bug in bootstrap (only seen in firefox) */ 60 | summary { 61 | display: list-item; 62 | } 63 | 64 | /* Typographic tweaking ---------------------------------*/ 65 | 66 | .contents .page-header { 67 | margin-top: calc(-60px + 1em); 68 | } 69 | 70 | /* Section anchors ---------------------------------*/ 71 | 72 | a.anchor { 73 | margin-left: -30px; 74 | display:inline-block; 75 | width: 30px; 76 | height: 30px; 77 | visibility: hidden; 78 | 79 | background-image: url(./link.svg); 80 | background-repeat: no-repeat; 81 | background-size: 20px 20px; 82 | background-position: center center; 83 | } 84 | 85 | .hasAnchor:hover a.anchor { 86 | visibility: visible; 87 | } 88 | 89 | @media (max-width: 767px) { 90 | .hasAnchor:hover a.anchor { 91 | visibility: hidden; 92 | } 93 | } 94 | 95 | 96 | /* Fixes for fixed navbar --------------------------*/ 97 | 98 | .contents h1, .contents h2, .contents h3, .contents h4 { 99 | padding-top: 60px; 100 | margin-top: -40px; 101 | } 102 | 103 | /* Sidebar --------------------------*/ 104 | 105 | #sidebar { 106 | margin-top: 30px; 107 | position: -webkit-sticky; 108 | position: sticky; 109 | top: 70px; 110 | } 111 | #sidebar h2 { 112 | font-size: 1.5em; 113 | margin-top: 1em; 114 | } 115 | 116 | #sidebar h2:first-child { 117 | margin-top: 0; 118 | } 119 | 120 | #sidebar .list-unstyled li { 121 | margin-bottom: 0.5em; 122 | } 123 | 124 | .orcid { 125 | height: 16px; 126 | /* margins are required by official ORCID trademark and display guidelines */ 127 | margin-left:4px; 128 | margin-right:4px; 129 | vertical-align: middle; 130 | } 131 | 132 | /* Reference index & topics ----------------------------------------------- */ 133 | 134 | .ref-index th {font-weight: normal;} 135 | 136 | .ref-index td {vertical-align: top;} 137 | .ref-index .icon {width: 40px;} 138 | .ref-index .alias {width: 40%;} 139 | .ref-index-icons .alias {width: calc(40% - 40px);} 140 | .ref-index .title {width: 60%;} 141 | 142 | .ref-arguments th {text-align: right; padding-right: 10px;} 143 | .ref-arguments th, .ref-arguments td {vertical-align: top;} 144 | .ref-arguments .name {width: 20%;} 145 | .ref-arguments .desc {width: 80%;} 146 | 147 | /* Nice scrolling for wide elements --------------------------------------- */ 148 | 149 | table { 150 | display: block; 151 | overflow: auto; 152 | } 153 | 154 | /* Syntax highlighting ---------------------------------------------------- */ 155 | 156 | pre { 157 | word-wrap: normal; 158 | word-break: normal; 159 | border: 1px solid #eee; 160 | } 161 | 162 | pre, code { 163 | background-color: #f8f8f8; 164 | color: #333; 165 | } 166 | 167 | pre code { 168 | overflow: auto; 169 | word-wrap: normal; 170 | white-space: pre; 171 | } 172 | 173 | pre .img { 174 | margin: 5px 0; 175 | } 176 | 177 | pre .img img { 178 | background-color: #fff; 179 | display: block; 180 | height: auto; 181 | } 182 | 183 | code a, pre a { 184 | color: #375f84; 185 | } 186 | 187 | a.sourceLine:hover { 188 | text-decoration: none; 189 | } 190 | 191 | .fl {color: #1514b5;} 192 | .fu {color: #000000;} /* function */ 193 | .ch,.st {color: #036a07;} /* string */ 194 | .kw {color: #264D66;} /* keyword */ 195 | .co {color: #888888;} /* comment */ 196 | 197 | .message { color: black; font-weight: bolder;} 198 | .error { color: orange; font-weight: bolder;} 199 | .warning { color: #6A0366; font-weight: bolder;} 200 | 201 | /* Clipboard --------------------------*/ 202 | 203 | .hasCopyButton { 204 | position: relative; 205 | } 206 | 207 | .btn-copy-ex { 208 | position: absolute; 209 | right: 0; 210 | top: 0; 211 | visibility: hidden; 212 | } 213 | 214 | .hasCopyButton:hover button.btn-copy-ex { 215 | visibility: visible; 216 | } 217 | 218 | /* headroom.js ------------------------ */ 219 | 220 | .headroom { 221 | will-change: transform; 222 | transition: transform 200ms linear; 223 | } 224 | .headroom--pinned { 225 | transform: translateY(0%); 226 | } 227 | .headroom--unpinned { 228 | transform: translateY(-100%); 229 | } 230 | 231 | /* mark.js ----------------------------*/ 232 | 233 | mark { 234 | background-color: rgba(255, 255, 51, 0.5); 235 | border-bottom: 2px solid rgba(255, 153, 51, 0.3); 236 | padding: 1px; 237 | } 238 | 239 | /* vertical spacing after htmlwidgets */ 240 | .html-widget { 241 | margin-bottom: 10px; 242 | } 243 | 244 | /* fontawesome ------------------------ */ 245 | 246 | .fab { 247 | font-family: "Font Awesome 5 Brands" !important; 248 | } 249 | 250 | /* don't display links in code chunks when printing */ 251 | /* source: https://stackoverflow.com/a/10781533 */ 252 | @media print { 253 | code a:link:after, code a:visited:after { 254 | content: ""; 255 | } 256 | } 257 | -------------------------------------------------------------------------------- /docs/pkgdown.js: -------------------------------------------------------------------------------- 1 | /* http://gregfranko.com/blog/jquery-best-practices/ */ 2 | (function($) { 3 | $(function() { 4 | 5 | $('.navbar-fixed-top').headroom(); 6 | 7 | $('body').css('padding-top', $('.navbar').height() + 10); 8 | $(window).resize(function(){ 9 | $('body').css('padding-top', $('.navbar').height() + 10); 10 | }); 11 | 12 | $('body').scrollspy({ 13 | target: '#sidebar', 14 | offset: 60 15 | }); 16 | 17 | $('[data-toggle="tooltip"]').tooltip(); 18 | 19 | var cur_path = paths(location.pathname); 20 | var links = $("#navbar ul li a"); 21 | var max_length = -1; 22 | var pos = -1; 23 | for (var i = 0; i < links.length; i++) { 24 | if (links[i].getAttribute("href") === "#") 25 | continue; 26 | // Ignore external links 27 | if (links[i].host !== location.host) 28 | continue; 29 | 30 | var nav_path = paths(links[i].pathname); 31 | 32 | var length = prefix_length(nav_path, cur_path); 33 | if (length > max_length) { 34 | max_length = length; 35 | pos = i; 36 | } 37 | } 38 | 39 | // Add class to parent
  • , and enclosing
  • if in dropdown 40 | if (pos >= 0) { 41 | var menu_anchor = $(links[pos]); 42 | menu_anchor.parent().addClass("active"); 43 | menu_anchor.closest("li.dropdown").addClass("active"); 44 | } 45 | }); 46 | 47 | function paths(pathname) { 48 | var pieces = pathname.split("/"); 49 | pieces.shift(); // always starts with / 50 | 51 | var end = pieces[pieces.length - 1]; 52 | if (end === "index.html" || end === "") 53 | pieces.pop(); 54 | return(pieces); 55 | } 56 | 57 | // Returns -1 if not found 58 | function prefix_length(needle, haystack) { 59 | if (needle.length > haystack.length) 60 | return(-1); 61 | 62 | // Special case for length-0 haystack, since for loop won't run 63 | if (haystack.length === 0) { 64 | return(needle.length === 0 ? 0 : -1); 65 | } 66 | 67 | for (var i = 0; i < haystack.length; i++) { 68 | if (needle[i] != haystack[i]) 69 | return(i); 70 | } 71 | 72 | return(haystack.length); 73 | } 74 | 75 | /* Clipboard --------------------------*/ 76 | 77 | function changeTooltipMessage(element, msg) { 78 | var tooltipOriginalTitle=element.getAttribute('data-original-title'); 79 | element.setAttribute('data-original-title', msg); 80 | $(element).tooltip('show'); 81 | element.setAttribute('data-original-title', tooltipOriginalTitle); 82 | } 83 | 84 | if(ClipboardJS.isSupported()) { 85 | $(document).ready(function() { 86 | var copyButton = ""; 87 | 88 | $(".examples, div.sourceCode").addClass("hasCopyButton"); 89 | 90 | // Insert copy buttons: 91 | $(copyButton).prependTo(".hasCopyButton"); 92 | 93 | // Initialize tooltips: 94 | $('.btn-copy-ex').tooltip({container: 'body'}); 95 | 96 | // Initialize clipboard: 97 | var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { 98 | text: function(trigger) { 99 | return trigger.parentNode.textContent; 100 | } 101 | }); 102 | 103 | clipboardBtnCopies.on('success', function(e) { 104 | changeTooltipMessage(e.trigger, 'Copied!'); 105 | e.clearSelection(); 106 | }); 107 | 108 | clipboardBtnCopies.on('error', function() { 109 | changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); 110 | }); 111 | }); 112 | } 113 | })(window.jQuery || window.$) 114 | -------------------------------------------------------------------------------- /docs/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 2.14.0.3 2 | pkgdown: 1.4.1 3 | pkgdown_sha: ~ 4 | articles: 5 | celltalker: celltalker.html 6 | consistent_interactions: consistent_interactions.html 7 | 8 | -------------------------------------------------------------------------------- /docs/reference/boxplot_group_interaction.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Create a boxplot of the joint mean score for a specific ligand receptor 10 | interaction between two groups of samples — boxplot_group_interaction • celltalker 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 41 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
    63 |
    64 | 116 | 117 | 118 | 119 |
    120 | 121 |
    122 |
    123 | 129 | 130 |
    131 |

    Create a boxplot of the joint mean score for a specific ligand receptor 132 | interaction between two groups of samples

    133 |
    134 | 135 |
    boxplot_group_interaction(
    136 |   seurat_object,
    137 |   interaction_stats,
    138 |   sample_replicates,
    139 |   sample_groups,
    140 |   metadata_grouping,
    141 |   ligand,
    142 |   receptor,
    143 |   cell_type1,
    144 |   cell_type2
    145 | )
    146 | 147 |

    Arguments

    148 | 149 | 150 | 151 | 152 | 154 | 155 | 156 | 157 | 159 | 160 | 161 | 162 | 164 | 165 | 166 | 167 | 169 | 170 | 171 | 172 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 188 | 189 | 190 | 191 | 193 | 194 |
    seurat_object

    Seurat object containing expression levels across all 153 | cells and sample types

    interaction_stats

    Tibble from celltalk function, usually filtered to 158 | the top significant ligand and receptor interactions of interest

    sample_replicates

    Name of the meta.data column in a Seurat object that 163 | has the samples of the individual replicate samples

    sample_groups

    Name of the meta.data column in a Seurat object that 168 | has the name of the sample group

    metadata_grouping

    Name of the meta.data column in a Seurat object that 173 | has the name of the groups of cells to evaluate (e.g. "cell_types" containing 174 | previously identified cell types)

    ligand

    Name of the ligand in the ligand/receptor pair of interest

    receptor

    Name of the receptor in the ligand/receptor pair of interest

    cell_type1

    Name of the cell type expressing the ligand in the ligand/ 187 | receptor pair of interest

    cell_type2

    Name of the cell type expressing the receptor in the ligand/ 192 | receptor pair of interest

    195 | 196 |

    Value

    197 | 198 |

    A ggplot boxplot of the joint mean for a ligand/receptor interaction 199 | in each sample group.

    200 | 201 |
    202 | 210 |
    211 | 212 | 213 |
    214 | 217 | 218 |
    219 |

    Site built with pkgdown 1.4.1.

    220 |
    221 | 222 |
    223 |
    224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | -------------------------------------------------------------------------------- /docs/reference/celltalk.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Assess ligand and receptor interactions across groups of cells — celltalk • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
    60 |
    61 | 113 | 114 | 115 | 116 |
    117 | 118 |
    119 |
    120 | 125 | 126 |
    127 |

    Assess ligand and receptor interactions across groups of cells

    128 |
    129 | 130 |
    celltalk(
    131 |   input_object,
    132 |   metadata_grouping = cell_types,
    133 |   ligand_receptor_pairs = ramilowski_pairs,
    134 |   number_cells_required = 100,
    135 |   min_expression = 1000,
    136 |   max_expression = 20000,
    137 |   scramble_times = 10
    138 | )
    139 | 140 |

    Arguments

    141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 151 | 152 | 153 | 154 | 157 | 158 | 159 | 160 | 162 | 163 | 164 | 165 | 169 | 170 | 171 | 172 | 176 | 177 | 178 | 179 | 181 | 182 |
    input_object

    Seurat object to create ligand receptor matrices from

    metadata_grouping

    Grouping variable in the Seurat object metadata used 150 | to define the groups of cells. Default is "cell_types".

    ligand_receptor_pairs

    Data.frame of ligands, receptors and 155 | interactions in the format of ramilowski_pairs provided by this package. 156 | Defaults is "ramilowski_pairs".

    number_cells_required

    Number of cells per group required to perform 161 | analysis of ligand/receptor interactions. Defaults to 100.

    min_expression

    Minimum expression in counts to consider a ligand or 166 | receptor for interactions analysis. A sensible default is set to 1000, but is 167 | dataset dependent. This is meant to filter out lowly expressed ligands and 168 | receptors.

    max_expression

    Maxmium expression in counts to consider a ligand or 173 | receptor for interactions analysis. A sensible default is set to 20000, but is 174 | dataset dependent. This is meant to filter out ubiquitously expressed ligands 175 | and receptors.

    scramble_times

    Number of times to scamble ligand/receptor interactions to 180 | create a background distribution for statistical comparison.

    183 | 184 |

    Value

    185 | 186 |

    Comprehensive tibble of cognate ligand and receptor interactions and 187 | statistical significance of these interactions across cell types.

    188 | 189 |
    190 | 198 |
    199 | 200 | 201 |
    202 | 205 | 206 |
    207 |

    Site built with pkgdown 1.4.1.

    208 |
    209 | 210 |
    211 |
    212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | -------------------------------------------------------------------------------- /docs/reference/circos_plot.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Creates a circos plot from the list of ligands and receptors — circos_plot • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
    60 |
    61 | 113 | 114 | 115 | 116 |
    117 | 118 |
    119 |
    120 | 125 | 126 |
    127 |

    Creates a circos plot from the list of ligands and receptors

    128 |
    129 | 130 |
    circos_plot(
    131 |   ligand_receptor_frame,
    132 |   cell_group_colors,
    133 |   ligand_color = "blue",
    134 |   receptor_color = "red",
    135 |   cex_outer = 0.5,
    136 |   cex_inner = 0.4
    137 | )
    138 | 139 |

    Arguments

    140 | 141 | 142 | 143 | 144 | 146 | 147 | 148 | 149 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 164 | 165 | 166 | 167 | 169 | 170 |
    ligand_receptor_frame

    Resulting tibble (usually filtered in some way) 145 | from the celltalk function.

    cell_group_colors

    Colors used for the groups of cells in the outer 150 | track of the circos plot.

    ligand_color

    Color to use for ligands. Defaults to "blue".

    receptor_color

    Color to use for the receptors. Defaults to "red".

    cex_outer

    Size of the text for the cell groups in the outer layer of 163 | the circos plot. Default is 0.5.

    cex_inner

    Size of the text for the ligand and receptors in the 168 | inner layer of the circos plot. Default is 0.4.

    171 | 172 |

    Value

    173 | 174 |

    Generates a circos plot connecting ligands and receptors across cell types for a given sample group

    175 | 176 |
    177 | 185 |
    186 | 187 | 188 |
    189 | 192 | 193 |
    194 |

    Site built with pkgdown 1.4.1.

    195 |
    196 | 197 |
    198 |
    199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | -------------------------------------------------------------------------------- /docs/reference/compare_group_interactions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Statistically compare interactions between groups of samples — compare_group_interactions • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 53 | 54 | 55 | 56 | 57 | 58 | 59 |
    60 |
    61 | 113 | 114 | 115 | 116 |
    117 | 118 |
    119 |
    120 | 125 | 126 |
    127 |

    Statistically compare interactions between groups of samples

    128 |
    129 | 130 |
    compare_group_interactions(
    131 |   seurat_object,
    132 |   interaction_stats,
    133 |   sample_replicates,
    134 |   sample_groups,
    135 |   metadata_grouping
    136 | )
    137 | 138 |

    Arguments

    139 | 140 | 141 | 142 | 143 | 145 | 146 | 147 | 148 | 150 | 151 | 152 | 153 | 155 | 156 | 157 | 158 | 160 | 161 | 162 | 163 | 166 | 167 |
    seurat_object

    Seurat object containing expression data acorss all 144 | samples and cells

    interaction_stats

    Tibble from celltalk function, usually filtered to 149 | the top significant ligand and receptor interactions of interest

    sample_replicates

    Name of the meta.data column in a Seurat object that 154 | has the samples of the individual replicate samples

    sample_groups

    Name of the meta.data column in a Seurat object that 159 | has the name of the sample group

    metadata_grouping

    Name of the meta.data column in a Seurat object that 164 | has the name of the groups of cells to evaluate (e.g. "cell_types" containing 165 | previously identified cell types)

    168 | 169 |

    Value

    170 | 171 |

    A list of linear models containing the coefficients and statistics for 172 | assessing differences in joint ligand and receptor expression between sample 173 | groups. Note that this requires replicate samples from each samples group.

    174 | 175 |
    176 | 184 |
    185 | 186 | 187 |
    188 | 191 | 192 |
    193 |

    Site built with pkgdown 1.4.1.

    194 |
    195 | 196 |
    197 |
    198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | -------------------------------------------------------------------------------- /docs/reference/figures/README-example-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/docs/reference/figures/README-example-1.png -------------------------------------------------------------------------------- /docs/reference/figures/README-example-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/docs/reference/figures/README-example-2.png -------------------------------------------------------------------------------- /docs/reference/filtered_lig_rec.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Expressed ligands and receptors. — filtered_lig_rec • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
    62 |
    63 | 115 | 116 | 117 | 118 |
    119 | 120 |
    121 |
    122 | 127 | 128 |
    129 |

    A dataset containing the filtered expressed of ligands and receptors from 130 | a series of peripheral blood from 5 healthy donors and tonsil from 5 131 | healthy donors undergoing tonsilectomy.

    132 |
    133 | 134 |
    filtered_lig_rec
    135 | 136 | 137 |

    Format

    138 | 139 |

    A sparse matrix with 192 genes (rows) and 23734 cells (columns)

    140 |

    Source

    141 | 142 |

    https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE139324/

    143 | 144 |
    145 | 153 |
    154 | 155 | 156 |
    157 | 160 | 161 |
    162 |

    Site built with pkgdown 1.4.1.

    163 |
    164 | 165 |
    166 |
    167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | -------------------------------------------------------------------------------- /docs/reference/hca_bm_umap_cell_types.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | UMAP embedding and cell types from HCA BM 40k dataset — hca_bm_umap_cell_types • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
    62 |
    63 | 115 | 116 | 117 | 118 |
    119 | 120 |
    121 |
    122 | 127 | 128 |
    129 |

    This is the UMAP embedding and the canonical immune lineages from the Human 130 | Cell Atlast BM 40k dataset, which is available through the SeuratData package. 131 | This is useful as a small dataset to demonstrate a use case for celltalker.

    132 |
    133 | 134 |
    hca_bm_umap_cell_types
    135 | 136 | 137 |

    Format

    138 | 139 |

    A data.frame with 33839 rows and 3 variables:

    140 |
    UMAP_1

    first dimension of the UMAP

    141 |
    UMAP_2

    second dimension of the UMAP

    142 |
    cell_types

    annotated cell types from the HCA BM 40K dataset

    143 | 144 |
    145 | 146 |

    Source

    147 | 148 |

    https://github.com/satijalab/seurat-data

    149 | 150 |
    151 | 159 |
    160 | 161 | 162 |
    163 | 166 | 167 |
    168 |

    Site built with pkgdown 1.4.1.

    169 |
    170 | 171 |
    172 |
    173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | -------------------------------------------------------------------------------- /docs/reference/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Function reference • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
    58 |
    59 | 111 | 112 | 113 | 114 |
    115 | 116 |
    117 |
    118 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 136 | 137 | 138 | 139 | 142 | 144 | 145 | 146 | 149 | 150 | 151 | 152 | 155 | 156 | 157 | 158 | 161 | 162 | 163 | 164 | 167 | 168 | 169 | 170 | 173 | 174 | 175 | 176 | 179 | 180 | 181 | 182 | 185 | 186 | 187 | 188 | 191 | 192 | 193 | 194 |
    133 |

    All functions

    134 |

    135 |
    140 |

    boxplot_group_interaction()

    141 |

    Create a boxplot of the joint mean score for a specific ligand receptor 143 | interaction between two groups of samples

    147 |

    celltalk()

    148 |

    Assess ligand and receptor interactions across groups of cells

    153 |

    circos_plot()

    154 |

    Creates a circos plot from the list of ligands and receptors

    159 |

    compare_group_interactions()

    160 |

    Statistically compare interactions between groups of samples

    165 |

    filtered_lig_rec

    166 |

    Expressed ligands and receptors.

    171 |

    hca_bm_umap_cell_types

    172 |

    UMAP embedding and cell types from HCA BM 40k dataset

    177 |

    overall_metadata

    178 |

    Metadata from 5 health blood donors and 5 healthy tonsil donors.

    183 |

    overall_umap

    184 |

    UMAP of cells from 5 health blood donors and 5 healthy tonsil donors.

    189 |

    ramilowski_pairs

    190 |

    List of known ligands, receptors and their iteractions.

    195 |
    196 | 197 | 203 |
    204 | 205 | 206 |
    207 | 210 | 211 |
    212 |

    Site built with pkgdown 1.4.1.

    213 |
    214 | 215 |
    216 |
    217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | -------------------------------------------------------------------------------- /docs/reference/overall_metadata.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Metadata from 5 health blood donors and 5 healthy tonsil donors. — overall_metadata • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 54 | 55 | 56 | 57 | 58 | 59 | 60 |
    61 |
    62 | 114 | 115 | 116 | 117 |
    118 | 119 |
    120 |
    121 | 126 | 127 |
    128 |

    Overall metadata from analysis of 5 healthy blood donors and 5 healthy 129 | tonsil tissue donors.

    130 |
    131 | 132 |
    overall_metadata
    133 | 134 | 135 |

    Format

    136 | 137 |

    A data.frame with 23734 cells (rows) and 8 variables:

    138 |
    orig.ident

    name assigned by default to the Seurat object

    139 |
    nCount_RNA

    number of RNA molecules counted per cell (1038--74386)

    140 |
    nFeature_RNA

    number of RNA molecules counted per cell (41--6582)

    141 |
    sample_id

    individual donor samples, HD_PBMC 1 to 5 and HD_Tonsil 1 to 5

    142 |
    sample_type

    tissue of origin, either PBMC or Tonsil

    143 |
    RNA_snn_res.0.3

    Louvian clustering results, clusters 0 to 13

    144 |
    seurat_clusters

    clusters assigned by default, same as RNA_snn_res.0.3

    145 |
    cell_types

    cell types identified by canonical gene expression (B cells, 146 | CD14-CD16+ monocytes, CD14+CD16- monocytes, CD1C+ DCs, CD4 T cells, 147 | CD8 T cells, NK cells, pDCs, Plasmablasts, RBCs)

    148 | 149 |
    150 | 151 |

    Source

    152 | 153 |

    https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE139324/

    154 | 155 |
    156 | 164 |
    165 | 166 | 167 |
    168 | 171 | 172 |
    173 |

    Site built with pkgdown 1.4.1.

    174 |
    175 | 176 |
    177 |
    178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | -------------------------------------------------------------------------------- /docs/reference/overall_umap.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | UMAP of cells from 5 health blood donors and 5 healthy tonsil donors. — overall_umap • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
    62 |
    63 | 115 | 116 | 117 | 118 |
    119 | 120 |
    121 |
    122 | 127 | 128 |
    129 |

    The UMAP_1 and UMAP_2 coordinates of cells resulting from dimensionality 130 | reduction of all cells from 5 healthy peripheral blood donors and 5 tonsil 131 | tissue donors.

    132 |
    133 | 134 |
    overall_umap
    135 | 136 | 137 |

    Format

    138 | 139 |

    A matrix with 23734 cells (rows) and 2 dimensions of UMAP embedding 140 | (columns)

    141 |

    Source

    142 | 143 |

    https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE139324/

    144 | 145 |
    146 | 154 |
    155 | 156 | 157 |
    158 | 161 | 162 |
    163 |

    Site built with pkgdown 1.4.1.

    164 |
    165 | 166 |
    167 |
    168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | -------------------------------------------------------------------------------- /docs/reference/ramilowski_pairs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | List of known ligands, receptors and their iteractions. — ramilowski_pairs • celltalker 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
    64 |
    65 | 117 | 118 | 119 | 120 |
    121 | 122 |
    123 |
    124 | 129 | 130 |
    131 |

    This is a curated list of ligands, receptors and their potential interactions. 132 | The list is derived from a manuscript from Ramilowski et al. There are other 133 | potential lists that could be used in place of or in addition to this list. 134 | Notably, the CellPhoneDB (https://github.com/ventolab/CellphoneDB) package 135 | has an extensively curated list including multiple receptor components.

    136 |
    137 | 138 |
    ramilowski_pairs
    139 | 140 | 141 |

    Format

    142 | 143 |

    A data.frame with 2557 rows and 3 variables:

    144 |
    ligand

    expressed ligands, total of 708 unique ligands

    145 |
    receptor

    expressed receptors, total of 691 receptors

    146 |
    pair

    interaction between and ligand and receptor, total of 2557 147 | unique interactions

    148 | 149 |
    150 | 151 |

    Source

    152 | 153 |

    https://www.nature.com/articles/ncomms8866

    154 | 155 |
    156 | 164 |
    165 | 166 | 167 | 177 |
    178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | -------------------------------------------------------------------------------- /index.md: -------------------------------------------------------------------------------- 1 | # celltalker 2 | 3 | ## Welcome to the celltalker package website 4 | - Check out the core functionality of the package in the vignette under "Get Started"! 5 | - If you have groups of samples with replicates in each group (e.g. disease vs control) and want to identify interactions that are statistically different between groups, check out the "Identify significantly different interactions across groups with replicate samples" vignette under Articles. 6 | 7 | ![Image1](man/figures/README-example-1.png) 8 | 9 | ![Image2](man/figures/README-example-2.png) 10 | -------------------------------------------------------------------------------- /man/boxplot_group_interaction.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/boxplot_group_interaction.R 3 | \name{boxplot_group_interaction} 4 | \alias{boxplot_group_interaction} 5 | \title{Create a boxplot of the joint mean score for a specific ligand receptor 6 | interaction between two groups of samples} 7 | \usage{ 8 | boxplot_group_interaction( 9 | seurat_object, 10 | interaction_stats, 11 | sample_replicates, 12 | sample_groups, 13 | metadata_grouping, 14 | ligand, 15 | receptor, 16 | cell_type1, 17 | cell_type2 18 | ) 19 | } 20 | \arguments{ 21 | \item{seurat_object}{Seurat object containing expression levels across all 22 | cells and sample types} 23 | 24 | \item{interaction_stats}{Tibble from celltalk function, usually filtered to 25 | the top significant ligand and receptor interactions of interest} 26 | 27 | \item{sample_replicates}{Name of the meta.data column in a Seurat object that 28 | has the samples of the individual replicate samples} 29 | 30 | \item{sample_groups}{Name of the meta.data column in a Seurat object that 31 | has the name of the sample group} 32 | 33 | \item{metadata_grouping}{Name of the meta.data column in a Seurat object that 34 | has the name of the groups of cells to evaluate (e.g. "cell_types" containing 35 | previously identified cell types)} 36 | 37 | \item{ligand}{Name of the ligand in the ligand/receptor pair of interest} 38 | 39 | \item{receptor}{Name of the receptor in the ligand/receptor pair of interest} 40 | 41 | \item{cell_type1}{Name of the cell type expressing the ligand in the ligand/ 42 | receptor pair of interest} 43 | 44 | \item{cell_type2}{Name of the cell type expressing the receptor in the ligand/ 45 | receptor pair of interest} 46 | } 47 | \value{ 48 | A ggplot boxplot of the joint mean for a ligand/receptor interaction 49 | in each sample group. 50 | } 51 | \description{ 52 | Create a boxplot of the joint mean score for a specific ligand receptor 53 | interaction between two groups of samples 54 | } 55 | -------------------------------------------------------------------------------- /man/celltalk.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/celltalk.R 3 | \name{celltalk} 4 | \alias{celltalk} 5 | \title{Assess ligand and receptor interactions across groups of cells} 6 | \usage{ 7 | celltalk( 8 | input_object, 9 | metadata_grouping = cell_types, 10 | ligand_receptor_pairs = ramilowski_pairs, 11 | number_cells_required = 100, 12 | min_expression = 1000, 13 | max_expression = 20000, 14 | scramble_times = 10 15 | ) 16 | } 17 | \arguments{ 18 | \item{input_object}{Seurat object to create ligand receptor matrices from} 19 | 20 | \item{metadata_grouping}{Grouping variable in the Seurat object metadata used 21 | to define the groups of cells. Default is "cell_types".} 22 | 23 | \item{ligand_receptor_pairs}{Data.frame of ligands, receptors and 24 | interactions in the format of ramilowski_pairs provided by this package. 25 | Defaults is "ramilowski_pairs".} 26 | 27 | \item{number_cells_required}{Number of cells per group required to perform 28 | analysis of ligand/receptor interactions. Defaults to 100.} 29 | 30 | \item{min_expression}{Minimum expression in counts to consider a ligand or 31 | receptor for interactions analysis. A sensible default is set to 1000, but is 32 | dataset dependent. This is meant to filter out lowly expressed ligands and 33 | receptors.} 34 | 35 | \item{max_expression}{Maxmium expression in counts to consider a ligand or 36 | receptor for interactions analysis. A sensible default is set to 20000, but is 37 | dataset dependent. This is meant to filter out ubiquitously expressed ligands 38 | and receptors.} 39 | 40 | \item{scramble_times}{Number of times to scamble ligand/receptor interactions to 41 | create a background distribution for statistical comparison.} 42 | } 43 | \value{ 44 | Comprehensive tibble of cognate ligand and receptor interactions and 45 | statistical significance of these interactions across cell types. 46 | } 47 | \description{ 48 | Assess ligand and receptor interactions across groups of cells 49 | } 50 | -------------------------------------------------------------------------------- /man/circos_plot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/circos_plot.R 3 | \name{circos_plot} 4 | \alias{circos_plot} 5 | \title{Creates a circos plot from the list of ligands and receptors} 6 | \usage{ 7 | circos_plot( 8 | ligand_receptor_frame, 9 | cell_group_colors, 10 | ligand_color = "blue", 11 | receptor_color = "red", 12 | cex_outer = 0.5, 13 | cex_inner = 0.4 14 | ) 15 | } 16 | \arguments{ 17 | \item{ligand_receptor_frame}{Resulting tibble (usually filtered in some way) 18 | from the celltalk function.} 19 | 20 | \item{cell_group_colors}{Colors used for the groups of cells in the outer 21 | track of the circos plot.} 22 | 23 | \item{ligand_color}{Color to use for ligands. Defaults to "blue".} 24 | 25 | \item{receptor_color}{Color to use for the receptors. Defaults to "red".} 26 | 27 | \item{cex_outer}{Size of the text for the cell groups in the outer layer of 28 | the circos plot. Default is 0.5.} 29 | 30 | \item{cex_inner}{Size of the text for the ligand and receptors in the 31 | inner layer of the circos plot. Default is 0.4.} 32 | } 33 | \value{ 34 | Generates a circos plot connecting ligands and receptors across cell types for a given sample group 35 | } 36 | \description{ 37 | Creates a circos plot from the list of ligands and receptors 38 | } 39 | -------------------------------------------------------------------------------- /man/compare_group_interactions.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/compare_group_interactions.R 3 | \name{compare_group_interactions} 4 | \alias{compare_group_interactions} 5 | \title{Statistically compare interactions between groups of samples} 6 | \usage{ 7 | compare_group_interactions( 8 | seurat_object, 9 | interaction_stats, 10 | sample_replicates, 11 | sample_groups, 12 | metadata_grouping 13 | ) 14 | } 15 | \arguments{ 16 | \item{seurat_object}{Seurat object containing expression data acorss all 17 | samples and cells} 18 | 19 | \item{interaction_stats}{Tibble from celltalk function, usually filtered to 20 | the top significant ligand and receptor interactions of interest} 21 | 22 | \item{sample_replicates}{Name of the meta.data column in a Seurat object that 23 | has the samples of the individual replicate samples} 24 | 25 | \item{sample_groups}{Name of the meta.data column in a Seurat object that 26 | has the name of the sample group} 27 | 28 | \item{metadata_grouping}{Name of the meta.data column in a Seurat object that 29 | has the name of the groups of cells to evaluate (e.g. "cell_types" containing 30 | previously identified cell types)} 31 | } 32 | \value{ 33 | A list of linear models containing the coefficients and statistics for 34 | assessing differences in joint ligand and receptor expression between sample 35 | groups. Note that this requires replicate samples from each samples group. 36 | } 37 | \description{ 38 | Statistically compare interactions between groups of samples 39 | } 40 | -------------------------------------------------------------------------------- /man/figures/README-example-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/man/figures/README-example-1.png -------------------------------------------------------------------------------- /man/figures/README-example-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arc85/celltalker/6edd610bf558bb1777590f8a6b02711ef7d0fc47/man/figures/README-example-2.png -------------------------------------------------------------------------------- /man/filtered_lig_rec.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{filtered_lig_rec} 5 | \alias{filtered_lig_rec} 6 | \title{Expressed ligands and receptors.} 7 | \format{ 8 | A sparse matrix with 192 genes (rows) and 23734 cells (columns) 9 | } 10 | \source{ 11 | \url{https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE139324/} 12 | } 13 | \usage{ 14 | filtered_lig_rec 15 | } 16 | \description{ 17 | A dataset containing the filtered expressed of ligands and receptors from 18 | a series of peripheral blood from 5 healthy donors and tonsil from 5 19 | healthy donors undergoing tonsilectomy. 20 | } 21 | \keyword{datasets} 22 | -------------------------------------------------------------------------------- /man/hca_bm_umap_cell_types.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{hca_bm_umap_cell_types} 5 | \alias{hca_bm_umap_cell_types} 6 | \title{UMAP embedding and cell types from HCA BM 40k dataset} 7 | \format{ 8 | A data.frame with 33839 rows and 3 variables: 9 | \describe{ 10 | \item{UMAP_1}{first dimension of the UMAP} 11 | \item{UMAP_2}{second dimension of the UMAP} 12 | \item{cell_types}{annotated cell types from the HCA BM 40K dataset} 13 | } 14 | } 15 | \source{ 16 | \url{https://github.com/satijalab/seurat-data} 17 | } 18 | \usage{ 19 | hca_bm_umap_cell_types 20 | } 21 | \description{ 22 | This is the UMAP embedding and the canonical immune lineages from the Human 23 | Cell Atlast BM 40k dataset, which is available through the SeuratData package. 24 | This is useful as a small dataset to demonstrate a use case for celltalker. 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /man/overall_metadata.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{overall_metadata} 5 | \alias{overall_metadata} 6 | \title{Metadata from 5 health blood donors and 5 healthy tonsil donors.} 7 | \format{ 8 | A data.frame with 23734 cells (rows) and 8 variables: 9 | \describe{ 10 | \item{orig.ident}{name assigned by default to the Seurat object} 11 | \item{nCount_RNA}{number of RNA molecules counted per cell (1038--74386)} 12 | \item{nFeature_RNA}{number of RNA molecules counted per cell (41--6582)} 13 | \item{sample_id}{individual donor samples, HD_PBMC 1 to 5 and HD_Tonsil 1 to 5} 14 | \item{sample_type}{tissue of origin, either PBMC or Tonsil} 15 | \item{RNA_snn_res.0.3}{Louvian clustering results, clusters 0 to 13} 16 | \item{seurat_clusters}{clusters assigned by default, same as RNA_snn_res.0.3} 17 | \item{cell_types}{cell types identified by canonical gene expression (B cells, 18 | CD14-CD16+ monocytes, CD14+CD16- monocytes, CD1C+ DCs, CD4 T cells, 19 | CD8 T cells, NK cells, pDCs, Plasmablasts, RBCs)} 20 | } 21 | } 22 | \source{ 23 | \url{https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE139324/} 24 | } 25 | \usage{ 26 | overall_metadata 27 | } 28 | \description{ 29 | Overall metadata from analysis of 5 healthy blood donors and 5 healthy 30 | tonsil tissue donors. 31 | } 32 | \keyword{datasets} 33 | -------------------------------------------------------------------------------- /man/overall_umap.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{overall_umap} 5 | \alias{overall_umap} 6 | \title{UMAP of cells from 5 health blood donors and 5 healthy tonsil donors.} 7 | \format{ 8 | A matrix with 23734 cells (rows) and 2 dimensions of UMAP embedding 9 | (columns) 10 | } 11 | \source{ 12 | \url{https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE139324/} 13 | } 14 | \usage{ 15 | overall_umap 16 | } 17 | \description{ 18 | The UMAP_1 and UMAP_2 coordinates of cells resulting from dimensionality 19 | reduction of all cells from 5 healthy peripheral blood donors and 5 tonsil 20 | tissue donors. 21 | } 22 | \keyword{datasets} 23 | -------------------------------------------------------------------------------- /man/ramilowski_pairs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{ramilowski_pairs} 5 | \alias{ramilowski_pairs} 6 | \title{List of known ligands, receptors and their iteractions.} 7 | \format{ 8 | A data.frame with 2557 rows and 3 variables: 9 | \describe{ 10 | \item{ligand}{expressed ligands, total of 708 unique ligands} 11 | \item{receptor}{expressed receptors, total of 691 receptors} 12 | \item{pair}{interaction between and ligand and receptor, total of 2557 13 | unique interactions} 14 | } 15 | } 16 | \source{ 17 | \url{https://www.nature.com/articles/ncomms8866} 18 | } 19 | \usage{ 20 | ramilowski_pairs 21 | } 22 | \description{ 23 | This is a curated list of ligands, receptors and their potential interactions. 24 | The list is derived from a manuscript from Ramilowski et al. There are other 25 | potential lists that could be used in place of or in addition to this list. 26 | Notably, the CellPhoneDB (https://github.com/ventolab/CellphoneDB) package 27 | has an extensively curated list including multiple receptor components. 28 | } 29 | \keyword{datasets} 30 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /vignettes/celltalker.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "celltalker" 3 | author: "Anthony R Cillo" 4 | date: "`r format(Sys.time(), '%d %B, %Y')`" 5 | output: rmarkdown::html_vignette 6 | vignette: > 7 | %\VignetteIndexEntry{celltalker} 8 | %\VignetteEngine{knitr::rmarkdown} 9 | %\VignetteEncoding{UTF-8} 10 | --- 11 | 12 | Welcome to celltalker. This vignette will show the simpliest use case of celltalker, namely and identification the top putative ligand and receptor interactions across cell types from the Human Cell Atlas 40,000 Bone Marrow Cells dataset. This dataset is publicly available in a convenient form from the SeuratData package. Check out instructions for downloading this dataset (hcabm40k) [here](https://github.com/satijalab/seurat-data). 13 | 14 | Some pre-processing has been done to facilitate filtering of cells to canonical immune populations and annotating cell types. Check out data-raw for more info. 15 | 16 | ## Set up and run analysis 17 | 18 | ```{r setup} 19 | 20 | # Load packages 21 | suppressMessages({ 22 | library(celltalker) 23 | library(Seurat) 24 | suppressWarnings( 25 | library(SeuratData) 26 | ) 27 | library(dplyr) 28 | library(magrittr) 29 | }) 30 | 31 | # Load Human Cell Atlast Bone Marrow from SeuratData 32 | data(hcabm40k) 33 | 34 | # Filter cell and assign cell types to the dataset 35 | # NB: hca_bm_umap_cell_types has cell types and UMAP embeddings 36 | hca_bm <- hcabm40k[,rownames(hca_bm_umap_cell_types)] 37 | hca_bm[["cell_types"]] <- hca_bm_umap_cell_types$cell_types 38 | 39 | # Process data 40 | hca_bm <- NormalizeData(hca_bm) 41 | 42 | # Add UMAP coordinates 43 | hca_bm[["umap"]] <- CreateDimReducObject(embeddings=as.matrix(hca_bm_umap_cell_types[,1:2]), 44 | key="UMAP_",assay="RNA") 45 | 46 | # View cell types 47 | DimPlot(hca_bm,group.by="cell_types") 48 | 49 | ## Run celltalker 50 | hca_bm_interactions <- celltalk(input_object=hca_bm, 51 | metadata_grouping="cell_types", 52 | ligand_receptor_pairs=ramilowski_pairs, 53 | number_cells_required=100, 54 | min_expression=1000, 55 | max_expression=20000, 56 | scramble_times=10) 57 | 58 | ## Identify top statistically significant interactions 59 | top_stats <- hca_bm_interactions %>% 60 | mutate(fdr=p.adjust(p_val,method="fdr")) %>% 61 | filter(fdr<0.05) %>% 62 | group_by(cell_type1) %>% 63 | top_n(3,interact_ratio) %>% 64 | ungroup() 65 | 66 | ## Generate a circos plot 67 | colors_use <- RColorBrewer::brewer.pal(n=length(unique(hca_bm$cell_types)),"Set2") 68 | 69 | circos_plot(ligand_receptor_frame=top_stats, 70 | cell_group_colors=colors_use, 71 | ligand_color="blue", 72 | receptor_color="red", 73 | cex_outer=0.5, 74 | cex_inner=0.4) 75 | 76 | ``` 77 | 78 | ## Conclusion and next steps 79 | 80 | We have now demonstrated a use case for celltalker in which we identified the top 3 ligand/receptor interactions by joint mean expression of cognate ligands and receptors across cell types. 81 | 82 | If you have replicate samples, it might be of interest to identify ligand receptor interactions that are statistically different between groups of samples. We recommend checking out the vignette on identifying statistically significant interactions between groups of replicate samples if this would be useful for your dataset. 83 | -------------------------------------------------------------------------------- /vignettes/consistent_interactions.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Identify significantly different interactions across groups with replicate samples" 3 | author: "Anthony R Cillo" 4 | date: "`r format(Sys.time(), '%d %B, %Y')`" 5 | output: rmarkdown::html_vignette 6 | vignette: > 7 | %\VignetteIndexEntry{Identify significantly different interactions across groups with replicate samples} 8 | %\VignetteEngine{knitr::rmarkdown} 9 | %\VignetteEncoding{UTF-8} 10 | --- 11 | 12 | This vignette demonstrates an extension of the core functionality of celltalker to replicate samples. The idea is that this functionality can be used to identify consistently differentially expressed ligand and receptor interactions. To demonstrate this functionality, we will leverage our [previously published](https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE139324) dataset of healthy donor PBMC and healthy donor tonsils. 13 | 14 | The data preprocessing steps are documented in the data-raw directory. We will start with a low-dimensional visualization with annotated cell types. 15 | 16 | ## Load packages and setup analysis 17 | 18 | ```{r setup} 19 | suppressMessages({ 20 | library(celltalker) 21 | library(Seurat) 22 | library(dplyr) 23 | library(magrittr) 24 | }) 25 | 26 | ## Load data provided with package 27 | data("filtered_lig_rec") 28 | data("overall_metadata") 29 | data("overall_umap") 30 | 31 | ## Create a Seurat object based on 5 healthy donor PBMC and 5 healhy donor tonsils 32 | ser_obj <- CreateSeuratObject(filtered_lig_rec,meta.data=overall_metadata) 33 | ser_obj[["umap"]] <- CreateDimReducObject(embeddings = overall_umap, key = "UMAP_", assay = DefaultAssay(ser_obj)) 34 | 35 | DimPlot(ser_obj,group.by="cell_types",split.by="sample_type") 36 | 37 | ``` 38 | 39 | ## Run celltalker 40 | 41 | Next, we will split the data into PBMC and Tonsil Seurat objects and will identify the top ligand and receptor interactions in each of these datasets 42 | 43 | ```{r} 44 | 45 | ## Split dataset 46 | ser_split <- SplitObject(ser_obj,split="sample_type") 47 | 48 | ## Check out the split data 49 | ser_split 50 | 51 | ## Run celltalker - PBMC 52 | pbmc_interactions <- celltalk(input_object=ser_split[["PBMC"]], 53 | metadata_grouping="cell_types", 54 | ligand_receptor_pairs=ramilowski_pairs, 55 | number_cells_required=50, 56 | min_expression=50, 57 | max_expression=20000, 58 | scramble_times=10) 59 | 60 | ## Check out the interactions - PBMC 61 | pbmc_interactions %>% 62 | mutate(p_val_adj=p.adjust(p_val,method="fdr")) %>% 63 | filter(p_val_adj<0.05) 64 | 65 | ## Run celltalker - Tonsil 66 | tonsil_interactions <- celltalk(input_object=ser_split[["Tonsil"]], 67 | metadata_grouping="cell_types", 68 | ligand_receptor_pairs=ramilowski_pairs, 69 | number_cells_required=50, 70 | min_expression=50, 71 | max_expression=20000, 72 | scramble_times=10) 73 | 74 | ## Check out the interactions - tonsil 75 | tonsil_interactions %>% 76 | mutate(p_val_adj=p.adjust(p_val,method="fdr")) %>% 77 | filter(p_val_adj<0.05) 78 | 79 | ``` 80 | 81 | ## Create circos plots 82 | 83 | ```{r} 84 | 85 | ## Plot top 3 interactions - PBMC 86 | # Identify the top 3 interactions for cell_type1 87 | top_stats_pbmc <- pbmc_interactions %>% 88 | mutate(p_val_adj=p.adjust(p_val,method="fdr")) %>% 89 | filter(p_val_adj<0.05) %>% 90 | group_by(cell_type1) %>% 91 | top_n(10,interact_ratio) %>% 92 | ungroup() 93 | 94 | # Assign colors to cell types 95 | all_cell_types <- unique(ser_obj[["cell_types"]][,1]) 96 | 97 | # Define colors 98 | colors_use <- colorRampPalette(RColorBrewer::brewer.pal(n=8,"Set2"))(length(all_cell_types)) 99 | names(colors_use) <- all_cell_types 100 | 101 | # Suppress messages to silence the circlize functions 102 | suppressMessages( 103 | circos_plot(ligand_receptor_frame=top_stats_pbmc, 104 | cell_group_colors=colors_use, 105 | ligand_color="blue", 106 | receptor_color="red", 107 | cex_outer=0.5, 108 | cex_inner=0.4) 109 | ) 110 | 111 | ## Plot top 3 interactions - Tonsil 112 | # Identify the top 3 interactions for cell_type1 113 | top_stats_tonsil <- tonsil_interactions %>% 114 | mutate(p_val_adj=p.adjust(p_val,method="fdr")) %>% 115 | filter(p_val_adj<0.05) %>% 116 | group_by(cell_type1) %>% 117 | top_n(10,interact_ratio) %>% 118 | ungroup() 119 | 120 | # Suppress messages to silence the circlize functions 121 | suppressMessages( 122 | circos_plot(ligand_receptor_frame=top_stats_tonsil, 123 | cell_group_colors=colors_use, 124 | ligand_color="blue", 125 | receptor_color="red", 126 | cex_outer=0.5, 127 | cex_inner=0.4) 128 | ) 129 | 130 | ``` 131 | 132 | ## Identify significantly different interactions across patient samples 133 | 134 | ```{r} 135 | 136 | ## Comparison of group interactions 137 | # Use top 10 interactions from tonsils as input 138 | group_stats <- compare_group_interactions(seurat_object=ser_obj, 139 | interaction_stats=top_stats_tonsil, 140 | sample_replicates="sample_id", 141 | sample_groups="sample_type", 142 | metadata_grouping="cell_types") 143 | 144 | # Extract p values into data.frame and add FDR 145 | mod_p_vals <- do.call(rbind, 146 | lapply(group_stats,function(x) { 147 | if (class(x) != "lm") stop("Not an object of class 'lm' ") 148 | f <- summary(x)$fstatistic 149 | p <- pf(f[1],f[2],f[3],lower.tail=F) 150 | attributes(p) <- NULL 151 | return(p) 152 | }) 153 | ) 154 | 155 | mod_p_vals <- data.frame(mod_p_vals,p_val_adj=p.adjust(mod_p_vals[,1],method="fdr")) 156 | 157 | mod_p_vals 158 | 159 | # Boxplot of joint weight interaction across replicates 160 | boxplot_group_interaction(seurat_object=ser_obj, 161 | interaction_stats=top_stats_tonsil, 162 | sample_replicates="sample_id", 163 | sample_groups="sample_type", 164 | metadata_grouping="cell_types", 165 | ligand="CD40LG", 166 | receptor="CD40", 167 | cell_type1="CD4 T cells", 168 | cell_type2="B cells") 169 | 170 | ``` 171 | --------------------------------------------------------------------------------