-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
222 lines (175 loc) · 12.7 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
---
output: github_document
editor_options:
chunk_output_type: console
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
#https://pkgdown.r-lib.org/reference/build_home.html
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "vignettes",
out.width = "100%"
)
```
# MetaProViz <img src="vignettes/Hexagon_MetaProViz.png" align="right" width="200" />
<!-- badges: start -->
[![Lifecycle: maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![GitHub issues](https://img.shields.io/github/issues/saezlab/MetaProViz)](https://github.com/saezlab/MetaProViz/issues)
<!-- badges: end -->
## **Short Introduction**
**MetaProViz** (**Meta**bolomics **Pr**ocessing, functi**o**nal analysis and **Vi**suali**z**ation), a free open-source R-package that provides mechanistic hypotheses from metabolomics data by integrating prior knowledge from literature with metabolomics. MetaProViz offers an interactive framework consisting of four modules: Processing, differential analysis, functional analysis and visualization of both intracellular and exometabolomics (=consumption-release (CoRe) data). Those modules and their functions can be used independently from each other or in combination (**Fig.1**).
\
<center>
![**Fig. 1:** Overview of MetaProViz functions.](https://github.com/saezlab/MetaProViz/blob/development/vignettes/Fig.1.png?raw=true){width=90%}
</center>
\
\
The first module, **MetaProViz**, `Processing`, allows the customized processing of raw peak metabolomics data from different experimental setups, including options to perform feature filtering due to missingness, Total Ion Count (TIC) normalisation, Missing Value Imputation (MVI) based on half-minimum and outlier detection based on Hotellin's T2. All of these pre-processing parameters can be customized and combined as needed.\
The second module of **MetaProViz**, `Differential Metabolite Analysis (DMA)`, allows the user to perform differential analysis between two conditions (e.g. Tumour versus Healthy) calculating the Log2FC, p-value, adjusted p-value and t-value, whereby the user can choose all the test statistics. The input can either be the output of the `Preprocessing` module or any DF including metabolite values and information about the conditions that should be compared.\
The third module of **MetaProViz**, `Functional Analysis`, includes different methods to create clusters of metabolites based on their distribution across the data using logical regulatory rules, prior knowledge for enrichment analysis and functions to perform over representation analysis (ORA). Here, the user can either input the output of the `Processing` or `Differential Metabolite Analysis (DMA)` module, or any other DF including Log2FC and statistics or metabolite values.\
The fourth module of **MetaProViz**, `Visualization`, can easily create customized visualizations of the output results of each of the other **MetaProViz** modules or custom files. Here we not only enable overview plots such as PCA, heatmap, Volcano plot, but also individual graphs of each metabolite as bar graphs, box plots or violin plots. Moreover, the user can provide additional information such as pathways the metabolites correspond to, the clusters the metabolites where assigned to or any other meta-information to customize the plots for color, shape or selections, thus enabling biological interpretation of the results otherwise missed in the data.
## Tutorials
We have generated several tutorials showcasing the different functionalities MetaProViz offers using publicly available datasets, which are included as example data within **MetaProViz**. You can find those tutorial on the top under the "Tutorials" button, where you can follow specific user case examples for different analysis. Otherwise, you can also follow the links below:\
- [Standard metabolomics data](https://saezlab.github.io/MetaProViz/articles/Standard%20Metabolomics.html)\
- [Consumption-Release (CoRe) metabolomics data from cell culture media](https://saezlab.github.io/MetaProViz/articles/CoRe%20Metabolomics.html)\
- [Enrichment Analysis](https://saezlab.github.io/MetaProViz/articles/EnrichmentAnalysis.html)\
- [Metadata Analysis](https://saezlab.github.io/MetaProViz/articles/Metadata%20Analysis.html)\
\
Here you will find a brief overview and information about the installation of the package and its dependencies.
## Example Data
clear cell Renal Cell Carcinoma (ccRCC) patients data from Hakimi et. al including 138 matched tumour and normal tissue pairs [@Hakimi2016]. Cell-lines data from intra- and extracellular metabolomics data from cell culture media from [metabolomics workbench project PR001418](https://www.metabolomicsworkbench.org/data/DRCCMetadata.php?Mode=Project&ProjectID=PR001418).
```{r, echo=FALSE, fig.width=10, fig.height=5.5, fig.align="left"}
suppressMessages(suppressWarnings( library(tidyverse)))
# Create an overview of the example data
TissuePlot <- MetaProViz::ToyData("Tissue_Norm")%>%
filter(TISSUE_TYPE != "NORMAL")%>%
separate(`TYPE-STAGE`, into=c("Type", "Stage"), sep="-", remove=FALSE)
TissuePlot$Count <- 1
TissuePlot$AGEFactor <- factor(TissuePlot$AGE, levels = c("Young","Middle", "Old"))
#Plot
Plot <- ggplot2::ggplot(TissuePlot, ggplot2::aes(fill=Stage, y=Count, x=AGEFactor)) +
ggplot2::geom_bar(position="stack", stat="identity")+
ggplot2::scale_fill_manual(values = c("STAGE I" = "#006384" , "STAGE II" = "#9F0162", "STAGE III" = "#00735C" , "STAGE IV" = "grey" ))+
ggplot2::theme_classic()+
ggplot2::ggtitle("ccRCC patients metadata")+
ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 90, hjust = 1))+
ggplot2::labs(subtitle="Age at surgery <42 = Young, >58 = Old, else = Middle", x = "Age", y = "Number of Patients")
Plot_Sized <- MetaProViz:::plotGrob_Superplot(InputPlot=Plot, SettingsInfo=c(Conditions="Conditions", Superplot="Conditions"), SettingsFile_Sample=TissuePlot%>%dplyr::rename("Conditions"="AGE"), PlotName = "ccRCC patients metadata", Subtitle = "Age at surgery <42 = Young, >58 = Old, else = Middle", PlotType="Bar")
PlotHeight <- grid::convertUnit(Plot_Sized$height, 'cm', valueOnly = TRUE)
PlotWidth <- grid::convertUnit(Plot_Sized$width, 'cm', valueOnly = TRUE)
Plot_Sized %<>%
{ggplot2::ggplot() + ggplot2::annotation_custom(.)} %>%
magrittr::add(ggplot2::theme(panel.background = ggplot2::element_rect(fill = "transparent")))
#ggplot2::ggsave(filename = "Tissue_MetadataPlot.svg", plot = Plot_Sized, width = PlotWidth, height = PlotHeight, unit="cm")
Plot_Sized_Tissue <- Plot_Sized
###################################################################################################################################################
# Create an overview of the example data
CellPlot_Intra <- MetaProViz::ToyData(Data="IntraCells_Raw")%>%
filter(Conditions != "Pool")%>%
mutate(Celltype = case_when(Conditions=="HK2" ~ 'Healthy',
Conditions=="786-O" ~ 'PrimaryTumour',
TRUE ~ 'MetastaticTumour'))
CellPlot_Intra$Count <- 1
CellPlot_Intra$CelltypeFactor <- factor(CellPlot_Intra$Celltype, levels = c("Healthy","PrimaryTumour", "MetastaticTumour"))
CellPlot_Media <- MetaProViz::ToyData(Data="CultureMedia_Raw")%>%
filter(Conditions != "Pool")%>%
filter(Conditions != "blank")%>%
mutate(Celltype = case_when(Conditions=="HK2" ~ 'Healthy',#https://www.mdpi.com/1422-0067/24/7/6447
Conditions=="786-O" ~ 'PrimaryTumour',
Conditions=="OSRC2" ~ 'PrimaryTumour',
Conditions=="RFX6" ~ 'PrimaryTumour',
TRUE ~ 'MetastaticTumour'))#OSLM1
#Plot
Plot <- ggplot2::ggplot(CellPlot_Intra, ggplot2::aes(fill=Conditions, y=Count, x=CelltypeFactor)) +
ggplot2::geom_bar(position="stack", stat="identity")+
ggplot2::scale_fill_manual(values = c("HK2" = "#006384" , "786-O" = "#9F0162", "786-M1A" = "#00735C", "786-M2A" = "#00422E"))+
ggplot2::theme_classic()+
ggplot2::ggtitle("Intracellular metabolomics")+
ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 90, hjust = 1))+
ggplot2::labs(x = "Celltype", y = "Number of Samples", fill ="Cellline")
Plot_Sized <- MetaProViz:::plotGrob_Superplot(InputPlot=Plot, SettingsInfo=c(Conditions="Conditions", Superplot="Conditions"), SettingsFile_Sample=CellPlot_Intra%>%dplyr::rename("Name"="Conditions", "Conditions"="Celltype"), PlotName = "Intracellular metabolomics", Subtitle = NULL, PlotType="Bar")
PlotHeight <- grid::convertUnit(Plot_Sized$height, 'cm', valueOnly = TRUE)
PlotWidth <- grid::convertUnit(Plot_Sized$width, 'cm', valueOnly = TRUE)
Plot_Sized %<>%
{ggplot2::ggplot() + ggplot2::annotation_custom(.)} %>%
magrittr::add(ggplot2::theme(panel.background = ggplot2::element_rect(fill = "transparent")))
#ggplot2::ggsave(filename = "Cellline_IntraPlot.svg", plot = Plot_Sized, width = PlotWidth, height = PlotHeight, unit="cm")
Plot_Sized_Intra <- Plot_Sized
###################################################################################################################################################
# Create an overview of the example data
CellPlot_Media <- MetaProViz::ToyData(Data="CultureMedia_Raw")%>%
filter(Conditions != "Pool")%>%
filter(Conditions != "blank")%>%
mutate(Celltype = case_when(Conditions=="HK2" ~ 'Healthy',#https://www.mdpi.com/1422-0067/24/7/6447
Conditions=="786-O" ~ 'PrimaryTumour',
Conditions=="OSRC2" ~ 'PrimaryTumour',
Conditions=="RFX631" ~ 'PrimaryTumour',
TRUE ~ 'MetastaticTumour'))#OSLM1
CellPlot_Media$Count <- 1
CellPlot_Media$CelltypeFactor <- factor(CellPlot_Media$Celltype, levels = c("Healthy","PrimaryTumour", "MetastaticTumour"))
#Plot
Plot <- ggplot2::ggplot(CellPlot_Media, ggplot2::aes(fill=Conditions, y=Count, x=CelltypeFactor)) +
ggplot2::geom_bar(position="stack", stat="identity")+
ggplot2::scale_fill_manual(values = c("HK2" = "#006384" , "786-O" = "#d03293", "OSRC2"= "#9F0162" , "RFX631"= "#630026", "786-M1A" = "#00735C", "786-M2A" = "#00422E", "OSLM1B"= "#002B1A"))+
ggplot2::theme_classic()+
ggplot2::ggtitle("Media metabolomics")+
ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 90, hjust = 1))+
ggplot2::labs(x = "Celltype", y = "Number of Samples", fill ="Cellline")
Plot_Sized <- MetaProViz:::plotGrob_Superplot(InputPlot=Plot, SettingsInfo=c(Conditions="Conditions", Superplot="Conditions"), SettingsFile_Sample=CellPlot_Media%>%dplyr::rename("Name"="Conditions", "Conditions"="Celltype"), PlotName = "Media metabolomics", Subtitle = NULL, PlotType="Bar")
PlotHeight <- grid::convertUnit(Plot_Sized$height, 'cm', valueOnly = TRUE)
PlotWidth <- grid::convertUnit(Plot_Sized$width, 'cm', valueOnly = TRUE)
Plot_Sized %<>%
{ggplot2::ggplot() + ggplot2::annotation_custom(.)} %>%
magrittr::add(ggplot2::theme(panel.background = ggplot2::element_rect(fill = "transparent")))
#ggplot2::ggsave(filename = "Cellline_Plot.svg", plot = combined_plot, width = PlotWidth, height = PlotHeight, unit="cm")
Plot_Sized_Media <- Plot_Sized
gridExtra::grid.arrange(Plot_Sized_Tissue, Plot_Sized_Intra, Plot_Sized_Media, ncol=3)
```
## Installation
**MetaProViz** is an R package and to install the package, start R and enter:
```{r github_install, eval=FALSE}
devtools::install_github("https://github.com/saezlab/MetaProViz")
```
Now **MetaProViz** can be imported as:
```{r load_library, eval=FALSE}
library(MetaProViz)
```
### Dependencies
If you are using **MetaProViz** the following packages are required:\
```
"tidyverse"
"ggplot2"
"factoextra"
"qcc"
"hash"
"reshape"
"gridExtra"
"inflection"
"patchwork"
"clusterProfiler"
"ggupset"
"gtools"
"EnhancedVolcano"
"writexl"
"pheatmap"
"ggfortify"
```
\
While we have done our best to ensure all the dependencies are documented, if they aren't please let us know and we will try to resolve them.
### Windows specifications
Note if you are running Windows you might have an issue with long paths, which you can resolve in the registry on Windows 10:
Computer Configuration > Administrative Templates > System > Filesystem > Enable Win32 long paths
(If you have a different version of Windows, just google "Long paths fix" and your Windows version)
## Liscence
GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007
## Citation
```
@Manual{,
title = {MetaProViz: METabolomics pre-PRocessing, functiOnal analysis and VIZualisation},
author = {Christina Schmidt, Dimitrios Prymidis, Macabe Daley, Denes Turei, Julio Saez-Rodriguez and Christian Frezza},
year = {2023},
note = {R package version 2.1.3},
}
```