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

[WIP] Start of testing the shiny app #73

Merged
merged 6 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 14 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
has_testthat: 'true'
# run_covr: 'true' # Disabled until later
run_covr: 'false'
# run_pkgdown: 'true' # Disabled until later
# run_pkgdown: 'true' # Disabled until later
run_pkgdown: 'false'
has_RUnit: 'false'
has_BiocCheck: 'false'
Expand All @@ -26,17 +26,18 @@ jobs:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
container: ${{ matrix.config.cont }}

# Define the matrix for different configurations
strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-latest, r: 'devel', bioc: 'devel', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" }
- { os: ubuntu-latest, r: '4.3', bioc: '3.18', cont: "bioconductor/bioconductor_docker:RELEASE_3_18", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" }
# - { os: ubuntu-latest, r: 'devel', bioc: 'devel', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" }
# Disabling additional architectures until later
# - { os: macOS-latest, r: 'next', bioc: '3.18'}
# - { os: windows-latest, r: 'next', bioc: '3.18'}

# Define environment variables for the job
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
Expand Down Expand Up @@ -100,7 +101,7 @@ jobs:
- name: Install Linux system dependencies
if: runner.os == 'Linux'
run: |
sysreqs=$(Rscript -e 'cat("apt-get update -y && apt-get install -y", paste(gsub("apt-get install -y ", "", remotes::system_requirements("ubuntu", "20.04")), collapse = " "))')
sysreqs=$(Rscript -e 'cat("apt-get update -y && ", paste(remotes::system_requirements("ubuntu", "20.04"), collapse = " && "))')
echo $sysreqs
sudo -s eval "$sysreqs"

Expand Down Expand Up @@ -275,7 +276,13 @@ jobs:
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
run: R CMD INSTALL .

# Step 25: Deploy package
# Step 25: Test Shiny App in package
- name: Test Shiny App
uses: rstudio/shinytest2/actions/test-app@actions/v1
with:
app-dir: "inst/MetFamily"

# Step 26: Deploy package
- name: Deploy package
if: github.ref == 'refs/heads/devel' && env.run_pkgdown == 'true' && runner.os == 'Linux'
run: |
Expand All @@ -289,7 +296,7 @@ jobs:
## branch (erasing anything you haven't version controlled!) and
## makes the git history recognizable by pkgdown.

# Step 26: Upload check results
# Step 27: Upload check results
- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
Expand Down
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ Depends:
Remotes: decisionpatterns/searchable
Suggests:
knitr,
testthat
testthat,
shinytest2
VignetteBuilder: knitr
Maintainer: Hendrik Treutler<[email protected]>
Description: We present a novel approach for the untargeted discovery of metabolite families offering a bird's eye view of metabolic regulation in comparative metabolomics. We implemented the presented methodology in the easy-to-use web application MetFamily to enable the analysis of comprehensive metabolomics studies for all researchers worldwide.
Expand Down
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
[![build](https://github.com/ipb-halle/MetFamily/workflows/build/badge.svg)](https://github.com/ipb-halle/MetFamily/actions?query=workflow%3Abuild)

# MetFamily
Understanding metabolism is fundamental in biomedical and plant research and the identification and quantification of thousands of metabolites by mass spectrometry in modern metabolomics is a prerequisite for elucidating this area. However, the identification of metabolites is a major bottleneck in traditional approaches hampering advances. Here, we present a novel approach for the untargeted discovery of metabolite families offering a bird's eye view of metabolic regulation in comparative metabolomics. We implemented the presented methodology in the easy-to-use web application MetFamily to enable the analysis of comprehensive metabolomics studies for all researchers worldwide. MetFamily is available under http://msbi.ipb-halle.de/MetFamily/.

# Docker images
The image `sneumann/metfamily-base` contains all dependencies
The image `sneumann/metfamily-base` contains all dependencies
for the MetFamily web application.

## Building the container(s)
Build via `docker build -t sneumann/metfamily-base -f Dockerfile-base . `

The image `sneumann/metfamily` is built on top and contains
the actual MetFamily code and web application.
The image `sneumann/metfamily` is built on top and contains
the actual MetFamily code and web application.

Build via `docker build -t sneumann/metfamily . `

The build of the metfamily-base image https://hub.docker.com/r/sneumann/metfamily-base is triggerd whenever in the `master` branch a tag `basechange-<date>` e.g. `basechange-20190804` is specified.

## Running from a container

To run the resulting container, start with
To run the resulting container, start with
`docker run --rm -p 3838:3838 sneumann/metfamily:latest`

and point your browser to http://localhost:3838/

## Developing and debugging in a container

If you want to develop and debug stuff, you can build a container
on top of `metfamily:latest` that has an added rstudio server.
If you want to develop and debug stuff, you can build a container
on top of `metfamily:latest` that has an added rstudio server.
First build using `docker build -t metfamily-rstudio -f Dockerfile-rstudio .`
and then run via `docker run -it --rm -p 8787:8787 metfamily-rstudio:latest`.
CAVEAT: the `Dockerfile-rstudio` specifies a fixed user/password combo
of `rstudio:rstudio`. Do not use in Production !

You can also pass a local directory with checked out MetFamily git tree
You can also pass a local directory with checked out MetFamily git tree
via the `docker run -v` argument.

## Running locally with MetFamily R Package

After installing the `MetFamily` R package and its dependencies, you can
After installing the `MetFamily` R package and its dependencies, you can
```
library(MetFamily)
runApp(system.file("MetFamily", package="MetFamily"))
```

## Running through Kubernetes

At IPB we are running MetFamily inside a Kubernetes cluster.
At IPB we are running MetFamily inside a Kubernetes cluster.
Please contact us for questions.

1 change: 1 addition & 0 deletions inst/MetFamily/tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shinytest2::test_app()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
{
"input": {
"applyGlobalMS2filters": 0,
"applyHcaFilters": 0,
"applyPcaFilters": 0,
"applySearch": 0,
"changePlot": "Display HCA",
"changeSelection": "Selection by HCA/PCA",
"clearGlobalMS2filters": 0,
"clearHcaFilters": 0,
"clearPcaFilters": 0,
"clearSearch": 0,
"clearSelection": 0,
"confirmAnnotation": 0,
"displayImportParameters": false,
"doAnnotation": 0,
"doMs2PeakGroupDeisotoping": true,
"doMs2PeakGroupDeisotoping2": true,
"doPrecursorDeisotoping": true,
"doPrecursorDeisotoping2": true,
"downloadHcaImageType": "png",
"downloadPcaImageType": "png",
"drawHCAplots": 0,
"drawPCAplots": 0,
"fileInputSelection": "Example data",
"filterByPCAgroupSamples": false,
"globalFilter_ms2_masses1": "",
"globalFilter_ms2_masses2": "",
"globalFilter_ms2_masses3": "",
"globalFilter_ms2_ppm": "",
"hcaDistanceFunction": "Jaccard (intensity-weighted)",
"hcaFilterGroupOne": "",
"hcaFilterGroupTwo": "",
"hcaFilterIncludeIgnoredPrecursors": false,
"hcaFilter_average": "",
"hcaFilter_lfc": "",
"hcaPrecursorLabels": "m/z / RT",
"heatmapContent": "Log-fold-change",
"heatmapOrdering": "Specified order",
"importMs1Ms2Data": 0,
"importMs2Data": 0,
"importParameterFileInput": null,
"loadExampleData": 1,
"loadProjectData": 0,
"loadingsLabels": "None",
"matrixFile": null,
"maximumRtDifference": "0.05",
"maximumRtDifference2": "0.02",
"metaboliteFamilyComparisonClass": "[init]",
"minimumIntensityOfMaximalMS2peak": "2000",
"minimumIntensityOfMaximalMS2peak2": "2000",
"minimumProportionOfMS2peaks": "0.05",
"minimumProportionOfMS2peaks2": "0.05",
"ms1AnalysisMethod": "PCA (Principal Component Analysis)",
"ms1DataFile": null,
"ms2DataFile": null,
"mzDeviationAbsolute_grouping": "0.01",
"mzDeviationAbsolute_grouping2": "0.01",
"mzDeviationAbsolute_ms2PeakGroupDeisotoping": "0.01",
"mzDeviationAbsolute_ms2PeakGroupDeisotoping2": "0.01",
"mzDeviationAbsolute_precursorDeisotoping": "0.01",
"mzDeviationAbsolute_precursorDeisotoping2": "0.01",
"mzDeviationInPPM_grouping": "10",
"mzDeviationInPPM_grouping2": "10",
"mzDeviationInPPM_ms2PeakGroupDeisotoping": "10",
"mzDeviationInPPM_ms2PeakGroupDeisotoping2": "10",
"mzDeviationInPPM_precursorDeisotoping": "10",
"mzDeviationInPPM_precursorDeisotoping2": "10",
"neutralLossesFragmentsToFragments": false,
"neutralLossesFragmentsToFragments2": false,
"neutralLossesPrecursorToFragments": true,
"neutralLossesPrecursorToFragments2": true,
"newAnnotationColor": "#0000FF",
"newAnnotationColor2": "#0000FF",
"newAnnotationValue": "",
"newAnnotationValue2": "",
"pcaDimensionOne": "1",
"pcaDimensionTwo": "2",
"pcaFilterIncludeIgnoredPrecursors": false,
"pcaFilter_average": "",
"pcaFilter_lfc": "",
"pcaGroups": null,
"pcaLogTransform": false,
"pcaSamples": null,
"pcaScaling": "Pareto",
"precursorSelectionTabs": "Selection",
"prepareAllPrecursors": 0,
"presentAnnotationValue": "[init]",
"previousAnnotationValue": "Artifact",
"projectDescription": "",
"projectDescription2": "",
"projectName": "MetFamily project (created 2022-02-22_12.34.56.789)",
"projectName2": "",
"removeMetaboliteFamily": 0,
"removePresentAnnotation": 0,
"renameMetaboliteFamily": 0,
"runTabs": "Input",
"searchIncludeIgnoredPrecursors": false,
"searchMS1mass": "",
"searchMS1massPpm": "",
"searchMS1orMS2": "MS1 feature m/z",
"searchMS2massPpm": "",
"search_ms2_masses1": "",
"search_ms2_masses2": "",
"search_ms2_masses3": "",
"selectAllPCAGroups": 0,
"selectInvertedPCAGroups": 0,
"selectMetaboliteFamily": 0,
"selectNoPCAGroups": 0,
"selectedSpectrum": "",
"setPresentAnnotationPrimary": 0,
"showClusterLabels": true,
"showFragmentPlot": false,
"showHCAadvancedOptions": false,
"showHCAfilterOptions": true,
"showImportParameters": false,
"showImportParametersAdvanced": false,
"showLoadingsAbundance": false,
"showLoadingsFeatures": [
"Annotated",
"Not Annotated",
"Selected",
"Not Selected"
],
"showPCAadvancedOptions": false,
"showPCAfilterOptions": true,
"showPlotControls": false,
"showScoresLabels": true,
"submitNewAnnotation": 0,
"submitPreviousAnnotation": 0,
"updateArtifactsFromCheckboxes": 0,
"updateProjectDescription": 0,
"updateSampleTable": 0
},
"output": {
"analysisType": "HCA",
"classifierClassMS1featureSelected": false,
"classifierClassSelected": false,
"classifierLoaded": false,
"fileInfo": "Please press 'Load example data' to load the full example data set",
"filterSearchActive": false,
"globalMS2filterValid": true,
"hcaFilterValid": true,
"metaboliteFamilySelected": false,
"pcaFilterValid": true,
"plotAnnotationShown": false,
"plotDendrogram_hover_info": null,
"plotHcaShown": false,
"plotHeatmap_hover_info": null,
"plotMS2_hover_info": null,
"plotPcaLoadings_hover_info": null,
"plotPcaScores_hover_info": null,
"plotPcaShown": false,
"precursorSetSelected": false,
"searchFilterValid": true,
"selectedSelection": null,
"selectionInfo": "Please select a cluster or MS¹ feature in the HCA plot",
"showAnnotationplotPanel": false,
"showGUI": true,
"showHCAplotPanel": false,
"showPCAplotPanel": false,
"showPutativeAnnotationsTableFromAnalysis": null,
"showSideBar": true,
"ui_plotAnnoLegendHCA": null,
"ui_plotAnnoLegendPCA": null,
"ui_plotHeatmap": {
"html": "<div class=\"shiny-plot-output html-fill-item\" data-hover-clip=\"TRUE\" data-hover-delay=\"50\" data-hover-delay-type=\"debounce\" data-hover-id=\"plotHeatmap_hover\" data-hover-null-outside=\"TRUE\" id=\"plotHeatmap\" style=\"width:100%;height:1px;\"><\/div>",
"deps": [

]
},
"ui_plotScoresGroupsLegend": null
},
"export": {

}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions inst/MetFamily/tests/testthat/setup-shinytest2.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Load application support files into testing environment
shinytest2::load_app_env()
10 changes: 10 additions & 0 deletions inst/MetFamily/tests/testthat/test-shinytest2.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
library(shinytest2)

test_that("{shinytest2} recording: MetFamilyLoadExample", {
app <- AppDriver$new(variant = platform_variant(), name = "MetFamilyLoadExample",
height = 1113, width = 1549)
#app$expect_screenshot()
app$set_inputs(fileInputSelection = "Example data")
app$click("loadExampleData")
app$expect_values(screenshot_args = FALSE)
})
6 changes: 5 additions & 1 deletion inst/MetFamily/ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ shinyUI(
conditionalPanel(
condition = 'input.fileInputSelection == "Import data"',
bsTooltip(id = "projectName", title = "Please type the name of the project", placement = "bottom", trigger = "hover"),
textInput(inputId = "projectName", label = "Project name", value = paste("MetFamily project (created ", gsub(" ", "_", gsub(":", ".", Sys.time())), ")", sep = "")),
# Temporarily use const date under testing, see https://github.com/rstudio/shinytest2/issues/300#issuecomment-1908500601
textInput(inputId = "projectName", label = "Project name",
value = paste("MetFamily project (created ", gsub(" ", "_", gsub(":", ".",
ifelse(isFALSE(getOption("shiny.testmode")), Sys.time(), "2022-02-22_12.34.56.789")
)), ")", sep = "")),
bsTooltip(id = "projectDescription", title = "Please type a description of this project as free text", placement = "bottom", trigger = "hover"),
tags$style(type="text/css", "textarea {width:100%}"),
tags$textarea(id = 'projectDescription', placeholder = 'Comments here', rows = 3, ""),
Expand Down
Loading