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 :
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.
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
## 6 AGRN MUSK R-HSA-3000178 REACTOME_ECM_PROTEOGLYCANS 0.18366630
## 25 CALR ITGAV R-HSA-3000170 REACTOME_SYNDECAN_INTERACTIONS 0.02219996
## 251 CALR ITGAV R-HSA-3000178 REACTOME_ECM_PROTEOGLYCANS 0.02190318
## 55 COL4A4 ITGAV R-HSA-3000170 REACTOME_SYNDECAN_INTERACTIONS 0.05377459
## 551 COL4A4 ITGAV R-HSA-3000178 REACTOME_ECM_PROTEOGLYCANS 0.05305570
## 57 COL4A6 ITGAV R-HSA-3000170 REACTOME_SYNDECAN_INTERACTIONS 0.03694712
## qval L.logFC R.logFC LR.pval LR.corr rank len rank.pval
## 6 0.18837570 1.318274 1.563014 0.40134711 1 9 17 0.4872850
## 25 0.07389423 1.394406 2.348577 0.06956223 1 6 11 0.4310522
## 251 0.07389423 1.394406 2.348577 0.06956223 1 13 24 0.4310522
## 55 0.08280531 2.891966 2.348577 0.16849939 1 6 11 0.4310522
## 551 0.08280531 2.891966 2.348577 0.16849939 1 13 24 0.4310522
## 57 0.07389423 1.452941 2.348577 0.11577154 1 6 11 0.4310522
## rank.corr LR.score L.expr R.expr
## 6 1 0.1859113 9.412899 3.334787
## 25 1 0.1852940 4.295503 6.728237
## 251 1 0.1852940 4.295503 6.728237
## 55 1 0.1753966 3.296953 6.728237
## 551 1 0.1753966 3.296953 6.728237
## 57 1 0.2063148 7.823487 6.728237
Three previously described S4 objects (BSR-DataModel, BSR-Inference, BSR-Signature) have been extented :
bsrdm.comp
is an extension from BSR-DataModel, previously denoted
bsrdm
bsrinf.comp
is an extension from BSR-Inference, previously denoted
bsrinf
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
.
## R Under development (unstable) (2024-10-21 r87258)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.1 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.21-bioc/R/lib/libRblas.so
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_GB 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: America/New_York
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] BulkSignalR_0.99.22
##
## loaded via a namespace (and not attached):
## [1] DBI_1.2.3 grr_0.9.5
## [3] gridExtra_2.3 rlang_1.1.4
## [5] magrittr_2.0.3 clue_0.3-66
## [7] GetoptLong_1.0.5 matrixStats_1.5.0
## [9] compiler_4.5.0 RSQLite_2.3.9
## [11] gprofiler2_0.2.3 png_0.1-8
## [13] vctrs_0.6.5 ggalluvial_0.12.5
## [15] pkgconfig_2.0.3 SpatialExperiment_1.17.0
## [17] shape_1.4.6.1 crayon_1.5.3
## [19] fastmap_1.2.0 backports_1.5.0
## [21] dbplyr_2.5.0 magick_2.8.5
## [23] XVector_0.47.2 rmarkdown_2.29
## [25] UCSC.utils_1.3.0 purrr_1.0.2
## [27] bit_4.5.0.1 xfun_0.50
## [29] glmnet_4.1-8 cachem_1.1.0
## [31] aplot_0.2.4 GenomeInfoDb_1.43.2
## [33] jsonlite_1.8.9 blob_1.2.4
## [35] DelayedArray_0.33.3 broom_1.0.7
## [37] parallel_4.5.0 cluster_2.1.8
## [39] R6_2.5.1 bslib_0.8.0
## [41] RColorBrewer_1.1-3 car_3.1-3
## [43] GenomicRanges_1.59.1 jquerylib_0.1.4
## [45] Rcpp_1.0.13-1 SummarizedExperiment_1.37.0
## [47] iterators_1.0.14 knitr_1.49
## [49] IRanges_2.41.2 Matrix_1.7-1
## [51] splines_4.5.0 igraph_2.1.3
## [53] tidyselect_1.2.1 abind_1.4-8
## [55] yaml_2.3.10 doParallel_1.0.17
## [57] codetools_0.2-20 curl_6.1.0
## [59] lattice_0.22-6 tibble_3.2.1
## [61] withr_3.0.2 treeio_1.31.0
## [63] Biobase_2.67.0 evaluate_1.0.1
## [65] Rtsne_0.17 gridGraphics_0.5-1
## [67] survival_3.8-3 BiocFileCache_2.15.0
## [69] circlize_0.4.16 ggtree_3.15.0
## [71] pillar_1.10.1 ggpubr_0.6.0
## [73] filelock_1.0.3 carData_3.0-5
## [75] MatrixGenerics_1.19.0 foreach_1.5.2
## [77] stats4_4.5.0 plotly_4.10.4
## [79] ggfun_0.1.8 generics_0.1.3
## [81] S4Vectors_0.45.2 ggplot2_3.5.1
## [83] tidytree_0.4.6 munsell_0.5.1
## [85] scales_1.3.0 glue_1.8.0
## [87] orthogene_1.13.0 lazyeval_0.2.2
## [89] tools_4.5.0 data.table_1.16.4
## [91] ggsignif_0.6.4 babelgene_22.9
## [93] RANN_2.6.2 fs_1.6.5
## [95] grid_4.5.0 ape_5.8-1
## [97] tidyr_1.3.1 colorspace_2.1-1
## [99] SingleCellExperiment_1.29.1 patchwork_1.3.0
## [101] nlme_3.1-166 GenomeInfoDbData_1.2.13
## [103] homologene_1.4.68.19.3.27 Formula_1.2-5
## [105] cli_3.6.3 viridisLite_0.4.2
## [107] S4Arrays_1.7.1 ComplexHeatmap_2.23.0
## [109] dplyr_1.1.4 gtable_0.3.6
## [111] stabledist_0.7-2 yulab.utils_0.1.9
## [113] rstatix_0.7.2 sass_0.4.9
## [115] digest_0.6.37 BiocGenerics_0.53.3
## [117] ggplotify_0.1.2 SparseArray_1.7.2
## [119] ggrepel_0.9.6 htmlwidgets_1.6.4
## [121] farver_2.1.2 rjson_0.2.23
## [123] memoise_2.0.1 htmltools_0.5.8.1
## [125] multtest_2.63.0 lifecycle_1.0.4
## [127] httr_1.4.7 GlobalOptions_0.1.2
## [129] bit64_4.5.2 MASS_7.3-64