## 1. Introduction

The pathway analysis module supports pathway analysis (integrating enrichment analysis and pathway topology analysis) and visualization for 21 model organisms, including Human, Mouse, Rat, Cow, Chicken, Zebrafish, Arabidopsis thaliana, Rice, Drosophila, Malaria, S. cerevisae, E.coli, and others, with a total of ~1600 metabolic pathways.

## 2. Pathway Analysis Example Workflow

In this workflow, we will perform pathway analysis where the input is a list of compound names.

    # Create vector consisting of compounds for enrichment analysis
    tmp.vec <- c("Acetoacetic acid", "Beta-Alanine", "Creatine", "Dimethylglycine", "Fumaric acid", "Glycine", "Homocysteine", "L-Cysteine", "L-Isolucine", "L-Phenylalanine", "L-Serine", "L-Threonine", "L-Tyrosine", "L-Valine", "Phenylpyruvic acid", "Propionic acid", "Pyruvic acid", "Sarcosine")

    # Create mSetObj for storing objects created during your analysis
    mSet<-InitDataObjects("conc", "pathora", FALSE)

    ## [1] "MetaboAnalyst R objects intialized ..."

    # Set up mSetObj with the list of compounds
    mSet<-Setup.MapData(mSet, tmp.vec);

    # Cross reference list of compounds against libraries (hmdb, pubchem, chebi, kegg, metlin)
    mSet<-CrossReferencing(mSet, "name");

    ## [1] "Loaded files from MetaboAnalyst web-server."
    ## [1] "Loaded files from MetaboAnalyst web-server."

    mSet<-CreateMappingResultTable(mSet);

    ## [1] "Loaded files from MetaboAnalyst web-server."

    # Perform matching against compound w. out matches
    mSet<-PerformDetailMatch(mSet, "L-Isolucine");

    ## [1] "Loaded files from MetaboAnalyst web-server."
    ## [1] "Loaded files from MetaboAnalyst web-server."

    # Get list of candidates for matching
    mSet<-GetCandidateList(mSet);

    ## [1] "Loaded files from MetaboAnalyst web-server."

    # Replace selected compound
    mSet<-SetCandidate(mSet, "L-Isolucine", "L-Isoleucine");

    ## [1] "Loaded files from MetaboAnalyst web-server."

    # Select the pathway library, ranging from mammals to prokaryotes
    mSet<-SetKEGG.PathLib(mSet, "hsa")

    # Set the metabolite filter
    mSet<-SetMetabolomeFilter(mSet, F);

    # Calculate the over representation analysis score, here we selected to use the hypergeometric test (alternative is Fisher's exact test)
    # A results table "pathway_results.csv" will be created and found within your working directory
    mSet<-CalculateOraScore(mSet, "rbc", "hyperg")

    ## [1] "Loaded files from MetaboAnalyst web-server."

    # Plot of the Pathway Analysis Overview
    mSet<-PlotPathSummary(mSet, "path_view_0_", "png", 72, width=NA)

    # Plot a specific metabolic pathway, in this case "Glycine, serine and threonine metabolism"
    mSet<-PlotKEGGPath(mSet, "Glycine, serine and threonine metabolism",528, 480, "png", NULL)

    ##
    ## Attaching package: 'BiocGenerics'

    ## The following objects are masked from 'package:parallel':
    ##
    ##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    ##     clusterExport, clusterMap, parApply, parCapply, parLapply,
    ##     parLapplyLB, parRapply, parSapply, parSapplyLB

    ## The following objects are masked from 'package:stats':
    ##
    ##     IQR, mad, sd, var, xtabs

    ## The following objects are masked from 'package:base':
    ##
    ##     Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    ##     as.data.frame, basename, cbind, colMeans, colSums, colnames,
    ##     dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
    ##     intersect, is.unsorted, lapply, lengths, mapply, match, mget,
    ##     order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
    ##     rowMeans, rowSums, rownames, sapply, setdiff, sort, table,
    ##     tapply, union, unique, unsplit, which, which.max, which.min

    ## Warning in arrows(head_from[1], head_from[2], head_to[1], head_to[2], col =
    ## edgeColor, : zero-length arrow is of indeterminate angle and so skipped

    ## Warning in arrows(tail_from[1], tail_from[2], tail_to[1], tail_to[2], col =
    ## edgeColor, : zero-length arrow is of indeterminate angle and so skipped

    ## Warning in arrows(head_from[1], head_from[2], head_to[1], head_to[2], col =
    ## edgeColor, : zero-length arrow is of indeterminate angle and so skipped

    ## [1] "Loaded files from MetaboAnalyst web-server."

## 3. Sweave Report

Following analysis, a comprehensive report can be generated which contains a detailed description of each step performed in the R package, embedded with graphical and tabular outputs. To prepare the sweave report, please use the PreparePDFReport function. You must ensure that you have the nexessary Latex libraries to generate the report (i.e. pdflatex, LaTexiT). The object created must be named mSet, and specify the user name in quotation marks.