Skip to content

feat: Add Spectronaut pivot report import with condition setup, inline exp design, and gene symbol splitting#75

Open
cliandouble08 wants to merge 4 commits intomainfrom
spectronaut-condition-setup
Open

feat: Add Spectronaut pivot report import with condition setup, inline exp design, and gene symbol splitting#75
cliandouble08 wants to merge 4 commits intomainfrom
spectronaut-condition-setup

Conversation

@cliandouble08
Copy link
Copy Markdown
Collaborator

@cliandouble08 cliandouble08 commented Mar 31, 2026

Summary

  • Adds Spectronaut pivot report (TSV) import with per-file condition setup: upload a Spectronaut-exported condition setup TSV to auto-populate run labels, conditions, and replicates
  • Detects available quantification suffixes (e.g. .PG.Quantity, .PG.IBAQ) from pivot report columns and lets the user select which metric to keep
  • Adds optional identifier splitting: extract first ID from semicolon-delimited protein group columns for CSV/Excel uploads
  • Adds optional gene symbol splitting for GCT uploads — now a user-controlled checkbox with configurable separator
  • Supplements the file-upload experimental design step with an inline rhandsontable editor for CSV/Excel workflows
  • Supports sample_annotation column in experimental design to rename sample columns to friendly names; renames are applied at process time and live-previewed as the user types
  • Live-updates the data preview panel when the user toggles identifier splitting, imports a condition setup file, changes the quantification suffix, or edits sample annotation names in the exp design table
  • Preserves the full rename chain (raw run label → Spectronaut condition name → sample annotation name) in cdesc$original_column_name; exports a GCT_originalColNames file whenever any column renaming occurred
  • Adds protigy.enable_spectronaut R option in app.R to gate the Spectronaut condition setup UI — set FALSE for public releases without Spectronaut-specific UI, TRUE for internal use

Changes

New files:

  • R/sidebar_setup_helpers_spectronaut.R — Spectronaut parsing, column detection, condition setup reading, and preprocessing helpers (read_spectronaut_condition_setup, detect_quant_suffixes, apply_spectronaut_condition_setup, buildExpDesignFromConditionSetup)
  • tests/testthat/test-spectronaut-processing.R — unit tests for Spectronaut helpers

Modified files:

  • R/sidebar_setup.R — Spectronaut upload path, inline exp design flow, identifier splitting wiring; live preview observers for split identifier, condition setup import, and sample annotation edits; fix rhandsontable crash by setting contextMenu directly on widget object; fix protigy_id propagation through identifier selection and exp design steps; show all columns (including protigy_id) in exp design table; apply sample annotation renames at process time and build original_cid_map from the full rename chain
  • R/sidebar_setup_helpers_csv-excel-processing.Rextract_protigy_id, classifyColumns updates for rhandsontable integration; per-file condition setup and ID splitting UI; createCdesc accepts original_cid_map and writes cdesc$original_column_name; Spectronaut condition setup UI gated by protigy.enable_spectronaut option
  • R/sidebar_setup_helpers_experimental-design.R — inline editable exp design support
  • R/sidebar_setup_helpers_shiny.RgctSetupUI gains gene symbol split checkbox + separator input
  • R/sidebar_setup_helpers_GCT-processing.R — wiring updates
  • R/tab_summary.R — accepts column_rename_map reactive; GCT_original_originalColNames_export_function handles both Spectronaut and sample annotation rename sources, adds renamed_column_name to cdesc for traceability
  • R/app_ui.R — exp design panel and data preview panel in sidebar
  • app.Rprotigy.enable_spectronaut feature flag (default FALSE)
  • inst/setup_parameters/setupDefaults.yaml — new default parameters
  • inst/custom.css — word-wrap fix for long label inputs

Dependencies added: rhandsontable

Bug fixes

  • rhandsontable crash (Error in &&: invalid 'y' type in 'x && y'): contextMenu = list(...) passed via ... to hot_table() which runs if (!is.null(contextMenu) && contextMenu) — fails for list type. Fixed by setting ht$x$contextMenu directly after widget creation.
  • protigy_id not visible in downstream steps: preview was never updated after label submission. Fixed by updating preview after storing the pristine copy.
  • CID not updated from sample_annotation: rename was only applied in the condition file upload observer, not at "Process Files" time. Fixed by applying at process time.
  • Original raw column names lost: tracked via raw_column_names_per_label and composed into original_cid_map at process time.

Test plan

  • Upload a Spectronaut pivot report CSV — verify preprocessing step appears with run labels and suffix selector
  • Upload a Spectronaut condition setup TSV — verify it live-updates the data preview with renamed column headers
  • Select a quantification suffix and confirm only matched columns are kept and renamed
  • Toggle "Split identifier column" — verify data preview immediately shows protigy_id as first column; uncheck to revert
  • Upload a standard CSV/Excel file — confirm inline rhandsontable exp design editor works without crashing
  • Edit sample_annotation column in exp design table — verify data preview updates live with new column names
  • Enable gene symbol splitting on a GCT upload — verify separator is respected
  • Process files and verify all columns (including protigy_id) appear in the exp design table
  • Verify devtools::test() passes including new spectronaut and CSV/Excel tests
  • Run devtools::check() with no new errors/warnings
  • Set options(protigy.enable_spectronaut = FALSE) and confirm Spectronaut checkbox is hidden; set TRUE to re-enable

Closes #56

@cliandouble08 cliandouble08 force-pushed the spectronaut-condition-setup branch from 1d0147f to b2925ec Compare March 31, 2026 16:24
@cliandouble08 cliandouble08 marked this pull request as draft March 31, 2026 16:25
@cliandouble08 cliandouble08 force-pushed the spectronaut-condition-setup branch 3 times, most recently from 93ad2ea to 4b12119 Compare April 4, 2026 02:57
@cliandouble08 cliandouble08 changed the title feat: Spectronaut preprocessing & in-app condition setup feat: Add Spectronaut pivot report import with condition setup, inline exp design, and gene symbol splitting Apr 4, 2026
@cliandouble08 cliandouble08 force-pushed the spectronaut-condition-setup branch 3 times, most recently from df4730f to 1974c52 Compare April 6, 2026 17:41
…gene symbol splitting

- Add Spectronaut condition setup UI and server logic with inline experiment design editor
- Add gene symbol column splitting (split_gene_symbol_column) and protigy ID extraction (extract_protigy_id)
- Fix input ID sanitization: rename deliminate_id_ → delimit_id_ with gsub-based safe ID generation
- Fix shinyjs disable/enable calls to use unscopedIDs (drop ns() wrapping) for submitCSVExcelLabelsButton
- Add duplicate column name warnings in apply_spectronaut_condition_setup and buildExpDesignFromConditionSetup
- Improve find_col ambiguity handling: emit warning when multiple columns match a pattern
- Fix missing closing brace in read_uploaded_data_preview and split_gene_symbol_column (trailing newline)
- Improve roxygen docs: use \code{} in @param descriptions for apply_spectronaut_condition_setup and split_gene_symbol_column
- Remove deprecated spectronautSetupUI.Rd man page
- Bump RoxygenNote to 7.3.3 in DESCRIPTION
- Fix rhandsontable crash: set contextMenu directly on widget object to bypass broken && check in hot_table()
- Fix live preview: update data preview panel after split identifier and condition setup file import
- Fix protigy_id propagation: pass updated dataframe (with protigy_id column) to identifier selection and exp design steps
- Show all columns including protigy_id in experimental design table
- Fix cid renaming from sample_annotation: apply rename at process time, preserve original raw column names in cdesc$original_column_name
- Add original-column-name GCT export when Spectronaut condition setup renames columns
- Fix live preview not updating with sample_annotation renames during experimental design step
- Add protigy.enable_spectronaut R option in app.R to gate Spectronaut UI for internal vs. public releases
@cliandouble08 cliandouble08 force-pushed the spectronaut-condition-setup branch from 1974c52 to e8f4299 Compare April 6, 2026 18:51
processCSVExcelWorkflowWithPerDatasetIdentifiers now returns a third
key "warnings" for surfacing sample mismatch notifications in the UI.
Tests were not updated to match the new return structure.
@cliandouble08 cliandouble08 marked this pull request as ready for review April 6, 2026 19:44
@cliandouble08 cliandouble08 requested a review from nmclark2 April 6, 2026 19:45
@cliandouble08 cliandouble08 self-assigned this Apr 6, 2026
@cliandouble08 cliandouble08 added the enhancement New feature or request label Apr 6, 2026
…ut IDs

- Add htmlwidgets to DESCRIPTION Imports and protigy-package.R to fix
  R CMD check WARNING about undeclared '::' import (was failing all 4 CI checks)
- Change use_condition_setup_ checkbox and conditionalPanel to use
  sanitized file_id instead of raw filename, preventing JS breakage
  when filenames contain special characters like apostrophes
- Update server-side condition_flags to match sanitized IDs
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.

Support direct import of Condition Setup (.tsv) from Spectronaut

1 participant