# \donttest{
# Load libraries
library(dplyr)
library(stringr)
# Create example data
# Contains artificial de-enrichment for ribosomes.
uniprot_go_data <- fetch_uniprot_proteome(
organism_id = 83333,
columns = c(
"accession",
"go_f"
)
)
if (!is(uniprot_go_data, "character")) {
data <- uniprot_go_data %>%
mutate(significant = c(
rep(TRUE, 1000),
rep(FALSE, n() - 1000)
)) %>%
mutate(significant = ifelse(
str_detect(
go_f,
pattern = "ribosome"
),
FALSE,
significant
)) %>%
mutate(group = c(
rep("A", 500),
rep("B", 500),
rep("A", (n() - 1000) / 2),
rep("B", round((n() - 1000) / 2))
))
# Plot gene ontology enrichment
calculate_go_enrichment(
data,
protein_id = accession,
go_annotations_uniprot = go_f,
is_significant = significant,
plot = TRUE,
plot_cutoff = "pval 0.01"
)
# Plot gene ontology enrichment with group
calculate_go_enrichment(
data,
protein_id = accession,
go_annotations_uniprot = go_f,
is_significant = significant,
group = group,
facet_n_col = 1,
plot = TRUE,
plot_cutoff = "pval 0.01"
)
# Plot gene ontology enrichment with group in a heatmap plot
calculate_go_enrichment(
data,
protein_id = accession,
group = group,
go_annotations_uniprot = go_f,
is_significant = significant,
min_n_detected_proteins_in_process = 15,
plot = TRUE,
label = TRUE,
plot_style = "heatmap",
enrichment_type = "enriched",
plot_cutoff = "pval 0.01"
)
# Calculate gene ontology enrichment
go_enrichment <- calculate_go_enrichment(
data,
protein_id = accession,
go_annotations_uniprot = go_f,
is_significant = significant,
plot = FALSE,
)
head(go_enrichment, n = 10)
}
# }
Run the code above in your browser using DataLab