Metabolite enrichment analysis and their associated enriched pathways.
MetENP is a R package that enables detection of significant metabolites from metabolite information (names or names and concentration along with metadata information) and provides
For more info, check out the vignette. Contact: biosonal@gmail.com; kschoudhary@eng.ucsd.edu, Mano Maurya (mano@sdsc.edu) or Sumana Srinivasan (susrinivasan@eng.ucsd.edu).
A BioRxiv preprint on MetENP is available at: https://www.biorxiv.org/content/10.1101/2020.11.20.391912v1 (DOI: https://doi.org/10.1101/2020.11.20.391912). Please follow the details at the GitHub page (this page) to ensure you use the latest version.
Download the MetENP R package: On linux/unix command prompt (or download a zip file by clicking on "Code" and unpack the zip file to a local folder):
$git clone https://github.com/metabolomicsworkbench/MetENP.git MetENP
Start R and install devtools.
install.packages("devtools") library("devtools")
MetENP package depends on following Bioconductor packages to function properly: KEGGREST, KEGGgraph, and pathview. You may need to install these via:
if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install("KEGGREST") BiocManager::install("KEGGgraph") BiocManager::install("pathview")
#### Now proceed with installation 1) Through devtools
devtools::install("MetENP")
If you do not have admin privileges, you can install the packages in the user area, e.g., /home/username/.local/R. Please see detailed instructions below.
If above steps give error: Install other dependencies and then try installing again: plyr,dplyr,tidyr,purrr,tidygraph,reshape2,ggplot2,ggrepel, igraph,ggraph,httr,stringr,jsonlite,rjson,tidyverse,magrittr
2) Through Anaconda
A conda environment.yml file is present in the repository. This file can be used be with Anaconda to install all of the R requirements.
Create the conda environment and activate the environment by running:
conda env create -n metenp -f environment.yml
conda activate metenp
suppressMessages(library(plyr)) suppressMessages(library(dplyr)) suppressMessages(library(tidyr)) suppressMessages(library(tidygraph)) suppressMessages(library(KEGGREST)) suppressMessages(library(KEGGgraph))
suppressMessages(library(pathview)) suppressMessages(library(reshape2)) suppressMessages(library(ggplot2)) suppressMessages(library(ggrepel)) suppressMessages(library(igraph)) suppressMessages(library(ggraph)) suppressMessages(library(httr)) suppressMessages(library(stringr)) suppressMessages(library(jsonlite)) suppressMessages(library(rjson)) suppressMessages(library(tidyverse)) suppressMessages(library(tictoc))
source('path/compoundinfo.R') source('path/anova_ana.R') source('path/met_pathways.R') source('path/mapspspath.R') source('path/metclassenrichment.R') source('path/metcountplot.R') source('path/getmwstudies.R') source('path/path_enrichmentscore.R') source('path/pathinfo.R') source('path/plot_met_enrichment.R') source('path/plot_volcano.R') source('path/rxninfo.R') source('path/significant_met.R') source('path/significant_met_own.R') source('path/enzyme_gene_info.R') source('path/plot_heatmap.R') source('path/plot_pathway_networks.R') source('path/react_substrate.R') source('path/dotplot_met_class_path.R') source('path/convert_refmet.R') source('path/map_keggid.R') source('path/partial_join.R') source('path/getExtension.R') source('path/separate_data.R')
Now please follow example in the vignette
Run the vignette Jupyter Notebook on the web using My Binder:
The syntax of paths is for linux/unix operating system. It can be adjusted for Windows.
If already installed, this section can be ignored.
[[ for general information only: basic commands: whereis python3 # can check version by starting python3 system python packages go to: /usr/lib/python3.9 /usr/lib64/python3.9 [if installed via sudo dnf] /usr/local/lib/python3.9 /usr/local/lib64/python3.9 [if installed via sudo pip3] user/local python typically goes into $HOME/.local/various-folders system R is at /usr/bin/R /usr/lib64/R system R packages go into /usr/lib64/R/library ]]
Be in your home folder, /home/username: # install jupyter in user area, in the folder /home/username/.local/bunch-of-folders $pip3 install --user --no-cache-dir jupyter # test it $ jupyter notebook --ip=your_ip_address_format_123.249.124.012 --port=8080 Go to the page listed, e.g., http://123.249.124.012:8080/?token=4228fsdrjh346t3fdgve716452997a25f3e36b0dc2c3f02a3a0aa34 User can try to open any existing jupyter notebook if they are in the folder/subfolder ctrl-C to stop Install R package IRkernel # need to install R kernel for jupyter in user area; set libloc to user area, e.g., ${HOME}/.local/R if you do not have admin privileges. # start R, being in home area ; > indicates R prompt $R >reposlink = 'http://cran.r-project.org'; libloc = "/usr/lib64/R/library/"; >pkgnames = c('IRkernel'); install.packages(pkgnames, repos=reposlink, lib=libloc); >IRkernel::installspec() # for only current user >q() $ls -al .local/share/jupyter/kernels/ The output will appear similar to the lines below: total 0 drwxrwxr-x. 4 username username 31 Nov 1 00:08 . drwxrwxr-x. 7 username username 140 Nov 2 10:45 .. drwxr-xr-x. 2 username username 64 Nov 1 00:08 ir drwxrwxr-x. 2 username username 69 Oct 27 22:40 python3
$ jupyter notebook --ip=123.249.124.012 --port=8080
Here, we use KEGGREST as an example, which was updated in its GitHub repo in the devel branch:
Being in some user folder, do:
$ git clone -b devel https://github.com/Bioconductor/KEGGREST.git KEGGREST
This downloads the source files into the folder KEGGREST. Install it into a subfolder R: $ mkdir R $ R >library("devtools"); USER_PWD=Sys.getenv("PWD");devtools::install("KEGGREST", args = paste0("--library=", USER_PWD, "/R")); # Instructions for installing devtools are given below. ># To use this installation of KEGGREST in installing MetENP below, do: >.libPaths( c( paste0(USER_PWD, "/R"), .libPaths() ));library(KEGGREST); # Replace the first argument to any other path as desired
If already installed, this section can be ignored. Download or clone MetENP folder from github. Be careful not to overwrite existing folders [create and be in a different folder as needed]. $git clone https://github.com/metabolomicsworkbench/MetENP.git MetENP The necessary files for installing MetENP R package are located inside the sub-folder R inside the MetENP folder.
$cd ~/.local; mkdir R;
If you want to install MetENP R package in the folder USER_PWD/R below, create the R folder. [username@server one-level-up-of-MetENP]$mkdir R [username@server one-level-up-of-MetENP]$R
# If devtools is not already installed for all, install it in system R or user R area (see how to set libloc below) >USER_HOME=Sys.getenv("HOME"); # so that we don’t need to hard code /home/username >reposlink = 'http://cran.r-project.org'; libloc = paste0(USER_HOME, “/.local/R/"); >#pkgnames = c("devtools"); install.packages(pkgnames, repos=reposlink, lib=libloc); >library("devtools"); >devtools::install("MetENP", args = paste0("--library=", USER_HOME, "/.local/R")); # for unix local account # uses R CMD INSTALL
>USER_PWD=Sys.getenv("PWD"); >devtools::install("MetENP", args = paste0("--library=", USER_PWD, "/R")); # for unix local account # uses R CMD INSTALL >q()
One-liner for the above: >library("devtools"); USER_HOME=Sys.getenv("HOME");devtools::install("MetENP", args = paste0("--library=", USER_HOME, "/.local/R")); # for unix local account # uses R CMD INSTALL >library("devtools"); USER_PWD=Sys.getenv("PWD");devtools::install("MetENP", args = paste0("--library=", USER_PWD, "/R")); # for unix local account # uses R CMD INSTALL
$ ls -al /home/username/.local/R
# to check if MetENP can be loaded $R # modify .libPaths so that it can find R package MetENP >USER_HOME=Sys.getenv("HOME"); >USER_PWD=Sys.getenv("PWD"); >.libPaths( c( paste0(USER_HOME, "/.local/R"), .libPaths() )); # since MetENP installed in user area, need to include that in path >#.libPaths( c( paste0(USER_PWD, "/R"), .libPaths() )); # If installed in the R folder inside PWD
>library("MetENP") # should load without errors
One-liner for the above: >USER_HOME=Sys.getenv("HOME"); .libPaths( c( paste0(USER_HOME, "/.local/R"), .libPaths() )); library("MetENP"); >USER_PWD=Sys.getenv("PWD"); .libPaths( c( paste0(USER_PWD, "/R"), .libPaths() )); library("MetENP");
# Now ready to run jupyter, being in a folder containing *.ipynb file, e.g., /path-to-MetENP-folder/vignettes/ $ jupyter notebook --ip=123.249.124.012 --port=8080 Go to webpage listed and open a MetENP jupyter notebook Near top in that file, insert the lines, or some of these lines to set .libPaths and load MetENP R library. USER_HOME=Sys.getenv("HOME"); USER_PWD=Sys.getenv("PWD"); .libPaths( c( paste0(USER_HOME, "/.local/R"), .libPaths() ))
library("MetENP") # Now, it should load without errors
When possible, it is best to adjust them using arguments passed to function. If that is not possible, e.g., because the corresponding variable cannot be set through the arguments passed, then make a copy of the relevant R file in the folder ..../MetENP/R, edit the file/function suitably and save. Then source the file, e.g.: >source("PATH-TO-MetENP-FOLDER/R/significant_met_edited.R"); You may also have to load some libraries (see the lines with @importFrom in the R file) if such error messages are displayed. Once the edits are final, the edited file can be renamed (please keep a backup of the original file first) to the original file name and the MetENP package can be rebuilt using the steps above.
Assuming that roxygen tags are also updated accordingly for adding/removing arguments (e.g., in the line(s) #'@param and the line after #'@examples), then use the commmand:
>devtools::document('MetENP')
This will update the .rd files inside MetENP/man; reinstall the MetENP package again using the procedure explained above.
Use the command rcmdcheck >rcmdcheck("MetENP")
to identify errors/warning/notes.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.