Introduction

OmicsNetR is the underlying R package synchronized with OmicsNet web server. It is designed for network-based multi-omics integration and systems-level interpretation. The R package is composed of R functions necessary for the web-server to perform network creation, trimming and analysis.

Following installation and loading of OmicsNetR, users will be able to reproduce web server results from their local computers using the R command history downloaded from OmicsNet website. Running the R functions will allow more flexibility and reproducibility.

Installation

Step 1. Install package dependencies

To use OmcisNetR, make sure your R version is >4.0 and install all package dependencies. Ensure that you are able to download packages from Bioconductor. To install package dependencies, use the BiocManager R package. Note that some of these packages may require additional library dependencies that need to be installed prior to their own successful installation. For example, boost maybe required to compile the source code. User need to install it if there is any error message appears related with it.

install.packages(c("BiocManager", "devtools"));
BiocManager::install(c("igraph","RColorBrewer","BH","qs","RSQLite","Cairo","RJSONIO","ggplot2","lpsymphony","data.table","metap","RandomWalkRestartMH","fitdistrplus","slam","dplyr","ggforce","graphlayouts","httr","plyr","pryr","stringr","rjson","tidyr"))

Step 2. Install the package

OmicsNetR is freely available from GitHub. The package documentation, including the vignettes for each module and user manual is available within the downloaded R package file. If all package dependencies were installed, you will be able to install the OmicsNetR.

Install the package directly from github using the devtools package. Open R and enter:

# Option 1: Install OmicsNetR from git_hub by using devtools
devtools::install_github("xia-lab/OmicsNetR", build = TRUE, build_opts = c("--no-resave-data"))

# Option 2: Install OmicsNetR from source package
install.packages("https://www.xialab.ca/resources/OmicsNetR_1.0.0.tar.gz", repos = NULL, method = "libcurl");

Please try to read the TroubleShooting Section at the bottom of this page if you have some difficulties to install OmicsNetR

Tips for using the OmicsNetR package

  1. The first function that you will use in every module is the Init.Data function, which initiates the dataSet object that stores user’s data for further processing and analysis.
  2. The OmicsNetR package will output data files/tables/analysis/networks outputs in your current working directory.
  3. Every function must be executed in sequence as it is shown on the R Command history, please do not skip any commands as this can result in errors downstream.
  4. Each main function in OmicsNetR is documented. Use the ?Function format to open its documentation. For instance, use ?OmicsNetR::QueryNet to find out more about this function.

Examples

Case 1: Starting from a list of genes

library(OmicsNetR);
rm(list = ls()); # Clear .GlobalEnv of your R session

# Step 1. Initiate the dataSet object
dataSet<-Init.Data();

# Step 2. Map list of genes to the application
dataSet<-PrepareInputList(dataSet,
"#Entrez  logFC
4495  61.12
4496  51.06
4499  23.79
6354  21.04
6369  19.76", 
"hsa", "gene", "entrez");

# Step 3. Identify interacting partners
dataSet<-QueryNet(dataSet, "gene", "innate");

# Step 4. Build interaction subnetwork
dataSet<-CreateGraph(dataSet);

# Step 5. Prepare the network file to be used for visualization, the output will be in JSON format.
dataSet<-PrepareNetwork(dataSet, "subnetwork1", "omicsnet_1.json")

Case 2: Integration of genes and miRNA

library(OmicsNetR);
rm(list = ls()); # Clear .GlobalEnv of your R session

# Step 1. Initiate the dataSet object
dataSet<-Init.Data();

# Step 2. Map list of genes to the application
dataSet<-PrepareInputList(dataSet,
"#Entrez  logFC
4495  61.12
4496  51.06
4499  23.79
6354  21.04
6369  19.76", "hsa", "gene", "entrez");

# Step 2. Map list of miRNA to the application
dataSet<-PrepareInputList(dataSet,
"hsa-mir-101-3p
hsa-mir-133b
hsa-mir-147a
hsa-mir-3140-3p
hsa-mir-361-5p
hsa-mir-510-5p", "hsa", "mir", "mir_id");

# Step 3. Build PPI network from uploaded list of genes
dataSet<-QueryNet(dataSet, "gene", "innate", "gene");

# Step 4. Build miRNA-gene network from uploaded list of miRNA
dataSet<-QueryNet(dataSet, "mir", "mirtarbase", "mir");

# Step 5. Merge networks together through shared nodes and decompose into interconnected subnetworks
dataSet<-CreateGraph(dataSet);

# Step 6. Prepare the network file to be used for visualization, the output will be in JSON format.
dataSet<-PrepareNetwork(dataSet, "subnetwork1", "omicsnet_1.json");

Case 3: LC-MS Peak Annotation

library(OmicsNetR);
rm(list = ls()); # Clear .GlobalEnv of your R session

# Step 1. Initiate the PeakSet and dataSet object
#         If ion mode is positive, set ion as 1, otherwise set as -1. 
#         If p_cutoff equals -1.0, it means not filtering will be applied at current stage.
dataSet<-Init.Data();
InitiatePeakSet(ion = 1, ppm = 10.0, p_cutoff = -1.0);

# Step 2. Import peak data, set organism and compound database
file_path<-system.file("test/malaria_peaks.csv", package = "OmicsNetR");
ImportMSPeaks(PeakFile = file_path);
SetOrganism("hsa");
UpdateCmpdDB(dbNM = "kegg");

# Step 3. Perform Peak Data Pre-processing (prepare node, edge sets and putative annotation on chemical/abiotic artifacts)
PerformDataProcessing();

# Step 4. Perform annotation network propagation
PerformPropagation();

# Step 5. Perform global network optimization
PerformGlobalOptimization();

# Step 6. Perform LC-MS peak annotation
PerformAnnotation();

# Step 7. Annotation results organization for network visulization
dataSet<-PreparePeaksNetwork(dataSet);

# Step 8. Network construction
dataSet<-QueryNet(dataSet, "peak", "default", "peak");

# Step 9. Create network graph
dataSet<-CreateGraph(dataSet);

# Step 10. Prepare the network file to be used for visualization, the output will be in JSON format.
dataSet<-PrepareNetwork(dataSet, "subnetwork1", "omicsnet_0.json")

Case 4: Integration of SNPs and Microbial Taxa

library(OmicsNetR);
rm(list = ls()); # Clear .GlobalEnv of your R session

# Step 1. Initiate the dataSet object
dataSet<-Init.Data();

# Step 2. Input the microbial taxa data
dataSet<-PrepareInputList(dataSet,
"Faecalibacterium_prausnitzii
Bacteroides_uniformis
Eubacterium_rectale
Alistipes_putredinis
Subdoligranulum_unclassified
Escherichia_coli
Bacteroides_vulgatus
Clostridium_clostridioforme
Klebsiella_pneumoniae
Clostridium_hathewayi
Alistipes_shahii
Ruminococcus_obeum", "microbiome", "mic", "species");

# Step 3. Input the SNP data
dataSet<-PrepareInputList(dataSet,
"rs1428554
rs41290504
rs3197999
rs516246
rs2228058", "hsa", "snp", "rsid");

# Step 4. SNP data annotation and network construction
SetSnp2GeneOpts("vep", "", "dis", 1, 5);
dataSet<-QueryNet(dataSet, "snp", "vep", "snp");

# Step 5. Protein-protein extension
SetPpiZero(FALSE);
dataSet<-QueryNet(dataSet, "gene", "huri", "snp");

# Step 6. Protein-metabolite extension based on recon3D database
dataSet<-QueryNet(dataSet, "met", "recon3D", "snp");

# Step 7. Microbial data annotation and network construction
SetOrganism("microbiome");
SetMetPotentialOpts("0.8", "TRUE", "TRUE", "TRUE");
dataSet<-QueryNet(dataSet, "mic", "agora", "mic");

# Step 8. Merge networks together through shared nodes and decompose into interconnected subnetworks
dataSet<-CreateGraph(dataSet);

# Step 9. Prepare the network file to be used for visualization, the output will be in JSON format.
dataSet<-PrepareNetwork(dataSet, "subnetwork1", "omicsnet_0.json");

#Step 10. Exact Compound IDs and perform enrichment analysis
resJson<-fromJSON("omicsnet_0.json")$nodes
ids<-sapply(resJson, function(x){x$id})
ids<-ids[grepl("^C", ids)]
dataSet<-PerformMetEnrichment(dataSet, "omicsnet_enrichment_2", "keggm", paste(ids, collapse = "; "))

Case 5: Integration of Microbial Taxa and LC-MS Peaks

library(OmicsNetR);
rm(list = ls()); # Clear .GlobalEnv of your R session

# Step 1. Initiate the dataSet object
dataSet<-Init.Data();
InitiatePeakSet(ion = 1, ppm = 10.0, p_cutoff = -1.0);

# Step 2. Import LC-MS peaks
file_path<-system.file("test/ibd_peaks_p.csv", package = "OmicsNetR");
ImportMSPeaks(PeakFile = file_path);

# Step 3. Input Microbial taxa data
dataSet<-PrepareInputList(dataSet,"Faecalibacterium_prausnitzii
Bacteroides_uniformis
Eubacterium_rectale
Alistipes_putredinis
Subdoligranulum_unclassified
Escherichia_coli
Alistipes_shahii
Ruminococcus_obeum", "microbiome", "mic", "species");

# Step 4. Perform peak data analysis
UpdateCmpdDB(dbNM = "kegg");
PerformDataProcessing();
PerformPropagation();
PerformGlobalOptimization();
PerformAnnotation();

# Step 5: Prepara peaks and microbial resutls for integration
dataSet<-PreparePeaksNetwork(dataSet);
dataSet<-QueryNet(dataSet, "peak", "default", "peak");
SetOrganism("microbiome");
SetMetPotentialOpts("0.8", "TRUE", "TRUE", "TRUE");
dataSet<-QueryNet(dataSet, "mic", "agora", "mic");

# Step 6: Network Construction
dataSet<-CreateGraph(dataSet);
dataSet<-FilterByPvalue(0.25);

# Step 7: Generate network json file
dataSet<-PrepareNetwork(dataSet, "subnetwork1", "omicsnet_0.json");

# Step 8. Perform enrichment analysis
resJson<-fromJSON("omicsnet_0.json")$nodes;
ids<-sapply(resJson, function(x){x$id});
ids<-ids[grepl("^C(\\d{5})", ids)];
dataSet<-PerformMetEnrichment(dataSet, "omicsnet_enrichment_1", "keggm", paste(ids, collapse = "; "))

Case 6: Comprehensive IBD study of multiple Omics

library(OmicsNetR);
rm(list = ls()); # Clear .GlobalEnv of your R session

# Step 1. Initiate the dataSet object
dataSet<-Init.Data();

# Step 2. Initiate Peak set and import peak data
InitiatePeakSet(ion = 1, ppm = 10.0, p_cutoff = -1.0);
file_path <- system.file("test/ibd_peaks_p.csv", package = "OmicsNetR");
ImportMSPeaks(PeakFile = file_path);

# Step 3. Input the microbial taxa data
dataSet<-PrepareInputList(dataSet,
"Faecalibacterium_prausnitzii
Bacteroides_uniformis
Eubacterium_rectale
Alistipes_putredinis
Subdoligranulum_unclassified
Escherichia_coli
Bacteroides_vulgatus
Clostridium_clostridioforme
Klebsiella_pneumoniae
Clostridium_hathewayi
Alistipes_shahii
Ruminococcus_obeum
Roseburia_inulinivorans
Bacteroides_thetaiotaomicron
Coprococcus_comes
Veillonella_unclassified
Lachnospiraceae_bacterium_3_1_46FAA
Sutterella_wadsworthensis
Odoribacter_splanchnicus
Parabacteroides_distasonis
Roseburia_hominis
Burkholderiales_bacterium_1_1_47
Escherichia_unclassified
Bilophila_unclassified
Dorea_longicatena
Alistipes_unclassified
Clostridium_symbiosum
Eubacterium_hallii
Parasutterella_excrementihominis
Bacteroides_stercoris
Alistipes_finegoldii
Eubacterium_ventriosum
Clostridium_nexile
Clostridium_leptum
Veillonella_parvula
Bacteroides_ovatus
Oscillibacter_unclassified
Bacteroides_finegoldii
Ruminococcus_bromii
Coprobacillus_unclassified
Parabacteroides_merdae
Bacteroides_eggerthii
Veillonella_dispar
Collinsella_aerofaciens
Bacteroides_caccae
Ruminococcus_gnavus",
"microbiome", "mic", "species");

# Step 4. Input the SNP data
dataSet<-PrepareInputList(dataSet,
"rs1428554
rs41290504
rs3197999
rs516246
rs2228058",
"hsa", "snp", "rsid");

# Step 5. Configure and perform peak annotation
UpdateCmpdDB(dbNM = "kegg");
PerformDataProcessing();
PerformPropagation();
PerformGlobalOptimization();
PerformAnnotation();
dataSet<-PreparePeaksNetwork(dataSet);

# Step 6. Build network from uploaded list of peaks, microbiota and SNPs
dataSet<-QueryNet(dataSet, "peak", "default", "peak");
SetMetPotentialOpts("0.8", "TRUE", "TRUE", "TRUE");
dataSet<-QueryNet(dataSet, "mic", "agora", "mic");
SetSnp2GeneOpts("vep", "" ,"dis", 1, 5);
dataSet<-QueryNet(dataSet, "snp", "vep", "snp");
SetPpiZero(FALSE);
dataSet<-QueryNet(dataSet, "gene", "huri", "snp");
dataSet<-QueryNet(dataSet, "met", "recon3", "snp");

# Step 7. Merge networks together through shared nodes and decompose into interconnected subnetworks
dataSet<-CreateGraph(dataSet);

# Step 8. Filter non-significant peaks based on p value
#         Here, we set the cut-off as 0.2
dataSet<-FilterByPvalue(0.2);

# Step 9. Prepare the network file to be used for visualization, the output will be in JSON format.
dataSet<-PrepareNetwork(dataSet, "subnetwork1", "omicsnet_0.json")

Case 7: Save OmicsNet JSON file for saving current analysis.

library(OmicsNetR);
rm(list = ls()); # Clear .GlobalEnv of your R session

# Step 1. Initiate the dataSet object
dataSet<-Init.Data();

# Step 2. Map list of genes to the application
dataSet<-PrepareInputList(dataSet,
"#Entrez  logFC
4495  61.12
4496  51.06
4499  23.79
6354  21.04
6369  19.76", "hsa", "gene", "entrez");

# Step 3. Identify interacting partners
dataSet<-QueryNet(dataSet, "gene", "innate");

# Step 4. Decompose network into interconnected subnetworks
dataSet<-CreateGraph(dataSet);

# Step 5. Save the JSON file, this file can be uploaded again to restore analysis session
SaveNetworkJson("omicsnet_graph_file_1.json")

Case 8: Load OmicsNet JSON file to restore analysis session

library(OmicsNetR);
rm(list = ls()); # Clear .GlobalEnv of your R session

# Step 1. Initiate the dataSet object
dataSet<-Init.Data();

# Step 2. Read graph file, specify correct file format
file_path<- system.file("test/omicsnet_graph_file_1.json", package = "OmicsNetR");
dataSet<-ReadGraphFile(dataSet, file_path, "jsonOmicsnet");

# Step 3. Prepare the network file to be used for visualization, the output will be in JSON format.
dataSet<-PrepareNetwork(dataSet, "subnetwork1", "omicsnet_1.json")

TroubleShooting

OmicsNetR is a cross-platform R pacakage and has been tested from Ubuntu (20.04), Windows (both 10 and 11), MacOS (Catalina). Here are the common issues user may encounter when they do the installation or run the examples/cases.

  • For Ubuntu, "'boost/config.hpp' file not found" when doing the installation.
  • Install Boost by running this command: sudo apt-get install libboost-dev

  • For Windows, "Could not find tools necessary to compile a pacakge" when doing the installation.
  • Install Rtools from here and/or configure it properly.

  • For Windows, "cannot allocate vector of size xx Gb" when doing the analysis.
  • The RAM of your PC is too small to run this analysis. Please increase the RAM (32GB is recommended).

  • For MacOS, Cairo cannot be loaded "Library not loaded: /opt/X11/lib/libXrender.1.dylib".
  • Install XQuartz by downloading it here.

  • For MacOS, "SSL peer certificate or SSH remote key not OK" when running the analysis.
  • Download the latest cacert.pem here and rename it as cert.pem and move it to the dir /etc/ssl with sudo permission.

  • For MacOS, PerformGlobalOptimization crashed when perform the LC-MS peak analysis.
  • The RAM is too small for this case/analysis to annotate the peaks. Please try to increase the RAM (at least 24GB is highly recommended for MacOS).

    Bugs Report

    Please report your cases (your data and R command) to guangyan.zhou[at]xialab.ca if you cannot find a solution from the Troubleshoot section above.