Skip to content

slancast/MetENP

 
 

Repository files navigation

MetENP

Metabolite enrichment analysis and their associated enriched pathways.

Introduction to Enrichment Pipeline

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

  1. Enrichment score of metabolite class,
  2. Maps to pathway of the species of choice,
  3. Calculate enrichment score of pathways,
  4. Plots the pathways and shows the metabolite increase or decrease
  5. 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).

Installation

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 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

  1. 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: Binder

Detailed instructions

The syntax of paths is for linux/unix operating system. It can be adjusted for Windows.

(1) If one needs to install Jupyter

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
]]

# is comment, $ at start indicates linux command

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

(2) How to Install MetENP R package through R devtools in user area

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.

# install MetENP R package in user area (e.g., /home/username/.local):

$cd ~/.local; mkdir R;

Go to the folder one-level up of MetENP folder.

[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()

# if all went well, this would have installed MetENP in /home/username/.local/R

$ 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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 99.5%
  • Shell 0.5%