calculate_treatment_enrichment: Check treatment enrichment

Description Usage Arguments Value Examples

View source: R/calculate_treatment_enrichment.R

Description

Check for an enrichment of proteins interacting with the treatment in significantly changing proteins as compared to all proteins.

Usage

1
2
3
4
5
6
7
8
calculate_treatment_enrichment(
  data,
  protein_id,
  is_significant,
  binds_treatment,
  treatment_name,
  plot = TRUE
)

Arguments

data

a data frame contains at least the input variables.

protein_id

a character column in the data data frame that contains the protein accession numbers.

is_significant

a logical column in the data data frame that indicates if the corresponding protein has a significantly changing peptide. The input data frame may contain peptide level information with significance information. The function is able to extract protein level information from this.

binds_treatment

a logical column in the data data frame that indicates if the corresponding protein binds to the treatment. This information can be obtained from different databases, e.g. UniProt.

treatment_name

a character value that indicates the treatment name. It will be included in the plot title.

plot

a logical value indicating whether the result should be plotted or returned as a table.

Value

A bar plot displaying the percentage of all detect proteins and all significant proteins that bind to the treatment. A Fisher's exact test is performed to calculate the significance of the enrichment in significant proteins compared to all proteins. The result is reported as a p-value. If plot = FALSE a contingency table in long format is returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Create example data
data <- data.frame(
  protein_id = c(paste0("protein", 1:50)),
  significant = c(
    rep(TRUE, 20),
    rep(FALSE, 30)
  ),
  binds_treatment = c(
    rep(TRUE, 10),
    rep(FALSE, 10),
    rep(TRUE, 5),
    rep(FALSE, 25)
  )
)

# Plot treatment enrichment
calculate_treatment_enrichment(
  data,
  protein_id = protein_id,
  is_significant = significant,
  binds_treatment = binds_treatment,
  treatment = "Rapamycin",
  plot = TRUE
)

# Calculate treatment enrichment
enrichment <- calculate_treatment_enrichment(
  data,
  protein_id = protein_id,
  is_significant = significant,
  binds_treatment = binds_treatment,
  plot = FALSE
)

enrichment

protti documentation built on Sept. 17, 2021, 5:12 p.m.