# Load the dataset
data("ko_to_go_reference")
# Explore the dataset structure
head(ko_to_go_reference)
str(ko_to_go_reference)
# Check the distribution of GO categories
table(ko_to_go_reference$category)
# Find GO terms related to polymerase activity
polymerase_terms <- ko_to_go_reference[
grepl("polymerase", ko_to_go_reference$go_name, ignore.case = TRUE), ]
head(polymerase_terms)
# Get KO members for a specific GO term (RNA polymerase activity)
rna_pol <- ko_to_go_reference[ko_to_go_reference$go_id == "GO:0003899", ]
if (nrow(rna_pol) > 0) {
ko_list <- strsplit(rna_pol$ko_members, ";")[[1]]
cat("KO identifiers for RNA polymerase activity:", paste(ko_list, collapse = ", "))
}
# Use in pathway analysis
if (FALSE) {
library(ggpicrust2)
library(tibble)
# Load example data
data("ko_abundance")
data("metadata")
# Perform GO pathway GSEA analysis
gsea_results <- pathway_gsea(
abundance = ko_abundance %>% column_to_rownames("#NAME"),
metadata = metadata %>% column_to_rownames("sample_name"),
group = "Environment",
method = "fgsea",
pathway_type = "GO",
go_category = "MF",
rank_method = "signal2noise"
)
# View results
head(gsea_results)
}
Run the code above in your browser using DataLab