Skip to content

Commit e9cefc4

Browse files
rename metrics (#4)
* clean up lasso experiment remnants * sync package loading with req.txt file * clean up redudant code to check and install packages * update dockerfile to fix config errors when building * set up tests for mzML and Bruker file loading * clean up main directory * activate GHA caching * fix `zoo` dependency problem * remove browser() for debugging pca plots. * update actions/cache to v4.0.2 * update GHA to use versions instead of hashes * add tests to GHA * add test that checks if processing was sucessful * set smoothHalfWindowSize to a more reasonable value * remove devtools and use pak instead * update metrics naming (mod Z' -> FZ, mod V' -> FV, SSMD -> FS
1 parent be44526 commit e9cefc4

File tree

10 files changed

+111
-93
lines changed

10 files changed

+111
-93
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ testdata_bruker.zip
1010
testdata_mzML.zip
1111
Curve
1212
mzMl
13+
bayer_export.R

README.md

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
1-
<img src="figures/M2ara_Logo.png" alt="M²ara overview" width="100" height="100">
2-
3-
# M²ara - MALDI MS Bioassays Evaluation and Classification App
1+
# M2ara <img src="figures/logo_resized.png" align="right" height="120"/>
42

53
M²ara is a software tool to facilitate the exploration of metabolomic responses in complex matrix-assisted laser desorption/ionization mass spectrometry (MALDI MS) bioassays. The app is intended for the evaluation of metabolomic drug actions by using the mass-to-charge ratios of hundreds of metabolites and it is particularly useful in defining novel pharmacodynamic biomarkers for high-throughput applications.
64

75
M²ara is based on the R package [MALDIcellassay](https://github.com/CeMOS-Mannheim/MALDIcellassay) (published in [Unger et. al. 2021](https://www.nature.com/articles/s41596-021-00624-z), Nature Protocols) and extends its capabilities with a GUI and adds helpful features like clustering of curves, PCA analysis as well as the Curve Response Score (CRS) which enables fast screening for molecules regulated by drug treatment.
86

9-
For more information please check out the [preprint](https://chemrxiv.org/engage/chemrxiv/article-details/663a1d0f418a5379b0aa286b).
7+
For more information please check out the [preprint](https://chemrxiv.org/engage/chemrxiv/article-details/663a1d0f418a5379b0aa286b).
108

11-
<img src="figures/Workflow_figure.png" alt="M²ara workflow overview" width="100%">
9+
<img src="figures/Workflow_figure.png" alt="M²ara workflow overview" width="100%"/>
1210

1311
## How to use
1412

15-
This application simplifies the analysis of Molecular High Content Screening (MHCS) MALDI-TOF MS assay data and the evaluation of complex drug actions. After your data has been loaded, you can adjust settings as needed and start the processing. From here, you can analyze your data by selecting entries in the data table, visually inspect and rank mass features using the Curve Response Score (CRS) fingerprints, and save the curve fit and peak profile of your chosen *m/z* value.
13+
This application simplifies the analysis of Molecular High Content Screening (MHCS) MALDI-TOF MS assay data and the evaluation of complex drug actions. After your data has been loaded, you can adjust settings as needed and start the processing. From here, you can analyze your data by selecting entries in the data table, visually inspect and rank mass features using the Curve Response Score (CRS) fingerprints, and save the curve fit and peak profile of your chosen *m/z* value.
1614

1715
This app is specifically designed for use with Bruker flex series raw data but also features support for mzML.
1816

1917
For more detailed information please take a look at the [Manual](manual.md) that is also available inside the app.
2018

21-
<img src="figures/gui_example.png" alt="M²ara GUI overview" width="100%">
19+
<img src="figures/gui_example.png" alt="M²ara GUI overview" width="100%"/>
2220

23-
## How to install
21+
## How to install
2422

2523
### R
2624

2725
Clone the GitHub repository to your local machine (please make sure to have R installed, tested with **R v4.3.2**) and start the app by sourcing the `app.R` file.
2826

29-
```bash
27+
``` bash
3028
git clone https://github.com/CeMOS-Mannheim/M2ara.git
3129
```
3230

33-
```R
31+
``` r
3432
# install all packages needed
3533
source("install_packages.R")
3634

@@ -39,41 +37,42 @@ source("app.R")
3937
```
4038

4139
### Docker
42-
Install the [docker container](https://hub.docker.com/repository/docker/thomasenzlein/m2ara), run it and access `localhost:3838` to interact with the app.
43-
Don't forget to change the path `c:/path/to/massSpecData` to your data so that it can be mounted when running the container.
4440

45-
```bash
41+
Install the [docker container](https://hub.docker.com/repository/docker/thomasenzlein/m2ara), run it and access `localhost:3838` to interact with the app. Don't forget to change the path `c:/path/to/massSpecData` to your data so that it can be mounted when running the container.
42+
43+
``` bash
4644
docker pull thomasenzlein/m2ara:main
4745
```
4846

49-
```bash
47+
``` bash
5048
docker run -p 3838:3838 -v c:/path/to/massSpecData:/mnt thomasenzlein/m2ara:main
5149
```
5250

5351
### Stand-alone installer for Windows
54-
Use the stand-alone installer (Windows only, no R installation needed).
55-
The installer can be downloaded [here](https://github.com/CeMOS-Mannheim/M2ara/releases/download/1.4.1/M2ara_1.4.1.exe).
52+
53+
Use the stand-alone installer (Windows only, no R installation needed). The installer can be downloaded [here](https://github.com/CeMOS-Mannheim/M2ara/releases/download/1.4.1/M2ara_1.4.1.exe).
5654

5755
## Example data
58-
To test the app please use the example data on [FigShare](https://dx.doi.org/10.6084/m9.figshare.25736541).
56+
57+
To test the app please use the example data on [FigShare](https://dx.doi.org/10.6084/m9.figshare.25736541).
5958

6059
#### Unger2020_OATP2B1_inhibition_mzML.zip
6160

6261
The file contains mzML data (converted from Bruker Flex using MSConvert) originally published in Unger, et. al., 2020.
6362

6463
To replicate the results shown use the following parameters:
6564

66-
- under Settings set File Format to mzML
67-
- set Concentration unit to nM
68-
- set Normalization/re-calibration *m/z* to 354.1418 (D4-E3S, [M-H]<sup>-</sup>)
69-
- set recalibration tolerance to 0.1 Da
70-
- set normalization to *m/z*
71-
- deactivate smoothing and activate baseline removal
72-
- set Aggregation method to mean
73-
- set SNR to 3
74-
- set alignment to 0 mDa (no alignment)
75-
- set binning tolerance to 100 ppm
76-
- select the folder `mzML` (parent folder of the mzML files) from the .zip file, please make sure that no other files are in this folder.
65+
- under Settings set File Format to mzML
66+
- set Concentration unit to nM
67+
- set Normalization/re-calibration *m/z* to 354.1418 (D4-E3S, [M-H]<sup>-</sup>)
68+
- set recalibration tolerance to 0.1 Da
69+
- set normalization to *m/z*
70+
- deactivate smoothing and activate baseline removal
71+
- set Aggregation method to mean
72+
- set SNR to 3
73+
- set alignment to 0 mDa (no alignment)
74+
- set binning tolerance to 100 ppm
75+
- select the folder `mzML` (parent folder of the mzML files) from the .zip file, please make sure that no other files are in this folder.
7776

7877
Alternatively, copy the [this file](https://github.com/CeMOS-Mannheim/M2ara/blob/main/tests/testthat/settings_mzML_data.csv) as `settings.csv` into the main folder of the app.
7978

@@ -85,19 +84,18 @@ The file contains data in the Bruker Flex format originally published in Weigt,
8584

8685
To replicate the results shown use the following parameters:
8786

88-
- under Settings set File Format to Bruker Flex
89-
- set Concentration unit to µM
90-
- set Normalization/re-calibration *m/z* to 760.5851 (PC(34:1) [M+H]<sup>+</sup>)
91-
- set recalibration tolerance to 0.1 Da
92-
- set normalization to TIC
93-
- activate smoothing and baseline removal
94-
- set Aggregation method to mean
95-
- set SNR to 3
96-
- set alignment to 0 mDa (no alignment)
97-
- set binning tolerance to 100 ppm
98-
- select the the folder `curve` from the .zip file, make sure no other files/folders are present.
87+
- under Settings set File Format to Bruker Flex
88+
- set Concentration unit to µM
89+
- set Normalization/re-calibration *m/z* to 760.5851 (PC(34:1) [M+H]<sup>+</sup>)
90+
- set recalibration tolerance to 0.1 Da
91+
- set normalization to TIC
92+
- activate smoothing and baseline removal
93+
- set Aggregation method to mean
94+
- set SNR to 3
95+
- set alignment to 0 mDa (no alignment)
96+
- set binning tolerance to 100 ppm
97+
- select the the folder `curve` from the .zip file, make sure no other files/folders are present.
9998

10099
Alternatively, copy the [this file](https://github.com/CeMOS-Mannheim/M2ara/blob/main/tests/testthat/settings_bruker_data.csv) as `settings.csv` into the main folder of the app.
101100

102101
The target is *m/z* 826.5722 (PC(36:1) [M+K]<sup>+</sup>) and *m/z* 616.1767 (Heme B [M+H]<sup>+</sup>) the pIC50 values should be 9.5 and 9.7.
103-

components/mainTab.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ mainTab <- function() {
5353
selectInput(inputId = "metric",
5454
label = "Metric",
5555
choices = c("CRS",
56-
"Z'",
57-
"V'",
58-
"SSMD",
56+
"FZ",
57+
"FV",
58+
"FS",
5959
"log2FC",
6060
"pEC50"),
6161
selected = defaults$errorbars,

components/server.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ server <- function(input, output, session) {
5151
normMz = input$normMz,
5252
normTol = input$normTol,
5353
normMeth = input$normMeth,
54+
smoothHalfWindowSize = 3,
5455
alignTol = input$alignTol * 1e-3,
5556
halfWindowSize = input$halfWindowSize,
5657
peakMethod = input$peakMethod)
@@ -118,7 +119,6 @@ server <- function(input, output, session) {
118119
dir = appData$selected_dir
119120
)
120121
)
121-
122122
message(MALDIcellassay:::timeNow(), " processing done\n")
123123

124124
# write everything needed into appData

figures/logo_resized.png

7.01 KB
Loading

functions/helpers.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,14 @@ checkMetaData <- function(object) {
106106

107107
return(TRUE)
108108
}
109+
110+
#' Extract directory path
111+
#'
112+
#' @param object Object of class MALDIassay
113+
#'
114+
#' @return
115+
#' List, containing the data used to do the fits as well as the nlpr curve fit .
116+
getDirectory <- function(object) {
117+
MALDIcellassay:::stopIfNotIsMALDIassay(object)
118+
return(object@settings$dir)
119+
}

functions/plotFunctions.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,15 @@ plateMapPlot <- function(appData,
267267
return(p)
268268
}
269269

270-
scorePlot <- function(stats, metric = c("CRS", "V'", "Z'", "log2FC", "pEC50", "SSMD")) {
270+
scorePlot <- function(stats, metric = c("CRS", "FV", "FZ", "log2FC", "pEC50", "FS")) {
271271
metric <- match.arg(metric)
272272

273273
df <- stats %>%
274274
mutate(direction = if_else(log2FC < 0, "down", "up")) %>%
275275
select(c("mz", "direction")) %>%
276276
mutate(value = pull(stats, metric))
277277

278-
if(metric %in% c("V'", "Z'")) {
278+
if(metric %in% c("FV", "FZ")) {
279279
# cut V' and Z' at zero as lower values then zero just indicate bad models
280280
# and its prettier for visualization
281281
df <- df %>%
@@ -284,7 +284,7 @@ scorePlot <- function(stats, metric = c("CRS", "V'", "Z'", "log2FC", "pEC50", "S
284284
limits <- c(-1, 1)
285285
}
286286

287-
if(metric %in% c("CRS", "V'", "Z'", "SSMD")) {
287+
if(metric %in% c("CRS", "FV", "FZ", "FS")) {
288288
df <- df %>%
289289
mutate(value = if_else(direction == "down", -value, value))
290290
}
@@ -300,14 +300,14 @@ scorePlot <- function(stats, metric = c("CRS", "V'", "Z'", "log2FC", "pEC50", "S
300300
y = ylab,
301301
col = NULL)
302302

303-
if(metric %in% c("V'", "Z'")) {
303+
if(metric %in% c("FV", "FZ")) {
304304
p <- p +
305305
scale_y_continuous(limits = limits,
306306
breaks = c(-1, -0.5, 0, 0.5, 1),
307307
labels = c(1, 0.5, 0, 0.5 , 1))
308308
}
309309

310-
if(metric %in% c("log2FC", "SSMD")) {
310+
if(metric %in% c("log2FC", "FS")) {
311311
absVal <- abs(df$value)
312312
absVal <- absVal[!is.infinite(absVal)]
313313
absMax <- max(absVal, na.rm = TRUE)

functions/storeResults.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
storeResults <- function(appData, res, input, stats) {
22
appData$res <- res
33
appData$preprocessing <- appData$preprocessing
4+
5+
# rename Z', V', SSMD to FZ, FV and FS
6+
stats <- stats %>%
7+
rename("FZ" = `Z'`,
8+
"FV" = `V'`,
9+
"FS" = SSMD)
10+
11+
412
appData$stats_original <- stats # copy of original stats for updates
513
appData$stats <- stats
614

0 commit comments

Comments
 (0)