enrichment() is an analysis function that computes the protein summary
statistics for a given tidyproteomics data object.
Arguments
- data
tidyproteomics data object
- ...
two sample comparison e.g. experimental/control
- .pairs
a list of vectors each containing two named sample groups
- .terms
a character string referencing "term(s)" in the annotations table
- .method
a character string
- .score_type
a character string. From the fgsea manual: "This parameter defines the GSEA score type. Possible options are ("std", "pos", "neg"). By default ("std") the enrichment score is computed as in the original GSEA. The "pos" and "neg" score types are intended to be used for one-tailed tests (i.e. when one is interested only in positive ("pos") or negateive ("neg") enrichment)."
- .log2fc_min
used only for Fisher's Exact Test, a numeric defining the minimum log2 foldchange to consider as "enriched"
- .significance_max
used only for Fisher's Exact Test, a numeric defining the maximum statistical significance to consider as "enriched"
- .significance_min
deprecated alias for .significance_max
- .cpu_cores
the number of threads used to speed the calculation
Examples
library(dplyr, warn.conflicts = FALSE)
library(tidyproteomics)
# subset for fast execution
hela_proteins <- hela_proteins %>% subset(description %like% "Ribosome")
#>
#> ℹ Subsetting data: description %like% Ribosome
#> ✔ Subsetting data: description %like% Ribosome ... done
#>
# using the default GSEA method
hela_proteins %>%
expression(knockdown/control) %>%
enrichment(knockdown/control, .terms = "biological_process") %>%
export_analysis(knockdown/control, .analysis = "enrichment", .term = "biological_process")
#> ℹ .. expression::t_test testing knockdown / control
#> ✔ .. expression::t_test testing knockdown / control [68ms]
#>
#> ℹ .. enrichment::gsea testing knockdown / control by term biological_process
#> ✔ .. enrichment::gsea testing knockdown / control by term biological_process [6…
#>
#> # A tibble: 5 × 7
#> annotation p_value adj_p_value enrichment enrichment_normalized log2err size
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <int>
#> 1 cellular c… 0.396 0.951 -0.429 -1.14 0.194 10
#> 2 metabolic … 0.533 0.951 0.493 0.975 0.0496 8
#> 3 cell growth 0.592 0.951 0.459 0.909 0.0448 8
#> 4 cell organ… 0.762 0.951 0.460 0.816 0.0374 4
#> 5 cell diffe… 0.951 0.951 -0.286 -0.557 0.0749 3
# using a Wilcoxon Rank Sum method
hela_proteins %>%
expression(knockdown/control) %>%
enrichment(knockdown/control, .terms = "biological_process", .method = "wilcoxon") %>%
export_analysis(knockdown/control, .analysis = "enrichment", .term = "biological_process")
#> ℹ .. expression::t_test testing knockdown / control
#> ✔ .. expression::t_test testing knockdown / control [65ms]
#>
#> ℹ .. enrichment::wilcoxon testing knockdown / control by term biological_process
#> ✔ .. enrichment::wilcoxon testing knockdown / control by term biological_proces…
#>
#> # A tibble: 5 × 5
#> annotation p_value adj_p_value enrichment size
#> <chr> <dbl> <dbl> <dbl> <int>
#> 1 cellular component movement 0.262 0.736 0.448 10
#> 2 cell organization and biogenesis 0.533 0.736 0.244 4
#> 3 metabolic process 0.597 0.736 0.526 8
#> 4 cell differentiation 0.659 0.736 0.460 3
#> 5 cell growth 0.736 0.736 0.526 8
# using the .pairs argument when multiple comparisons are needed
comps <- list(c("control","knockdown"),
c("knockdown","control"))
hela_proteins %>%
expression(.pairs = comps) %>%
enrichment(.pairs = comps, .terms = c("biological_process", "molecular_function"))
#> Expression Analysis - using the supplied 2 sample pairs ...
#> ℹ .. expression::t_test testing control / knockdown
#> ✔ .. expression::t_test testing control / knockdown [88ms]
#>
#> ℹ .. expression::t_test testing knockdown / control
#> ✔ .. expression::t_test testing knockdown / control [64ms]
#>
#> Enrichment Analysis - using the supplied 2 sample pairs ...
#> ℹ .. enrichment::gsea testing control / knockdown by term biological_process
#> ✔ .. enrichment::gsea testing control / knockdown by term biological_process [3…
#>
#> ℹ .. enrichment::gsea testing control / knockdown by term molecular_function
#> ✔ .. enrichment::gsea testing control / knockdown by term molecular_function [3…
#>
#> ℹ .. enrichment::gsea testing knockdown / control by term biological_process
#> ✔ .. enrichment::gsea testing knockdown / control by term biological_process [3…
#>
#> ℹ .. enrichment::gsea testing knockdown / control by term molecular_function
#> ✔ .. enrichment::gsea testing knockdown / control by term molecular_function [3…
#>
#>
#> ── Quantitative Proteomics Data Object ──
#>
#> Origin ProteomeDiscoverer
#> proteins (66.70 kB)
#> Composition 6 files
#> 2 samples (control, knockdown)
#> Quantitation 18 proteins
#> 2.7 log10 dynamic range
#> 7.41% missing values
#> *imputed
#> Accounting (4) num_peptides num_psms num_unique_peptides imputed
#> Annotations (9) description biological_process cellular_component molecular_function
#> gene_id_entrez gene_name wiki_pathway reactome_pathway
#> gene_id_ensemble
#> Analyses (2)
#> control/knockdown -> expression & enrichment (biological_process, molecular_function)
#> knockdown/control -> expression & enrichment (biological_process, molecular_function)
#>
