This function has two primary use cases: 1. Annotating pathway information using the output file from PICRUSt2. 2. Annotating pathway information from the output of `pathway_daa` function, and converting KO abundance to KEGG pathway abundance when `ko_to_kegg` is set to TRUE.

pathway_annotation(
  file = NULL,
  pathway = NULL,
  daa_results_df = NULL,
  ko_to_kegg = FALSE
)

Arguments

file

A character, address to store PICRUSt2 export files. Provide this parameter when using the function for the first use case.

pathway

A character, consisting of "EC", "KO", "MetaCyc"

daa_results_df

A data frame, output of pathway_daa. Provide this parameter when using the function for the second use case.

ko_to_kegg

A logical, decide if convert KO abundance to KEGG pathway abundance. Default is FALSE. Set to TRUE when using the function for the second use case.

Value

A data frame containing pathway annotation information. The data frame has the following columns:

  • feature: The feature ID of the pathway (e.g., KO, EC, or MetaCyc ID).

  • description: The description or name of the pathway.

  • Other columns depending on the input parameters and type of pathway.

If ko_to_kegg is set to TRUE, the output data frame will also include the following columns:

  • pathway_name: The name of the KEGG pathway.

  • pathway_description: The description of the KEGG pathway.

  • pathway_class: The class of the KEGG pathway.

  • pathway_map: The KEGG pathway map ID.

Examples

if (FALSE) {
# Prepare the required input files and data frames
# Then, you can use the pathway_annotation function as follows:

# Use case 1: Annotating pathway information using the output file from PICRUSt2
result1 <- pathway_annotation(file = "path/to/picrust2/export/file.txt",
                              pathway = "KO",
                              daa_results_df = NULL,
                              ko_to_kegg = FALSE)

# Use case 2: Annotating pathway information from the output of pathway_daa function
# and converting KO abundance to KEGG pathway abundance
# This use case will be demonstrated using both a hypothetical example, and a real dataset.

## Hypothetical example
hypothetical_daa_results_df <- data.frame() # Replace this with your actual data frame
result2 <- pathway_annotation(file = NULL,
                              pathway = "KO",
                              daa_results_df = hypothetical_daa_results_df,
                              ko_to_kegg = TRUE)

## Real dataset example
# Load the real dataset
data(daa_results_df)
result3 <- pathway_annotation(file = NULL,
                              pathway = "KO",
                              daa_results_df = daa_results_df,
                              ko_to_kegg = TRUE)
}