Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename metrics #4

Merged
merged 66 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
15dde33
- clean up requirements
thomas-enzlein May 22, 2024
99dd00c
test github action
thomas-enzlein May 22, 2024
2eecbce
Merge branch 'main' into dev
thomas-enzlein May 22, 2024
a6ed1dc
- clean up lasso experiment remnants
thomas-enzlein May 22, 2024
d57c56d
- fix checkInstalledPackages
thomas-enzlein May 22, 2024
d6181cc
- clean up redudant code to check and install packages
thomas-enzlein May 22, 2024
3d55480
- update dockerfile to fix config errors when building
thomas-enzlein May 22, 2024
7b783c8
- clean up server.R
thomas-enzlein May 23, 2024
012bb98
- cleaned req.txt
thomas-enzlein May 23, 2024
d419534
- set up tests for mzML and Bruker file loading
thomas-enzlein May 24, 2024
cbcf5e1
- activate GHA caching
thomas-enzlein May 27, 2024
22b37cc
fix for last commit
thomas-enzlein May 27, 2024
14bbb49
- fix `zoo` dependency problem
thomas-enzlein May 27, 2024
5999633
- remove browser() for debugging pca plots.
thomas-enzlein May 27, 2024
5dc3142
- append last commit
thomas-enzlein May 27, 2024
be79a06
- update GHA to use versions instead of hashes
thomas-enzlein May 27, 2024
70eae8a
- fix caching
thomas-enzlein May 27, 2024
772dde0
- add tests to GHA
thomas-enzlein May 27, 2024
711c12f
- fix tests
thomas-enzlein May 27, 2024
aa63fb6
- futher fix to tests
thomas-enzlein May 27, 2024
690bba0
- again...
thomas-enzlein May 27, 2024
c2717e3
- next try
thomas-enzlein May 27, 2024
ff60340
- add system requirements for devtools
thomas-enzlein May 27, 2024
b6f747c
- fix last commit
thomas-enzlein May 27, 2024
7a96285
- next try
thomas-enzlein May 27, 2024
c39574b
- add libcurl4-openssl-dev as system dependency
thomas-enzlein May 27, 2024
4c85896
- add github pat
thomas-enzlein May 27, 2024
dc8fac3
- remove library() calls from individual functions
thomas-enzlein May 27, 2024
7abcaf7
- fix tests
thomas-enzlein May 28, 2024
a3250d4
- add test that checks if processing was sucessful
thomas-enzlein May 28, 2024
99a0609
- info_state manager uses switch
thomas-enzlein May 29, 2024
02e8cd0
- remove devtools and use pak instead
thomas-enzlein May 29, 2024
fc20753
- remove unused functions
thomas-enzlein Jun 3, 2024
8009eba
- convert left over install.package calls to pak::pkg_install
thomas-enzlein Jun 3, 2024
0f2c211
- update github workflow
thomas-enzlein Jun 3, 2024
7430933
- remove stringr dependency
thomas-enzlein Jun 3, 2024
b930978
- remove shinythemes and shinywidgets dependency
thomas-enzlein Jun 3, 2024
cb348d4
- remove dependency on purrr
thomas-enzlein Jun 4, 2024
305ef62
- fix clustering
thomas-enzlein Jun 4, 2024
78a294b
- remove references to hc
thomas-enzlein Jun 4, 2024
c68cc97
- fix tests
thomas-enzlein Jun 4, 2024
d29d98c
again
thomas-enzlein Jun 4, 2024
970c062
and again
thomas-enzlein Jun 4, 2024
05394a5
- add more error handling for loading data
thomas-enzlein Jun 5, 2024
b3a3c56
- remove debug messages from tests
thomas-enzlein Jun 5, 2024
4f61643
- fix test
thomas-enzlein Jun 5, 2024
a739bda
- extract dir selection to a function
thomas-enzlein Jun 5, 2024
00e5e2e
- more reorganization
thomas-enzlein Jun 5, 2024
1e62654
- add notifications to the app
thomas-enzlein Jun 6, 2024
6bad17e
- fix notification
thomas-enzlein Jun 6, 2024
772a592
- add a test to check if the app starts
thomas-enzlein Jun 6, 2024
5b5140f
- fix tests
thomas-enzlein Jun 6, 2024
bdebe8a
- another fix
thomas-enzlein Jun 6, 2024
af2e1f4
- removed another debug info from tests
thomas-enzlein Jun 6, 2024
9288971
- display error notifications for longer
thomas-enzlein Jun 7, 2024
8fa3ee7
- fix cluster plot
thomas-enzlein Jun 7, 2024
6a5b8e4
- fix merge confilicts
thomas-enzlein Jul 1, 2024
3e6d7b4
- fix for merge conflicts
thomas-enzlein Jul 1, 2024
f5cb57c
another fix for merge
thomas-enzlein Jul 2, 2024
7872ad6
again
thomas-enzlein Jul 2, 2024
9f69406
fix merge confilicts
thomas-enzlein Jul 2, 2024
0c6ad0b
Merge branch 'main' into dev
thomas-enzlein Jul 4, 2024
0faa179
- add getDirectory function
thomas-enzlein Aug 29, 2024
2e3424e
Merge branch 'main' into dev
thomas-enzlein Sep 2, 2024
978c249
- add logo to header
thomas-enzlein Sep 2, 2024
6ee84e6
- update metrics naming (mod Z' -> FZ, mod V' -> FV, SSMD -> FS
thomas-enzlein Oct 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ testdata_bruker.zip
testdata_mzML.zip
Curve
mzMl
bayer_export.R
78 changes: 38 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
<img src="figures/M2ara_Logo.png" alt="M²ara overview" width="100" height="100">

# M²ara - MALDI MS Bioassays Evaluation and Classification App
# M2ara <img src="figures/logo_resized.png" align="right" height="120"/>

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.

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.

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

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

## How to use

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

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

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

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

## How to install
## How to install

### R

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.

```bash
``` bash
git clone https://github.com/CeMOS-Mannheim/M2ara.git
```

```R
``` r
# install all packages needed
source("install_packages.R")

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

### Docker
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.

```bash
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.

``` bash
docker pull thomasenzlein/m2ara:main
```

```bash
``` bash
docker run -p 3838:3838 -v c:/path/to/massSpecData:/mnt thomasenzlein/m2ara:main
```

### Stand-alone installer for Windows
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).

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

## Example data
To test the app please use the example data on [FigShare](https://dx.doi.org/10.6084/m9.figshare.25736541).

To test the app please use the example data on [FigShare](https://dx.doi.org/10.6084/m9.figshare.25736541).

#### Unger2020_OATP2B1_inhibition_mzML.zip

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

To replicate the results shown use the following parameters:

- under Settings set File Format to mzML
- set Concentration unit to nM
- set Normalization/re-calibration *m/z* to 354.1418 (D4-E3S, [M-H]<sup>-</sup>)
- set recalibration tolerance to 0.1 Da
- set normalization to *m/z*
- deactivate smoothing and activate baseline removal
- set Aggregation method to mean
- set SNR to 3
- set alignment to 0 mDa (no alignment)
- set binning tolerance to 100 ppm
- 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.
- under Settings set File Format to mzML
- set Concentration unit to nM
- set Normalization/re-calibration *m/z* to 354.1418 (D4-E3S, [M-H]<sup>-</sup>)
- set recalibration tolerance to 0.1 Da
- set normalization to *m/z*
- deactivate smoothing and activate baseline removal
- set Aggregation method to mean
- set SNR to 3
- set alignment to 0 mDa (no alignment)
- set binning tolerance to 100 ppm
- 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.

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.

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

To replicate the results shown use the following parameters:

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

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.

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.

6 changes: 3 additions & 3 deletions components/mainTab.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ mainTab <- function() {
selectInput(inputId = "metric",
label = "Metric",
choices = c("CRS",
"Z'",
"V'",
"SSMD",
"FZ",
"FV",
"FS",
"log2FC",
"pEC50"),
selected = defaults$errorbars,
Expand Down
2 changes: 1 addition & 1 deletion components/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ server <- function(input, output, session) {
normMz = input$normMz,
normTol = input$normTol,
normMeth = input$normMeth,
smoothHalfWindowSize = 3,
alignTol = input$alignTol * 1e-3,
halfWindowSize = input$halfWindowSize,
peakMethod = input$peakMethod)
Expand Down Expand Up @@ -118,7 +119,6 @@ server <- function(input, output, session) {
dir = appData$selected_dir
)
)

message(MALDIcellassay:::timeNow(), " processing done\n")

# write everything needed into appData
Expand Down
Binary file added figures/logo_resized.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions functions/helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,14 @@ checkMetaData <- function(object) {

return(TRUE)
}

#' Extract directory path
#'
#' @param object Object of class MALDIassay
#'
#' @return
#' List, containing the data used to do the fits as well as the nlpr curve fit .
getDirectory <- function(object) {
MALDIcellassay:::stopIfNotIsMALDIassay(object)
return(object@settings$dir)
}
10 changes: 5 additions & 5 deletions functions/plotFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,15 @@ plateMapPlot <- function(appData,
return(p)
}

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

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

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

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

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

if(metric %in% c("log2FC", "SSMD")) {
if(metric %in% c("log2FC", "FS")) {
absVal <- abs(df$value)
absVal <- absVal[!is.infinite(absVal)]
absMax <- max(absVal, na.rm = TRUE)
Expand Down
8 changes: 8 additions & 0 deletions functions/storeResults.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
storeResults <- function(appData, res, input, stats) {
appData$res <- res
appData$preprocessing <- appData$preprocessing

# rename Z', V', SSMD to FZ, FV and FS
stats <- stats %>%
rename("FZ" = `Z'`,
"FV" = `V'`,
"FS" = SSMD)


appData$stats_original <- stats # copy of original stats for updates
appData$stats <- stats

Expand Down
Loading
Loading