BulkSignalR :
Inference of ligand-receptor interactions from bulk data or spatial transcriptomics

library(BulkSignalR)

Differential mode

BulkSignalR now allows the user to request different pairwise comparisons from a large cohort of samples.

In this mode, ligand-receptor interactions are inferred based on gene or protein regulation-associated P-values when comparing two clusters of samples.

The user must first perform a differential expression analysis (using the tool of his choice as DESeq2, EdgeR…) between a pair of sample clusters.

In the next chunk of code, we describe an application to Salivary Duct Carcinoma (SDC) samples where we compare two clusters of patients.

We first create a BSR-DataModel object as follows :

data(sdc, package = "BulkSignalR")
normal <- grep("^N", names(sdc))
bsrdm <- BSRDataModel(sdc[, -normal])

As an example here, we generate random values but user should provide his own logFC and associated pvalues from DGE ouputs.

colA <- as.integer(1:3)
colB <- as.integer(12:15)

# We then coerce the initial **BSRDataModel** object to 
# a **BSRDataModelComp** object. 

bsrdm.comp <- as(bsrdm, "BSRDataModelComp")


n <- nrow(ncounts(bsrdm.comp))
stats <- data.frame(pval = runif(n),
logFC = rnorm(n, 0, 2),
expr = runif(n, 0, 10))
rownames(stats) <- rownames(ncounts(bsrdm.comp))

We define the cluster comparison and add it.

bsrcc <- BSRClusterComp(bsrdm.comp, colA, colB, stats)
bsrdm.comp <- addClusterComp(bsrdm.comp, bsrcc, "random.example")

Finally we infer ligand-receptor interactions from the comparison. We use a subset of the reference to speed up inference in the context of the vignette.

subset <- c("REACTOME_BASIGIN_INTERACTIONS",
"REACTOME_SYNDECAN_INTERACTIONS",
"REACTOME_ECM_PROTEOGLYCANS",
"REACTOME_CELL_JUNCTION_ORGANIZATION")

reactSubset <- BulkSignalR:::.SignalR$BulkSignalR_Reactome[
BulkSignalR:::.SignalR$BulkSignalR_Reactome$`Reactome name` %in% subset,]

resetPathways(dataframe = reactSubset,
resourceName = "Reactome")

bsrinf.comp <- BSRInferenceComp(bsrdm.comp,
reference="REACTOME",
max.pval = 1, 
"random.example")

head(LRinter(bsrinf.comp))
##         L     R        pw.id                             pw.name       pval
## 139 LAMA3 ITGA3 R-HSA-210991       REACTOME_BASIGIN_INTERACTIONS 0.04484201
## 140 LAMB2 ITGA3 R-HSA-210991       REACTOME_BASIGIN_INTERACTIONS 0.01996027
## 142 LAMC1 ITGA3 R-HSA-210991       REACTOME_BASIGIN_INTERACTIONS 0.03557397
## 151  PLAU ITGA3 R-HSA-210991       REACTOME_BASIGIN_INTERACTIONS 0.04368922
## 192  SHBG CLDN4 R-HSA-446728 REACTOME_CELL_JUNCTION_ORGANIZATION 0.10966929
## 202 THBS1 ITGA3 R-HSA-210991       REACTOME_BASIGIN_INTERACTIONS 0.01201393
##           qval  L.logFC  R.logFC   LR.pval LR.corr rank len rank.pval rank.corr
## 139 0.07286826 1.832191 3.532476 0.9205598       1    4   8 0.2873936         1
## 140 0.06487089 1.081312 3.532476 0.4097637       1    4   8 0.2873936         1
## 142 0.07286826 1.335735 3.532476 0.7302968       1    4   8 0.2873936         1
## 151 0.07286826 1.016958 3.532476 0.8968943       1    4   8 0.2873936         1
## 192 0.15841119 1.064361 1.238897 0.1228071       1   17  32 0.5926772         1
## 202 0.06298408 1.722652 3.532476 0.2466335       1    4   8 0.2873936         1
##      LR.score   L.expr   R.expr
## 139 0.1716966 2.680599 7.782878
## 140 0.1504868 1.590005 7.782878
## 142 0.2192269 9.923416 7.782878
## 151 0.2192137 9.919380 7.782878
## 192 0.1899991 4.096111 8.266093
## 202 0.2033749 6.217922 7.782878

Technical notes

Three previously described S4 objects (BSR-DataModel, BSR-Inference, BSR-Signature) have been extented :


  • BSR-DataModelComp, denoted bsrdm.comp is an extension from BSR-DataModel, previously denoted bsrdm
  • BSR-InferenceComp, denoted bsrinf.comp is an extension from BSR-Inference, previously denoted bsrinf
  • BSR-SignatureComp, denoted bsrsig.comp is an extension from BSR-Signature, previously denoted bsrsig

A new S4 object BSR-ClusterComp representing the comparison of two clusters of samples to infer LR interactions based on the resulting P-values and log-fold-changes (logFC) has been added.

This new desgin let us handle sample cluster comparisons.

as.BSRDataModelComp converts of BSR-DataModel into BSR-DataModelComp In case ligand-receptor inferences should be obtained based on gene/protein regulation P-values comparing two clusters of samples, it is necessary to first promote the BSR-DataModel object that contains the count matrix into a BSR-DataModelComp object able to contain a list of such cluster pairs comparisons. This function performs this promotion, adding an empty list of comparisons.

BSRClusterComp is used to define the comparison between two clusters of samples by using defined column indexes of the expression matrix that belong to each cluster, and storing the result of the cluster difference statistical analysis obtained by an external tool such as edgeR, DESeq2, etc.

addClusterComp add a comparison between two clusters of samples to a BSR-DataModelComp object.

Several comparison can be defined and added sequentially.


Thank you for reading this guide and for using BulkSignalR.

Session Information

sessionInfo()
## R version 4.4.2 (2024-10-31)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.1 LTS
## 
## Matrix products: default
## BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.26.so;  LAPACK version 3.12.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: Etc/UTC
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] BulkSignalR_0.99.22 rmarkdown_2.29     
## 
## loaded via a namespace (and not attached):
##   [1] RColorBrewer_1.1-3          sys_3.4.3                  
##   [3] jsonlite_1.8.9              shape_1.4.6.1              
##   [5] magrittr_2.0.3              magick_2.8.5               
##   [7] farver_2.1.2                GlobalOptions_0.1.2        
##   [9] fs_1.6.5                    vctrs_0.6.5                
##  [11] multtest_2.63.0             memoise_2.0.1              
##  [13] ggtree_3.15.0               rstatix_0.7.2              
##  [15] htmltools_0.5.8.1           S4Arrays_1.7.1             
##  [17] curl_6.1.0                  broom_1.0.7                
##  [19] SparseArray_1.7.2           Formula_1.2-5              
##  [21] gridGraphics_0.5-1          sass_0.4.9                 
##  [23] bslib_0.8.0                 htmlwidgets_1.6.4          
##  [25] plotly_4.10.4               cachem_1.1.0               
##  [27] buildtools_1.0.0            igraph_2.1.3               
##  [29] lifecycle_1.0.4             iterators_1.0.14           
##  [31] pkgconfig_2.0.3             Matrix_1.7-1               
##  [33] R6_2.5.1                    fastmap_1.2.0              
##  [35] GenomeInfoDbData_1.2.13     MatrixGenerics_1.19.1      
##  [37] clue_0.3-66                 digest_0.6.37              
##  [39] aplot_0.2.4                 colorspace_2.1-1           
##  [41] patchwork_1.3.0             S4Vectors_0.45.2           
##  [43] grr_0.9.5                   GenomicRanges_1.59.1       
##  [45] RSQLite_2.3.9               ggpubr_0.6.0               
##  [47] filelock_1.0.3              httr_1.4.7                 
##  [49] abind_1.4-8                 compiler_4.4.2             
##  [51] withr_3.0.2                 bit64_4.5.2                
##  [53] doParallel_1.0.17           backports_1.5.0            
##  [55] orthogene_1.13.0            carData_3.0-5              
##  [57] DBI_1.2.3                   homologene_1.4.68.19.3.27  
##  [59] ggsignif_0.6.4              MASS_7.3-64                
##  [61] DelayedArray_0.33.3         rjson_0.2.23               
##  [63] tools_4.4.2                 ape_5.8-1                  
##  [65] glue_1.8.0                  stabledist_0.7-2           
##  [67] nlme_3.1-166                grid_4.4.2                 
##  [69] Rtsne_0.17                  cluster_2.1.8              
##  [71] generics_0.1.3              gtable_0.3.6               
##  [73] tidyr_1.3.1                 data.table_1.16.4          
##  [75] car_3.1-3                   XVector_0.47.2             
##  [77] BiocGenerics_0.53.3         ggrepel_0.9.6              
##  [79] RANN_2.6.2                  foreach_1.5.2              
##  [81] pillar_1.10.1               yulab.utils_0.1.9          
##  [83] babelgene_22.9              circlize_0.4.16            
##  [85] splines_4.4.2               dplyr_1.1.4                
##  [87] BiocFileCache_2.15.0        treeio_1.31.0              
##  [89] lattice_0.22-6              survival_3.8-3             
##  [91] bit_4.5.0.1                 tidyselect_1.2.1           
##  [93] ComplexHeatmap_2.23.0       SingleCellExperiment_1.29.1
##  [95] maketools_1.3.1             knitr_1.49                 
##  [97] gridExtra_2.3               IRanges_2.41.2             
##  [99] SummarizedExperiment_1.37.0 stats4_4.4.2               
## [101] xfun_0.50                   Biobase_2.67.0             
## [103] matrixStats_1.5.0           UCSC.utils_1.3.0           
## [105] lazyeval_0.2.2              ggfun_0.1.8                
## [107] yaml_2.3.10                 evaluate_1.0.3             
## [109] codetools_0.2-20            tibble_3.2.1               
## [111] ggplotify_0.1.2             cli_3.6.3                  
## [113] munsell_0.5.1               jquerylib_0.1.4            
## [115] Rcpp_1.0.13-1               GenomeInfoDb_1.43.2        
## [117] dbplyr_2.5.0                gprofiler2_0.2.3           
## [119] png_0.1-8                   parallel_4.4.2             
## [121] ggplot2_3.5.1               blob_1.2.4                 
## [123] ggalluvial_0.12.5           glmnet_4.1-8               
## [125] SpatialExperiment_1.17.0    viridisLite_0.4.2          
## [127] tidytree_0.4.6              scales_1.3.0               
## [129] purrr_1.0.2                 crayon_1.5.3               
## [131] GetoptLong_1.0.5            rlang_1.1.4