Contents

By default, CaDrA performs both forward and backward search algorithm to look for a subset of features whose union is maximally associated with an outcome of interest, based on (currently) one of four scoring functions (Kolmogorov-Smirnov, Conditional Mutual Information, Wilcoxon, and custom-defined). To test whether the strength of the association between the set of features and the observed input scores (e.g., pathway activity, drug sensitivity, etc.) is greater than it would be expected by chance, CaDrA supports permutation-based significance testing. Importantly, the permutation test iterates over the entire search procedure (e.g., if top_N = 7, each permutation iteration will consist of running the search over the top 7 features).

1 Load packages

library(CaDrA)

2 Load required datasets

  1. A binary features matrix also known as Feature Set (such as somatic mutations, copy number alterations, chromosomal translocations, etc.) The 1/0 row vectors indicate the presence/absence of ‘omics’ features in the samples. The Feature Set can be a matrix or an object of class SummarizedExperiment from SummarizedExperiment package)
  2. A vector of continuous scores (or Input Scores) representing a functional response of interest (such as protein expression, pathway activity, etc.)

# Load pre-simulated feature set 
# See ?sim_FS for more information
data(sim_FS)

# Load pre-computed input-score
# See ?sim_Scores for more information
data(sim_Scores)

3 Find a subset of features that maximally associated with a given outcome of interest

Here we are using Kolmogorow-Smirnow (KS) scoring method to search for best features


candidate_search_res <- CaDrA::candidate_search(
  FS = sim_FS,
  input_score = sim_Scores,
  method = "ks_pval",          # Use Kolmogorow-Smirnow scoring function 
  method_alternative = "less", # Use one-sided hypothesis testing
  weights = NULL,              # If weights is provided, perform a weighted-KS test
  search_method = "both",      # Apply both forward and backward search
  top_N = 7,                   # Number of top features to kick start the search
  max_size = 10,               # Allow at most 10 features in meta-feature matrix
  best_score_only = FALSE      # Return all results from the search
)

4 Visualize best meta-features result


# Extract the best meta-feature result
topn_best_meta <- CaDrA::topn_best(topn_list = candidate_search_res)

# Visualize meta-feature result
CaDrA::meta_plot(topn_best_list = topn_best_meta)

5 Perform permutation-based testing

# Set seed for permutation-based testing
set.seed(123)

perm_res <- CaDrA::CaDrA(
  FS = sim_FS, 
  input_score = sim_Scores, 
  method = "ks_pval",             # Use Kolmogorow-Smirnow scoring function 
  method_alternative = "less",    # Use one-sided hypothesis testing
  weights = NULL,                 # If weights is provided, perform a weighted-KS test
  search_method = "both",         # Apply both forward and backward search
  top_N = 7,                      # Repeat the search with the top N features
  max_size = 10,                  # Allow at most 10 features in the meta-feature matrix
  n_perm = 100,                   # Number of permutations to perform
  perm_alternative = "one.sided", # One-sided permutation-based p-value alternative type
  plot = FALSE,                   # We will plot later
  ncores = 2                      # Number of cores to perform parallelization
)

6 Visualize permutation result


# Visualize permutation results
permutation_plot(perm_res = perm_res)

7 SessionInfo

sessionInfo()
R Under development (unstable) (2023-10-22 r85388)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 22.04.3 LTS

Matrix products: default
BLAS:   /home/biocbuild/bbs-3.19-bioc/R/lib/libRblas.so 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.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] CaDrA_1.1.1      testthat_3.2.0   devtools_2.4.5   usethis_2.2.2   
[5] BiocStyle_2.31.0

loaded via a namespace (and not attached):
  [1] bitops_1.0-7                tcltk_4.4.0                
  [3] remotes_2.4.2.1             rlang_1.1.2                
  [5] magrittr_2.0.3              matrixStats_1.1.0          
  [7] compiler_4.4.0              callr_3.7.3                
  [9] vctrs_0.6.4                 reshape2_1.4.4             
 [11] stringr_1.5.0               profvis_0.3.8              
 [13] pkgconfig_2.0.3             crayon_1.5.2               
 [15] fastmap_1.1.1               magick_2.8.1               
 [17] XVector_0.43.0              ellipsis_0.3.2             
 [19] labeling_0.4.3              caTools_1.18.2             
 [21] utf8_1.2.4                  promises_1.2.1             
 [23] rmarkdown_2.25              sessioninfo_1.2.2          
 [25] ps_1.7.5                    purrr_1.0.2                
 [27] xfun_0.41                   zlibbioc_1.49.0            
 [29] cachem_1.0.8                GenomeInfoDb_1.39.0        
 [31] jsonlite_1.8.7              highr_0.10                 
 [33] later_1.3.1                 DelayedArray_0.29.0        
 [35] parallel_4.4.0              prettyunits_1.2.0          
 [37] R6_2.5.1                    bslib_0.5.1                
 [39] stringi_1.7.12              pkgload_1.3.3              
 [41] brio_1.1.3                  GenomicRanges_1.55.1       
 [43] jquerylib_0.1.4             Rcpp_1.0.11                
 [45] bookdown_0.36               SummarizedExperiment_1.33.0
 [47] iterators_1.0.14            knitr_1.45                 
 [49] R.utils_2.12.2              IRanges_2.37.0             
 [51] Matrix_1.6-1.1              httpuv_1.6.12              
 [53] R.cache_0.16.0              tidyselect_1.2.0           
 [55] abind_1.4-5                 rstudioapi_0.15.0          
 [57] yaml_2.3.7                  doParallel_1.0.17          
 [59] gplots_3.1.3                codetools_0.2-19           
 [61] miniUI_0.1.1.1              misc3d_0.9-1               
 [63] processx_3.8.2              pkgbuild_1.4.2             
 [65] lattice_0.22-5              tibble_3.2.1               
 [67] plyr_1.8.9                  shiny_1.7.5.1              
 [69] Biobase_2.63.0              withr_2.5.2                
 [71] evaluate_0.23               desc_1.4.2                 
 [73] urlchecker_1.0.1            pillar_1.9.0               
 [75] BiocManager_1.30.22         MatrixGenerics_1.15.0      
 [77] KernSmooth_2.23-22          foreach_1.5.2              
 [79] stats4_4.4.0                generics_0.1.3             
 [81] rprojroot_2.0.4             RCurl_1.98-1.13            
 [83] S4Vectors_0.41.1            ggplot2_3.4.4              
 [85] munsell_0.5.0               scales_1.2.1               
 [87] gtools_3.9.4                xtable_1.8-4               
 [89] glue_1.6.2                  ppcor_1.1                  
 [91] tools_4.4.0                 fs_1.6.3                   
 [93] grid_4.4.0                  colorspace_2.1-0           
 [95] GenomeInfoDbData_1.2.11     cli_3.6.1                  
 [97] fansi_1.0.5                 S4Arrays_1.3.0             
 [99] dplyr_1.1.3                 gtable_0.3.4               
[101] R.methodsS3_1.8.2           sass_0.4.7                 
[103] digest_0.6.33               BiocGenerics_0.49.1        
[105] SparseArray_1.3.1           farver_2.1.1               
[107] htmlwidgets_1.6.2           memoise_2.0.1              
[109] htmltools_0.5.7             R.oo_1.25.0                
[111] lifecycle_1.0.4             mime_0.12                  
[113] MASS_7.3-60.1