Overview
This case study demonstrates a complete GPSA workflow, from simple gene set queries to complex multi-channel event discovery. We’ll use a realistic biological scenario to showcase the full power of GPSA.
Scenario: You have identified a set of genes differentially expressed in your experiment and want to find perturbations in public databases that produce similar or related effects.
Tutorial Roadmap
GPSA supports increasingly sophisticated query types. Here’s how they build on each other:
Single Gene Set Query (Get Started)
|
v
Up/Down Bidirectional Query -----> Find similar/opposite perturbations
|
v
Multi-channel Event Definition --> Complex phenotype queries
|
v
Batch Queries + Meta-analysis ---> Compare multiple signatures
|
v
Full Vector Search --------------> Complete expression profile queries
Detailed Tutorials
Each tutorial covers a specific capability in depth:
1. Up/Down Bidirectional Query
When you have a reference perturbation signature (with both up- and down-regulated genes), you can find other perturbations that produce similar or opposite effects.
Key concepts covered: - Fixed gene selection
(n_each = 500) - Adaptive gene selection based on energy
threshold - Phenocopy vs Discovery scoring modes - Channel-level score
interpretation
2. Multi-channel Event Definition
Define complex biological events by combining multiple gene sets with different expected directions. Example: “viral mimicry” state requires both interferon activation AND cell cycle suppression.
Key concepts covered: - Multi-channel query construction - Gated filtering (all channels must satisfy direction) - Dual-mode scoring (Phenocopy vs Discovery) - Biological interpretation of multi-channel hits
3. Batch Queries and Meta-analysis
When you have multiple related signatures (e.g., replicates or related conditions), run them together for efficiency and perform meta-analysis.
Key concepts covered: - gpsa_batch_search() for multiple
queries - Query-to-query correlation analysis - Stouffer’s method for
meta-analysis - Identifying consensus hits across queries
4. Full Vector Search
Use complete gene expression profiles (e.g., full logFC vectors) as queries, leveraging the entire transcriptomic information rather than just top/bottom genes.
Key concepts covered: - gpsa_search_vector() with rankZ
transformation - Adaptive sparsification (energy-based gene selection) -
Compile information interpretation - Comparison with Up/Down
approach
Quick Reference: Choosing the Right Query Type
| Scenario | Recommended Approach | Tutorial |
|---|---|---|
| Query with a pathway gene set | Single gene set query | Get Started |
| Find perturbations similar to a reference | Up/Down query | Up/Down |
| Complex phenotype (multiple pathways) | Multi-channel query | Viral Mimicry |
| Multiple related signatures | Batch + meta-analysis | Batch |
| Complete expression profile | Vector search | Vector Search |
Performance Tips
-
Use memory mode for interactive analysis:
db <- gpsa_load_db(preload_Z = TRUE) -
Batch related queries to share I/O overhead:
bat <- gpsa_batch_search(db, list(Q1 = q1, Q2 = q2, Q3 = q3)) -
Use adaptive gene selection to avoid arbitrary cutoffs:
query <- gpsa_make_updown_query_adaptive(gl, eta = 0.90) -
Apply dual-mode scoring to distinguish phenocopy from discovery:
out <- gpsa_postprocess_modes(out, p_mode = "norm") head(out$res_similarity) # Phenocopy hits head(out$res_discovery) # Discovery hits
API Quick Reference
Core Functions
| Function | Description |
|---|---|
gpsa_load_db() |
Load HDF5 database |
gpsa_search() |
Gene-set query |
gpsa_search_vector() |
Full geneList query |
gpsa_batch_search() |
Multiple queries at once |
Query Helpers
| Function | Description |
|---|---|
gpsa_make_updown_query() |
Create Up/Down query (fixed n) |
gpsa_make_updown_query_adaptive() |
Adaptive gene selection |
gpsa_get_signature() |
Extract signature vector |
Post-processing
| Function | Description |
|---|---|
gpsa_postprocess_modes() |
Dual-mode scoring |
gpsa_attach_channel_scores() |
Add per-channel columns |
gpsa_meta_stouffer() |
Meta-analysis across queries |
Visualization
| Function | Description |
|---|---|
gpsa_plot_gsea() |
GSEA running enrichment plot |
gpsa_gsea_running() |
Compute running scores |
Session Info
sessionInfo()
#> R version 4.3.2 (2023-10-31)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 22.04.2 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.20.so; LAPACK version 3.10.0
#>
#> locale:
#> [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
#> [4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
#> [7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
#> [10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
#>
#> time zone: Asia/Shanghai
#> tzcode source: system (glibc)
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> loaded via a namespace (and not attached):
#> [1] vctrs_0.6.5 cli_3.6.2 knitr_1.45 rlang_1.1.2
#> [5] xfun_0.41 stringi_1.8.3 purrr_1.0.2 textshaping_0.3.7
#> [9] jsonlite_1.8.8 glue_1.6.2 htmltools_0.5.7 ragg_1.2.7
#> [13] sass_0.4.8 rmarkdown_2.25 evaluate_0.23 jquerylib_0.1.4
#> [17] fastmap_1.1.1 yaml_2.3.8 lifecycle_1.0.4 memoise_2.0.1
#> [21] stringr_1.5.1 compiler_4.3.2 fs_1.6.3 systemfonts_1.0.5
#> [25] digest_0.6.33 R6_2.5.1 magrittr_2.0.3 bslib_0.6.1
#> [29] tools_4.3.2 pkgdown_2.0.7 cachem_1.0.8 desc_1.4.3