knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  out.width = "100%"
)
library(metPath)

Load packages

library(metPath)
library(tidyverse)

Load KEGG pathway human database

data("kegg_hsa_pathway", package = "metPath")
kegg_hsa_pathway
get_pathway_class(kegg_hsa_pathway)

Pathway enrichment

We use the demo compound list from metPath.

data("query_id_kegg", package = "metPath")
query_id_kegg

Remove the disease pathways:

remain_idx =
  kegg_hsa_pathway@pathway_class %>%
  unlist() %>%
  stringr::str_detect("Disease") %>%
  `!`() %>%
  which()

pathway_database =
  filter_pathway(object = kegg_hsa_pathway, remain_idx = remain_idx)
result = 
enrich_kegg(query_id = query_id_kegg, 
            query_type = "compound", 
            id_type = "KEGG",
            pathway_database = pathway_database, 
            p_cutoff = 0.05, 
            p_adjust_method = "BH", 
            threads = 3)

Check the result:

result

Plot to show Pathway enrichment

enrich_bar_plot(object = result)
enrich_scatter_plot(object = result)
enrich_network(object = result)


jaspershen/metPath documentation built on March 14, 2021, 12:07 a.m.