Skip to content

Merge Metamorpheus to MSstatsFormat Converter into Development#154

Merged
tonywu1999 merged 5 commits intodevelfrom
feat/metamorpheus-converter
Feb 13, 2026
Merged

Merge Metamorpheus to MSstatsFormat Converter into Development#154
tonywu1999 merged 5 commits intodevelfrom
feat/metamorpheus-converter

Conversation

@swaraj-neu
Copy link
Copy Markdown
Contributor

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

  • feat: Add Metamorpheus converter support in loadpage UI and server modules
Screenshot 2026-02-11 at 11 47 28 AM

Motivation & context

  • Users need to import Metamorpheus QuantifiedPeaks.tsv into MSstatsShiny. This PR adds a Metamorpheus ("meta") converter path so users can upload Metamorpheus outputs and have them converted to MSstatsFormat within both the interactive runtime and the generated reproducible code.

Short solution summary

  • Adds a "Metamorpheus" filetype option ("meta") to the loadpage UI, updates server-side enable/disable logic to treat "meta" consistently with other supported formats, implements runtime and code-generation branches in getData/getDataCode to call MetamorpheusToMSstatsFormat (reading QuantifiedPeaks.tsv via data.table::fread), and adds unit/integration tests validating the UI option and importer behavior.

Detailed list of changes

  • R/module-loadpage-ui.R

    • Adds "Metamorpheus" = "meta" to the file type radioButtons choices in create_main_selection_controls.
    • Includes "meta" in upload-related conditional UI branches so standard quantification and annotation upload controls appear for this filetype.
    • Refactors label-free options: removes a nested conditionalPanel and replaces the "Remove proteins with 1 peptide and charge" label with "Remove proteins with 1 feature", moving the checkbox out of the extra conditional gating.
  • R/module-loadpage-server.R

    • Adds "meta" to UI enable/disable logic where the filetype should be disabled (PTM/LType, PTM/TMT, DDA/DIA branches).
    • Ensures proceed/upload buttons and opacity toggling treat "meta" consistently by including it in filetype-restriction and enablement checks.
  • R/utils.R

    • getData: Adds branch for input$filetype == "meta" that reads QuantifiedPeaks.tsv via data.table::fread and calls MetamorpheusToMSstatsFormat(annotation = getAnnot(input), useUniquePeptide = input$unique_peptides, removeFewMeasurements = FALSE, removeProtein_with1Feature = input$remove, use_log_file = FALSE).
    • getDataCode: Emits matching reproducible code for users to fread their QuantifiedPeaks.tsv and call MetamorpheusToMSstatsFormat with equivalent parameters.
  • NAMESPACE and R/MSstatsShiny.R

    • Adds importFrom(data.table, fread) to NAMESPACE and updates roxygen @importFrom to reference fread instead of copy.
  • Tests

    • tests/testthat/test-module-loadpage-ui.R: Adds assertions verifying the UI contains the label "Metamorpheus" and that a radio button choice with value "meta" is present.
    • tests/testthat/test-utils.R: Adds an integration-style test that stubs input for filetype "meta", points to fixture QuantifiedPeaks.tsv and annotation.csv, calls getData(mock_input), and asserts the returned MSstats-format structure contains expected columns and at least one row.

Unit tests added or modified

  • UI tests:
    • New assertions appended to existing loadpage UI tests to ensure "Metamorpheus" appears in the filetype choices and that a radio value "meta" exists.
  • Utils tests:
    • New integration-like test validating the Metamorpheus converter path: ensures getData succeeds with QuantifiedPeaks.tsv + annotation and returns data in expected MSstats-format (expected columns present, row count > 0).
  • Tests do not change public/exported function signatures.

Coding guidelines check

  • A repository search for CONTRIBUTING.md/.github/CONTRIBUTING.md returned no matches; no local CONTRIBUTING.md was found to run a rules-by-rules compliance check.
  • Quick manual observations:
    • No public/exported API signatures were changed.
    • Changes are localized and consistent with existing patterns (UI branching, server logic, utils, tests).
    • Added import (data.table::fread) is declared in NAMESPACE.
    • If you want a detailed compliance check against a specific CONTRIBUTING.md, provide that file or path and I will re-run the check.

@swaraj-neu swaraj-neu self-assigned this Feb 11, 2026
@swaraj-neu swaraj-neu added the enhancement New feature or request label Feb 11, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

Adds Metamorpheus ("meta") support across the load page: UI option, server enable/disable and filetype logic, getData/getDataCode handling via MetamorpheusToMSstatsFormat (using data.table::fread), NAMESPACE import, and tests. No public function signatures changed.

Changes

Cohort / File(s) Summary
UI Module
R/module-loadpage-ui.R
Adds "Metamorpheus" (meta) radio option; includes meta in upload/annotation conditional branches; refactors label-free option wording and gating for "Remove proteins with 1 feature".
Server Module
R/module-loadpage-server.R
Adds meta to enable/disable and filetype-specific logic branches controlling upload availability and proceed enablement.
Data Processing Utilities
R/utils.R
Adds filetype == "meta" branches in getData and getDataCode to read QuantifiedPeaks.tsv via data.table::fread and call MetamorpheusToMSstatsFormat with annotation and existing option mappings.
Namespace / Imports
NAMESPACE, R/MSstatsShiny.R
Adds/imports data.table::fread (roxygen/NAMESPACE adjusted).
Tests
tests/testthat/test-module-loadpage-ui.R, tests/testthat/test-utils.R
Adds UI test asserting "Metamorpheus" label and meta radio value; adds integration-style test exercising getData for Metamorpheus input and validating output schema/rows.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as Shiny UI
    participant Server as Shiny Server
    participant Utils as getData / MetamorpheusToMSstatsFormat
    User->>UI: select filetype = "meta" and upload QuantifiedPeaks.tsv
    UI->>Server: input$filetype, infile$datapath, options
    Server->>Utils: call getData(input)
    Utils->>Utils: fread(datapath) -> MetamorpheusToMSstatsFormat(annotation, options)
    Utils-->>Server: return MSstats-formatted data
    Server-->>UI: render results / enable proceed
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Suggested labels

Review effort 3/5

Suggested reviewers

  • devonjkohler

Poem

🐰 I nibble data, hop with glee,
Metamorpheus joins the menu for me,
Peaks and annots dance in a row,
Converted tidy, ready to show,
Hooray — a carrot-coded CSV!

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (7 files):

⚔️ NAMESPACE (content)
⚔️ R/MSstatsShiny.R (content)
⚔️ R/module-loadpage-server.R (content)
⚔️ R/module-loadpage-ui.R (content)
⚔️ R/utils.R (content)
⚔️ tests/testthat/test-module-loadpage-ui.R (content)
⚔️ tests/testthat/test-utils.R (content)

These conflicts must be resolved before merging into devel.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding Metamorpheus converter support to the MSstatsShiny development branch.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/metamorpheus-converter
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch feat/metamorpheus-converter
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
NAMESPACE (1)

54-55: Redundant importFrom given full import(data.table) on line 31.

Line 31 already has import(data.table), which imports all exported symbols from data.table. The specific importFrom(data.table, copy) and importFrom(data.table, fread) are therefore redundant. Since this file is auto-generated by roxygen2, the fix would be to either remove the @import data.table directive from whichever source file declares it, or remove the @importFrom data.table copy fread from R/MSstatsShiny.R — keeping one approach consistently.

This is a pre-existing issue (not introduced by this PR), so feel free to defer.

#!/bin/bash
# Find which R source file(s) declare `@import` data.table (full import)
rg -n '@import\s+data\.table\b' --type r -g '!NAMESPACE'

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 and usage tips.

@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@R/utils.R`:
- Around line 626-635: getDataCode lacks a branch for filetype 'meta' so the
generated R code omits loading and converting Metamorpheus files; add an else if
(input$filetype == 'meta') branch in the getDataCode function mirroring the
getData logic: call data.table::fread on infile$datapath and then invoke
MetamorpheusToMSstatsFormat(..., annotation = getAnnot(input), useUniquePeptide
= input$unique_peptides, removeFewMeasurements = FALSE,
removeProtein_with1Feature = input$remove, use_log_file = FALSE) so the
downloadable code reproduces the same data-loading and conversion steps as
getData.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@R/utils.R`:
- Around line 626-635: The generated code in getDataCode hardcodes
useUniquePeptide = TRUE for the Metamorpheus branch, but the runtime getData
uses input$unique_peptides; update the getDataCode branch that constructs the
MetamorpheusToMSstatsFormat call so that useUniquePeptide is set from the same
reactive (use input$unique_peptides or the variable name used when rendering
code) instead of TRUE; locate the MetamorpheusToMSstatsFormat call in
getDataCode and replace the hardcoded TRUE with the dynamic input reference to
ensure reproducibility code matches getData behavior.

Comment thread R/utils.R
Comment thread R/utils.R
}
else if(input$filetype == 'meta') {
cat(file=stderr(), "Reached in metamorpheus\n")
data = data.table::fread(infile$datapath)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add fread as a dependency here

Comment thread R/module-loadpage-ui.R
Comment on lines 544 to 557
conditionalPanel(
condition = "input['loadpage-filetype'] && input['loadpage-DDA_DIA'] == 'LType' && input['loadpage-filetype'] != 'sample' && input['loadpage-filetype'] != 'MRF' && (input['loadpage-filetype'] != 'spec' || !input['loadpage-big_file_spec'])",
h4("Select the options for pre-processing"),
checkboxInput(ns("unique_peptides"), "Use unique peptides", value = TRUE),
checkboxInput(ns("remove"), "Remove proteins with 1 peptide and charge", value = FALSE)
),

conditionalPanel(
condition = "input['loadpage-filetype'] && input['loadpage-DDA_DIA'] == 'LType' && input['loadpage-filetype'] != 'sample' && (input['loadpage-filetype'] != 'spec' || !input['loadpage-big_file_spec'])",
checkboxInput(ns("remove"), "Remove proteins with 1 feature", value = FALSE),

# Quality filtering options
create_quality_filtering_options(ns)
),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you consolidate this code to just one conditional panel

    conditionalPanel(
      condition = "input['loadpage-filetype'] && input['loadpage-DDA_DIA'] == 'LType' && input['loadpage-filetype'] != 'sample' && (input['loadpage-filetype'] != 'spec' || !input['loadpage-big_file_spec'])",
      h4("Select the options for pre-processing"),
      checkboxInput(ns("unique_peptides"), "Use unique peptides", value = TRUE),
      checkboxInput(ns("remove"), "Remove proteins with 1 feature", value = FALSE),

      # Quality filtering options
      create_quality_filtering_options(ns)
    ),

I noticed there were duplicate checkboxes with the same namespace 'remove'. After thinking about it, I can confirm there should only been one checkbox.

@tonywu1999 tonywu1999 merged commit 2dbe372 into devel Feb 13, 2026
2 checks passed
@tonywu1999 tonywu1999 deleted the feat/metamorpheus-converter branch February 13, 2026 01:05
@swaraj-neu swaraj-neu linked an issue Feb 21, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add MetamorpheusToMSstatsFormat to MSstatsShiny

2 participants