Skip to content

GO enrichment of proteins selected in the Viewer - #150

Open
t0mdavid-m wants to merge 14 commits into
developfrom
claude/project-thread-pnhysh
Open

t0mdavid-m wants to merge 14 commits into
developfrom
claude/project-thread-pnhysh

Conversation

@t0mdavid-m

@t0mdavid-m t0mdavid-m commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Requested by Tom · project thread

What changes

The Layout Manager has a new GO enrichment component, in the new group Functional analysis, for every identification run and for comparisons. It tests which Gene Ontology terms are over-represented in a selection of proteins (biological process, cellular component, molecular function). It shows a bar chart of the most significant terms and an Insight table of all of them. A selector next to the category sets how many terms the chart shows (10, 15, 20, 30 or 50).

In a run (identification on), proteins are selected in the other components of the grid:

  • In the protein, proteoform or PrSM tables: press the check mark button to the right of the table title to show the check boxes, then tick rows. Shift-click ticks a range, and the header box ticks every row.
  • In the proteoform heatmap: use box or lasso select in its mode bar. Shift adds to the selection.
  • The background is every protein identified in the run.

In a comparison, proteoforms (or proteins or features, depending on the level) are selected:

  • with All changed, Higher in … or Lower in … above the volcano plot;
  • with box or lasso select on the volcano plot or the clustered heatmap;
  • or by ticking rows in the comparison table.
  • The background is every tested entry that belongs to an identified protein.

Shared behaviour

  • The selection is shared, so every component marks it, in blue: dots with a white rim and a glow in the plots, a blue bar and tint on table rows.
  • Clear selection (in the GO component, or the eraser in a plot's mode bar) resets it.
  • The component is part of the default lysate layout and the default comparison layout.

GO analysis

  • It reuses the GO code that was already in the project, now in openms-insight as openms_insight.analysis.enrichment. It uses a one-sided Fisher's exact test with Benjamini-Hochberg correction per category.
  • GO terms come from MyGene.info, looked up by UniProt accession.
  • They are cached per workspace in cache/go/annotations.json, so each protein is looked up once. Unknown proteins are retried after 30 days.
  • If the lookup fails, a warning is shown and the already cached proteins are used.
  • mygene is added to requirements.txt.

Code

  • src/render/go_terms.py (Streamlit-free): the backgrounds, the selection mapping, the annotation cache and the enrichment.
  • src/render/go_view.py: the cell.
  • render.py and quant_cells.py pass multi_select= to the tables, the heatmaps and the volcano; the volcano also gets selection_presets=True.
  • hierarchy_data.py now carries the accession.
  • tests/e2e/electron-workflows.js (desktop end-to-end test; it failed the same way on develop):
    • It ticks check boxes through their label, because Streamlit draws the input at 0×0.
    • It waits for a run to start and to end before reading its result.

openms-insight

Screenshots

The screenshots use a synthetic workspace: real E. coli accessions, with made-up identifications and abundances (ribosomal proteins lower in heat, chaperones higher). The GO terms are real MyGene.info annotations.

Current selection styling. Run: box plus Shift-lasso on the proteoform heatmap (light, then dark):
heatmap light
heatmap dark

Run: check boxes in the protein table, with the toggle to the right of the title:
table

Comparison: Higher in heat on the volcano and the clustered heatmap (light, then dark):
volcano light
volcano dark

GO results, taken before the restyle. Comparison: Higher in heat, with the chart set to 20 terms (protein folding at the top):
higher

Comparison: Lower in heat:
lower

Video (recorded before the restyle, under 3 minutes): go-enrichment-selection.mp4

The media were committed and removed in the next commit, so the diff does not contain them.

Testing

  • pytest tests/: 594 passed, 5 skipped.
    • tests/test_go_terms.py covers accessions and labels, the run background, the comparison selection per level, the annotation cache (hits, retry of unknown proteins, network errors) and the term table.
  • pylint --errors-only on the changed files: clean.
  • Checked end to end with headless Chromium against streamlit run app.py local, in light and dark theme, as in the screenshots.
  • The desktop build's end-to-end test runs in CI on this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FkEGenFwDY5phFgzqdmeFg

A GO enrichment cell (Layout Manager, Functional analysis) tests the GO terms
of the proteins selected in a run: check boxes in the protein, proteoform and
PrSM tables, or a box or lasso on the proteoform heatmap. In a comparison it
tests the entries selected on the volcano plot (box, lasso, All changed,
Higher, Lower), the comparison table or the clustered heatmap, against all
tested entries. GO terms come from MyGene.info and are cached per workspace.

Builds openms-insight from claude/project-thread-pnhysh (multi_select).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGenFwDY5phFgzqdmeFg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGenFwDY5phFgzqdmeFg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGenFwDY5phFgzqdmeFg
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 99ac4fa9-0f2d-4999-ab8e-3873db1076bc
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@t0mdavid-m t0mdavid-m self-assigned this Nov 3, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGenFwDY5phFgzqdmeFg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGenFwDY5phFgzqdmeFg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGenFwDY5phFgzqdmeFg
Streamlit draws the checkbox input at 0x0, so a forced click on it fails
with "Element is outside of the viewport" (also on develop).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGenFwDY5phFgzqdmeFg

Copy link
Copy Markdown
Member Author

The desktop end-to-end test failed in setCheckbox: locator.click: Element is outside of the viewport on the Identify proteoforms checkbox. The cause is not in this PR. The same step fails on develop (run 41715039226, Linux, Windows and macOS). Streamlit draws the checkbox input at 0×0, so a forced click on it has no point to hit.

255a802 makes the scenario click the checkbox's label instead. Checked locally against the Describe experiment page: the old click fails with the same error, and the label click toggles the box off and back on.


Generated by Claude Code

The Run page keeps the previous run's "Workflow completed successfully."
until the new run shows as running, so the second (identification) run
was taken as finished right after Start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGenFwDY5phFgzqdmeFg

Copy link
Copy Markdown
Member Author

With the checkbox fix in, the e2e scenario now gets further, to the second (identification) run, and fails there: The identification did not reach FLASHAnnotator, 8 s after Start.

This PR did not cause it either. Until now the scenario never reached this step. The Run page keeps showing the previous run's "Workflow completed successfully." until the new run shows as running, so waitForText returned immediately and the log was read before FLASHTnT had started.

a026359 makes the scenario wait for the Stop Workflow button of the new run, for up to 60 s, before it waits for the result.


Generated by Claude Code

The Run page rerenders every second while a run is going and kept the
previous run's "Workflow completed successfully." on screen, so the
identification run was read as finished after its first seconds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGenFwDY5phFgzqdmeFg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FkEGenFwDY5phFgzqdmeFg
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