Skip to content

Rename metabolomics upload labels and expand tooltips - #226

Merged
tonywu1999 merged 1 commit into
develfrom
MSstatsShiny/work/20260810_metabolomics_labels_tooltips
Aug 11, 2026
Merged

Rename metabolomics upload labels and expand tooltips#226
tonywu1999 merged 1 commit into
develfrom
MSstatsShiny/work/20260810_metabolomics_labels_tooltips

Conversation

@swaraj-neu

@swaraj-neu swaraj-neu commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Motivation and context

Metabolomics upload labels did not clearly distinguish sample metadata annotations from compound annotations. The upload guidance also needed more detail about required columns, matching behavior, and optional SIRIUS annotation fields.

The changes rename the labels, expand the guidance, update generated MZmine workflow paths, and add UI test coverage.

Changes

  • Updated metabolomics upload guidance in R/module-loadpage-ui.R.
  • Added requirements for sample metadata annotations and compound annotations.
  • Documented annotation matching behavior.
  • Documented SIRIUS annotation fields.
  • Updated generated MZmine workflow code in R/utils.R to use separate sample metadata and compound annotation file paths.
  • Kept SIRIUS annotation handling optional.

Unit tests

  • Updated tests/testthat/test-module-loadpage-ui.R.
  • Added assertions for the Sample metadata annotations and Compound annotations labels in the MZmine upload UI.

Coding guidelines

No coding-guideline violations were identified.

@swaraj-neu
swaraj-neu requested a review from tonywu1999 August 11, 2026 03:38
@swaraj-neu swaraj-neu self-assigned this Aug 11, 2026
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The MZmine metabolomics upload guidance now separates sample metadata annotations from compound annotations. Tooltips document required fields and SIRIUS handling. Generated workflow labels and UI tests use the updated terminology.

Changes

Annotation input terminology

Layer / File(s) Summary
Annotation guidance and generated labels
R/module-loadpage-ui.R, R/utils.R, tests/testthat/test-module-loadpage-ui.R
The upload UI describes separate sample metadata and compound annotation inputs, required columns, matching rules, accepted layouts, unidentified features, and SIRIUS fields. The generated template and UI test use the updated labels.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested labels: enhancement

Suggested reviewers: tonywu1999

Poem

I’m a rabbit with labels to share,
Metadata here, compounds there.
SIRIUS fields now clearly shown,
Matching rules in tooltips grown.
The upload path hops along!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes to metabolomics upload labels and tooltips.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch MSstatsShiny/work/20260810_metabolomics_labels_tooltips

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
R/module-loadpage-ui.R (1)

310-314: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Document the SIRIUS schema version.

The tooltip lists mappingFeatureId and name, but MSstatsConvert validates the input against SIRIUS 6 output. Users of other SIRIUS versions may need to rename columns before upload. Add this caveat to prevent failures when users follow the displayed field list. (bioconductor.posit.co)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@R/module-loadpage-ui.R` around lines 310 - 314, Update the tooltip text in
the sirius_annotations fileInput to state that the expected schema is from
SIRIUS 6 and that other SIRIUS versions may require column renaming before
upload, while retaining the existing mappingFeatureId and name guidance.

Source: MCP tools

tests/testthat/test-module-loadpage-ui.R (1)

589-590: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Test the expanded tooltip contract.

These assertions cover the two renamed headings, but not the new required-column and matching guidance. Add checks for the MZmine columns, Run/Condition/BioReplicate, id/compound_name/score, and mappingFeatureId/name. Add a focused getDataCode() assertion to verify that the sample metadata and compound annotation paths remain mapped to distinct converter arguments.

Proposed assertions
   expect_true(grepl("Sample metadata annotations", uploads_html, fixed = TRUE))
   expect_true(grepl("Compound annotations", uploads_html, fixed = TRUE))
+  expect_true(grepl("row ID, row m/z and row retention time", uploads_html, fixed = TRUE))
+  expect_true(grepl("Run, Condition and BioReplicate", uploads_html, fixed = TRUE))
+  expect_true(grepl("id, compound_name and score", uploads_html, fixed = TRUE))
+  expect_true(grepl("mappingFeatureId and name", uploads_html, fixed = TRUE))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/testthat/test-module-loadpage-ui.R` around lines 589 - 590, Expand the
tooltip assertions near the existing “Sample metadata annotations” and “Compound
annotations” checks to cover the required MZmine columns,
Run/Condition/BioReplicate, id/compound_name/score, and mappingFeatureId/name
guidance. Add a focused getDataCode() assertion verifying that sample metadata
and compound annotation paths map to distinct converter arguments.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@R/module-loadpage-ui.R`:
- Around line 301-304: Update the “Sample metadata annotations” tooltip text in
the h5 markup to state that MZMinetoMSstatsFormat() standardizes a value such as
“sampleA.mzML Peak area” to “sampleAmzML”, and instruct users that Run must
match this standardized name; remove the claim that spaces and dots are ignored
during matching.

---

Nitpick comments:
In `@R/module-loadpage-ui.R`:
- Around line 310-314: Update the tooltip text in the sirius_annotations
fileInput to state that the expected schema is from SIRIUS 6 and that other
SIRIUS versions may require column renaming before upload, while retaining the
existing mappingFeatureId and name guidance.

In `@tests/testthat/test-module-loadpage-ui.R`:
- Around line 589-590: Expand the tooltip assertions near the existing “Sample
metadata annotations” and “Compound annotations” checks to cover the required
MZmine columns, Run/Condition/BioReplicate, id/compound_name/score, and
mappingFeatureId/name guidance. Add a focused getDataCode() assertion verifying
that sample metadata and compound annotation paths map to distinct converter
arguments.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ad7e8bc2-eecf-4eca-817c-96b5a3fdaceb

📥 Commits

Reviewing files that changed from the base of the PR and between 8bee970 and c3e7f1f.

📒 Files selected for processing (3)
  • R/module-loadpage-ui.R
  • R/utils.R
  • tests/testthat/test-module-loadpage-ui.R

Comment thread R/module-loadpage-ui.R
Comment on lines +301 to 304
h5("Sample metadata annotations", class = "icon-wrapper",
icon("question-circle", lib = "font-awesome"),
div("Maps each run/sample to its condition and bioreplicate.",
div("Describes the experimental design, using the columns Run, Condition and BioReplicate. Each Run should be the sample name from the quant table with the trailing Peak area dropped, so 'sampleA.mzML Peak area' becomes 'sampleA.mzML'. Spaces and dots are ignored when matching, so they do not need to be exact.",
class = "icon-tooltip"))),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- target file context ---'
cat -n R/module-loadpage-ui.R | sed -n '285,320p'

printf '%s\n' '--- normalization-related references ---'
rg -n -i 'Peak area|mappingFeatureId|sample.*name|normalize|MSstatsConvert|Run' . \
  -g '!*.Rproj.user/**' -g '!renv/library/**' | head -200

printf '%s\n' '--- repository metadata ---'
git ls-files | rg '(^|/)(DESCRIPTION|NAMESPACE|renv.lock|R/module-loadpage-ui\\.R)$' || true

Repository: Vitek-Lab/MSstatsShiny

Length of output: 24058


🏁 Script executed:

#!/bin/bash
set -eu

printf '%s\n' '--- MZMine conversion call path ---'
cat -n R/utils.R | sed -n '300,370p'

printf '%s\n' '--- MZMine-related tests and fixtures ---'
rg -n -i 'mzmine|MZMinetoMSstatsFormat|Peak area|mzML|mappingFeatureId|sirius' tests R DESCRIPTION vignettes \
  -g '*.R' -g '*.Rmd' -g '*.csv' -g '*.tsv' | head -250

printf '%s\n' '--- package/version declarations ---'
rg -n 'MSstatsConvert|Version|Remotes|Depends|Imports' DESCRIPTION renv.lock 2>/dev/null || true

Repository: Vitek-Lab/MSstatsShiny

Length of output: 12601


🌐 Web query:

MSstatsConvert MZMinetoMSstatsFormat Run sample name spaces dots Peak area normalization

💡 Result:

In MSstatsConvert, the MZMinetoMSstatsFormat function processes MZMine feature-quantification tables by automatically standardizing column names [1][2]. During this standardization process, spaces and dots are removed from the column names [1][2]. Specifically, when preparing your annotation file, you must match the Run values to these standardized names [1][3]. For example, a raw column name in your MZMine input such as "sampleA.mzML Peak area" is transformed into "sampleAmzML" after the spaces and dots are removed and the trailing "Peakarea" suffix is stripped [1]. Consequently, your annotation file should use "sampleAmzML" as the Run identifier [1]. Regarding normalization, MSstats does not perform peak area normalization within the MZMinetoMSstatsFormat conversion function itself [1][2]. Instead, normalization is typically handled downstream by the MSstats dataProcess function [4]. A standard discovery workflow involves using the equalizeMedians normalization method within dataProcess, which operates on the long-format data produced by the conversion [4]. Summary of Key Steps: 1. Standardization: MZMinetoMSstatsFormat collapses spaces and removes dots from sample-specific " Peak area" column headers (e.g., "sampleA.mzML Peak area" becomes "sampleAmzML") [1][2]. 2. Annotation: Ensure your annotation table's Run column values match these standardized names [1]. 3. Normalization: Perform normalization after conversion using the dataProcess function (e.g., setting normalization = "equalizeMedians") [4].

Citations:


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
from urllib.request import Request, urlopen
from urllib.parse import quote
import re

urls = [
    "https://raw.githubusercontent.com/Vitek-Lab/MSstatsConvert/master/R/MZMinetoMSstatsFormat.R",
    "https://raw.githubusercontent.com/Vitek-Lab/MSstatsConvert/main/R/MZMinetoMSstatsFormat.R",
    "https://bioconductor.org/packages/release/bioc/src/contrib/MSstatsConvert_2.0.0.tar.gz",
]
for url in urls:
    print(f"--- {url} ---")
    try:
        req = Request(url, headers={"User-Agent": "Mozilla/5.0"})
        data = urlopen(req, timeout=15).read()
        print(f"bytes={len(data)}")
        if url.endswith(".R"):
            text = data.decode("utf-8", "replace")
            for i, line in enumerate(text.splitlines(), 1):
                if re.search(r"Run|Peak|gsub|colnames|annotation|mzmine", line, re.I):
                    print(f"{i}: {line}")
        else:
            print(data[:80])
    except Exception as exc:
        print(type(exc).__name__, exc)
PY

Repository: Vitek-Lab/MSstatsShiny

Length of output: 885


🌐 Web query:

site:github.com MSstatsConvert MZMinetoMSstatsFormat source Run Peak area

💡 Result:

The MZMinetoMSstatsFormat function is a converter provided by the R package MSstatsConvert that imports metabolomics data processed in MZmine into the format required for statistical analysis by MSstats [1][2]. Regarding your query about Run and Peak area: 1. Data Requirements: MSstatsConvert functions, including MZMinetoMSstatsFormat, expect input data to represent features (such as ions or compounds) across various runs (samples) [1]. 2. Peak Area: The function is designed to handle quantitative representations of feature abundance, which commonly include peak areas under the curve (AUC), peak heights, or other relevant intensity metrics [3]. 3. Workflow Context: When using MZMinetoMSstatsFormat, the conversion process typically involves: - Defining ProteinName assignments: The converter uses a three-tier strategy to assign identities to features: first by the best MZmine spectral-library compound name, second (optionally) by SIRIUS structure-identification mappings, and third by a fallback identifier based on m/z and retention time (e.g., round(m/z)_round(RT)) [4][2]. - Integration with MSstats: Once converted, this data is prepared for MSstats workflows, such as data processing (summarization), normalization (e.g., equalizeMedians), and differential abundance testing [4]. For further implementation details, you can refer to the official documentation and the MSstatsMetabolomics vignette within the MSstats ecosystem, which demonstrates the full workflow from data conversion to visualization [4][5].

Citations:


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
from urllib.request import Request, urlopen
import ssl, re

ctx = ssl._create_unverified_context()
urls = [
    "https://raw.githubusercontent.com/Vitek-Lab/MSstatsConvert/devel/R/MZMinetoMSstatsFormat.R",
    "https://raw.githubusercontent.com/Vitek-Lab/MSstatsConvert/master/R/MZMinetoMSstatsFormat.R",
    "https://raw.githubusercontent.com/Vitek-Lab/MSstatsConvert/main/R/MZMinetoMSstatsFormat.R",
]
for url in urls:
    print(f"--- {url} ---")
    try:
        req = Request(url, headers={"User-Agent": "Mozilla/5.0"})
        text = urlopen(req, context=ctx, timeout=15).read().decode("utf-8", "replace")
        print(f"bytes={len(text.encode())}")
        for i, line in enumerate(text.splitlines(), 1):
            if re.search(r"Run|Peak|gsub|colnames|annotation|mzmine", line, re.I):
                print(f"{i}: {line}")
    except Exception as exc:
        print(type(exc).__name__, exc)
PY

Repository: Vitek-Lab/MSstatsShiny

Length of output: 565


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
from urllib.request import Request, urlopen
import json, ssl

ctx = ssl._create_unverified_context()
url = "https://api.github.com/repos/Vitek-Lab/MSstatsConvert/git/trees/devel?recursive=1"
req = Request(url, headers={"User-Agent": "Mozilla/5.0", "Accept": "application/vnd.github+json"})
try:
    data = json.loads(urlopen(req, context=ctx, timeout=20).read())
    for item in data.get("tree", []):
        path = item.get("path", "")
        if "MZmine" in path or "mzmine" in path or path.endswith(".R"):
            print(path)
except Exception as exc:
    print(type(exc).__name__, exc)
PY

Repository: Vitek-Lab/MSstatsShiny

Length of output: 3311


🏁 Script executed:

#!/bin/bash
set -eu

python3 - <<'PY'
from urllib.request import Request, urlopen
import ssl

ctx = ssl._create_unverified_context()
base = "https://raw.githubusercontent.com/Vitek-Lab/MSstatsConvert/devel/"
paths = [
    "R/converters_MZMinetoMSstatsFormat.R",
    "R/clean_MZMine.R",
    "inst/tinytest/test_converters_MZMinetoMSstatsFormat.R",
]
for path in paths:
    print(f"--- {path} ---")
    req = Request(base + path, headers={"User-Agent": "Mozilla/5.0"})
    text = urlopen(req, context=ctx, timeout=20).read().decode("utf-8", "replace")
    for i, line in enumerate(text.splitlines(), 1):
        print(f"{i}: {line}")
PY

Repository: Vitek-Lab/MSstatsShiny

Length of output: 21402


Document the standardized Run value.

MZMinetoMSstatsFormat() converts sampleA.mzML Peak area to sampleAmzML. The annotation Run value must match this standardized name. Do not state that spaces and dots are ignored during matching.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@R/module-loadpage-ui.R` around lines 301 - 304, Update the “Sample metadata
annotations” tooltip text in the h5 markup to state that MZMinetoMSstatsFormat()
standardizes a value such as “sampleA.mzML Peak area” to “sampleAmzML”, and
instruct users that Run must match this standardized name; remove the claim that
spaces and dots are ignored during matching.

Source: MCP tools

@tonywu1999
tonywu1999 merged commit b56c484 into devel Aug 11, 2026
2 checks passed
@tonywu1999
tonywu1999 deleted the MSstatsShiny/work/20260810_metabolomics_labels_tooltips branch August 11, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants