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
- Enrichment score of metabolite class,
- Maps to pathway of the species of choice,
- Calculate enrichment score of pathways,
- Plots the pathways and shows the metabolite increase or decrease
- Gets gene info, reaction info, enzyme info
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).
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")
- Through devtools
devtools::install("MetENP")
If you do not have admin priviligages, 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
-
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
If you do not wish to install, alternatively, download from github(https://github.com/metabolomicsworkbench/MetENP) and load libraries and functions
suppressMessages(library(plyr))
suppressMessages(library(dplyr))
suppressMessages(library(tidyr))
suppressMessages(library(tidygraph))
suppressMessages(library(KEGGREST))
suppressMessages(library(KEGGgraph))
#suppressMessages(library(KEGG.db)); # only for BiocManager version < 3.13
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))
And load all the function with appropriate path (replace 'path' to your own path, e.g., they are inside R folder relative to the MetENP folder).
Please note this step is needed only when you do not wish to download or are hving difficulty in downloading the package
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
# now jupyter notebooks based on R code should work after you select R kernel after starting jupyter
$ jupyter notebook --ip=123.249.124.012 --port=8080
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;
[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
>q()
$ 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");
>.libPaths( c( .libPaths(), paste0(USER_HOME, "/.local/R") )); # since MetENP installed in user area, need to include that in path
>library("MetENP") # should load without errors
# 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");
>.libPaths( c( .libPaths(), paste0(USER_HOME, "/.local/R") ))
>library("MetENP") # should load without errors