The GitHub Actions job "Required Checks" on texera.git/gh-readonly-queue/main/pr-9041-7f9bdf34ff1337510c73ed4ea8bb904339546239 has succeeded. Run started by GitHub user kunwp1 (triggered by kunwp1).
Head commit for run: bf6bf9fc3a75f540deb6ad2392af32bcbca51295 / Eugene Gu <[email protected]> feat(workflow-operator): volcano plot significance cut-offs (#9041) ### What changes were proposed in this PR? The Volcano Plot draws a plain scatter of effect size vs `-log10(p)`, colored by effect size, which is already the x axis. Nothing shows where the significance bar is or which points clear it. This PR adds three optional properties, all off by default, so saved workflows render as before. | Property | Type | Effect when set | |---|---|---| | Significance threshold | number, `0 < x <= 1` | dashed horizontal line at `-log10(threshold)` | | Effect-size threshold | number, `> 0` | dashed vertical lines at `+threshold` and `-threshold` | | Color by significance | boolean | with both thresholds set, points are colored `Up` / `Down` / `Not significant` with a legend instead of the continuous `RdBu` scale | ``` Before: px.scatter(color=<effect column>, color_continuous_scale="RdBu") After: same by default + fig.add_hline(...) when a significance threshold is set + fig.add_vline(+eff) / fig.add_vline(-eff) when an effect-size threshold is set + color=<category column>, 3-color map when the toggle is on and both thresholds are set ``` Categories use strict comparisons on the selected p-value column: `Up` = `p < sig` and `effect > eff`, `Down` = `p < sig` and `effect < -eff`, everything else `Not significant`. The categories are stored in a new column that px colors by. It is named `Significance`, with underscores appended until no input column has that name, so no input column is overwritten. The legend and the hover call it `Significance`. The one exception is an effect column that is itself named `Significance`: the category then shows under the column's own name (`Significance_`), because px merges two hover lines that share a label. Colors are ColorBrewer RdBu end points `#B2182B` / `#2166AC` plus grey `#9E9E9E`. Validation: the JSON schema bounds above stop bad values in the property panel. For hand-edited JSON the operator also ignores a threshold it cannot draw (NaN, infinite, <= 0, or a p cut-off > 1) and falls back to the continuous coloring if the toggle is on but a threshold is missing. A cut-off of exactly 1 is allowed and draws its line at y = 0. If the cut-off's `-log10` is beyond the data range the line may fall outside the auto-ranged axis; extending the range is left for a follow-up. Since #8504 merged, the operator also exports a standalone script through `generateStandaloneCode()`. This PR adds the cut-off lines and the `Up` / `Down` / `Not significant` coloring there too, from the same helpers where possible: the color map and category order are one shared literal, the threshold lines come from the same builder, and only the column names differ (Python literals instead of decoded strings). A spec checks that both paths make the same line and coloring decisions for eight threshold shapes, so the exported figure cannot drift from the engine's. The label fix (#9037) and the hover column (#9038) have landed and this branch is merged with both. The title and the axis labels apply in both coloring modes; the color bar title only shows with the continuous coloring, since the category coloring has a legend instead of a color bar. Figures below are the operator's generated Python from `main` and from this branch, run on the 430-gene example workflow from the issue, with thresholds 0.05 and 1. | Before | After (lines only) | After (lines + Color by significance) | |---|---|---| | <img width="1398" height="849" alt="before-main" src="https://github.com/user-attachments/assets/2dd6c551-04b7-41cc-988d-cb19180703cd" /> | <img width="1398" height="849" alt="thresholds-after-lines-only" src="https://github.com/user-attachments/assets/ab3f4d36-3c8f-4073-8f73-ea967bf19174" /> | <img width="1398" height="849" alt="thresholds-after-colored" src="https://github.com/user-attachments/assets/d714fcc7-09cc-4e3f-897d-0da61bb1f8a6" /> | ### Any related issues, documentation, discussions? Closes #9039 PR #8504 (merged) added the `generateStandaloneCode()` export path; the mirroring described above is the follow-up it needed. ### How was this PR tested? New tests in `VolcanoPlotOpDescSpec`, written before the source change: - defaults: no lines, continuous coloring; each threshold alone emits only its own line(s); both with the toggle off keep the continuous coloring - toggle on with both thresholds: strict comparisons, `np.select` categories written to a column whose name no input column has, `color`, `labels` and `category_orders` keyed by that column, exact color map, no `color_continuous_scale` - an effect column named `Significance`: neither path assigns `table["Significance"]`, and both leave the `Significance` label off so the two hover lines stay apart; an effect column named `Significance_` keeps the label - toggle on with one or no threshold: continuous fallback - zero / negative thresholds and a p cut-off above 1 emit no line of their own; `Infinity`, `-Infinity`, `NaN` from JSON never reach the Python - a cut-off of exactly 1 draws its line and still colors by category - thresholds are emitted as valid Python floats, checked for `1e-300`, `Double.MIN_VALUE` and `1e21` in every site they appear - the generated JSON schema carries `exclusiveMinimum` / `maximum` on the two thresholds - JSON deserialization: numbers, numeric strings, null, blank, absent, and the boolean toggle - a workflow JSON saved before this change generates byte-for-byte the same code as a default-constructed operator - `generateStandaloneCode`: defaults draw no line and keep the continuous coloring; the toggle on colors `Up` / `Down` / `Not significant` with the column names as literals; a cross-path test checks that the exported script makes the same cut-off and coloring decisions as the engine for eight threshold shapes (unset, one side only, zero, p cut-off above 1, non-finite, exactly 1) ``` sbt -Dsbt.server.forcestart=true "WorkflowOperator/testOnly *VolcanoPlotOpDescSpec" # Tests: succeeded 43, failed 0, canceled 0, ignored 0, pending 1 (the pending one is pre-existing; the count includes the label and hover tests now on main) sbt -Dsbt.server.forcestart=true "WorkflowOperator/scalafmtAll" "WorkflowOperator/Test/scalafmtAll" sbt -Dsbt.server.forcestart=true "WorkflowOperator/scalafixAll --check" # success ``` Smoke run outside Texera (pytexera stubbed, pandas + plotly 5.24.1) on the 430-gene mock table, 420 rows after the operator drops zero and missing p-values: | Configuration | Lines | Traces | |---|---|---| | defaults | none | 1 continuous trace, 420 points | | 0.05 / 1, toggle off | hline y = 1.301, vlines x = ±1 | 1 continuous trace | | 0.05 / 1, toggle on | same | `Up` 35, `Down` 35, `Not significant` 350 | | 0.05 only, toggle on | hline only | continuous (fallback) | | 0.05 / -1, toggle on | hline only | continuous (fallback) | | 2 / 1, toggle on | vlines only | continuous (fallback) | | `"Infinity"` / `"NaN"` from JSON | none | continuous, no such token in the code | | 1e-300 / 1e21, toggle on | hline y = 300, vlines x = ±1e21 | `Not significant` 420 | | 1 / 1, toggle on | hline y = 0, vlines x = ±1 | `Up` 41, `Down` 38, `Not significant` 341 | Column-name collisions, run on both generated paths with thresholds 0.05 / 1 and the toggle on (10-row table, 8 rows after the filter): an effect column, a selected hover column or the first column named `color`; an unused column, the hover column or the p-value column named `Significance`; `Significance` and `Significance_` both present; an effect column named `Significance_`; a column name with quotes, a backslash and non-ASCII text. Every case draws `Up` 2 / `Down` 1 / `Not significant` 5 in the three colors with the legend titled `Significance`, the x values and the hover text equal the input columns, the engine and exported figures are equal as JSON, and the input table is unchanged. With the effect column named `Significance` the legend reads `Significance_` and the hover keeps both the category line and the x line. For an ordinary table the figure is unchanged from the previous revision of this PR. With thresholds 0.05 / 1, a hover column, and Title, X Label and Y Label all set, both paths draw the configured title and axis labels. With the toggle on they show the `Significance` legend and no trace uses the color bar; with the toggle off the color bar is titled with the X Label. The exponent-form dumps pass `python -m py_compile`. The exported script for the default, lines-only and colored configurations parses with `ast.parse`. ### Was this PR authored or co-authored using generative AI tooling? Yes. Generated-by: Claude Code (claude-fable-5-1). Co-authored with Claude; the author reviewed the change before submission. Report URL: https://github.com/apache/texera/actions/runs/44837193583 With regards, GitHub Actions via GitBox
