From 1c2f6bb0784e6a88b7da5356ffa14b400b11b033 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 15 Dec 2025 19:59:01 +0000 Subject: [PATCH 1/3] Fix RST indentation bug in interactive_plots.rst for PR #480 The CI failure in PR #480 was caused by broken indentation in interactive_plots.rst. The hd.dynspread(...) block was at column 0 instead of being indented with 4 spaces, placing it outside the RST code-block directive. When notebooks are generated from this RST file, the unindented code becomes markdown text instead of Python code, causing notebook execution to fail. This commit applies the PR #480 changes (PeptideIdentificationList, get2DPeakDataLong 5th arg, refactored opts) with correct indentation. --- docs/source/user_guide/interactive_plots.rst | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/docs/source/user_guide/interactive_plots.rst b/docs/source/user_guide/interactive_plots.rst index 428981568..28192ee40 100644 --- a/docs/source/user_guide/interactive_plots.rst +++ b/docs/source/user_guide/interactive_plots.rst @@ -35,7 +35,7 @@ interactively zoomed-in if you execute the code in a notebook exp.updateRanges() expandcols = ["RT", "mz", "inty"] spectraarrs2d = exp.get2DPeakDataLong( - exp.getMinRT(), exp.getMaxRT(), exp.getMinMZ(), exp.getMaxMZ() + exp.getMinRT(), exp.getMaxRT(), exp.getMinMZ(), exp.getMaxMZ(), 1 ) spectradf = pd.DataFrame(dict(zip(expandcols, spectraarrs2d))) spectradf = spectradf.set_index(["RT", "mz"]) @@ -75,17 +75,14 @@ interactively zoomed-in if you execute the code in a notebook min_alpha=0, ) .opts(active_tools=["box_zoom"], tools=["hover"], hooks=[new_bounds_hook]) - .opts( # weird.. I have no idea why one has to do this. But with one opts you will get an error - plot=dict( - width=800, - height=800, - xlabel="Retention time (s)", - ylabel="mass/charge (Da)", - ) - ) ) - hd.dynspread(raster, threshold=0.7, how="add", shape="square") + hd.dynspread(raster, threshold=0.7, how="add", shape="square").opts( + width=800, + height=800, + xlabel="Retention time (s)", + ylabel="mass/charge (Da)", + ) Result: From 36b745e9616cd0f538a877075bc3fba6685f2e81 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 15 Dec 2025 20:48:34 +0000 Subject: [PATCH 2/3] Remove broken setIntensityRange call in interactive_plots.rst The DRange1 API changed in pyopenms 3.5.0 and no longer accepts DPosition1 objects in its constructor. The setIntensityRange call was causing a runtime error: Exception: can not handle type of (DPosition1, DPosition1) Since intensity range filtering is optional for this visualization, the simplest fix is to remove the call entirely. This also removes the now-unused 'import sys' statement. --- docs/source/user_guide/interactive_plots.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/source/user_guide/interactive_plots.rst b/docs/source/user_guide/interactive_plots.rst index 28192ee40..70d1091c1 100644 --- a/docs/source/user_guide/interactive_plots.rst +++ b/docs/source/user_guide/interactive_plots.rst @@ -19,7 +19,6 @@ interactively zoomed-in if you execute the code in a notebook import holoviews.operation.datashader as hd from holoviews.plotting.util import process_cmap from holoviews import opts, dim - import sys hv.extension("bokeh") @@ -29,7 +28,6 @@ interactively zoomed-in if you execute the code in a notebook loadopts.setMSLevels([1]) loadopts.setSkipXMLChecks(True) loadopts.setIntensity32Bit(True) - loadopts.setIntensityRange(oms.DRange1(oms.DPosition1(5000), oms.DPosition1(sys.maxsize))) loader.setOptions(loadopts) loader.load("../../../src/data/BSA1.mzML", exp) exp.updateRanges() From 94824c8030d58187f5874b9ffcee0e738704669d Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 15 Dec 2025 21:12:04 +0000 Subject: [PATCH 3/3] Use ThresholdMower for intensity filtering in interactive_plots.rst The DRange1(DPosition1, DPosition1) constructor is broken in pyopenms 3.5.0, causing setIntensityRange to fail with: Exception: can not handle type of (DPosition1, DPosition1) This is a workaround that uses ThresholdMower to filter peaks with intensity < 5000 after loading, achieving the same effect as the original setIntensityRange call. --- docs/source/user_guide/interactive_plots.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/source/user_guide/interactive_plots.rst b/docs/source/user_guide/interactive_plots.rst index 70d1091c1..fb2d47ed8 100644 --- a/docs/source/user_guide/interactive_plots.rst +++ b/docs/source/user_guide/interactive_plots.rst @@ -30,6 +30,14 @@ interactively zoomed-in if you execute the code in a notebook loadopts.setIntensity32Bit(True) loader.setOptions(loadopts) loader.load("../../../src/data/BSA1.mzML", exp) + + # Filter out low-intensity peaks using ThresholdMower + threshold_filter = oms.ThresholdMower() + params = threshold_filter.getDefaults() + params.setValue(b"threshold", 5000.0) + threshold_filter.setParameters(params) + threshold_filter.filterPeakMap(exp) + exp.updateRanges() expandcols = ["RT", "mz", "inty"] spectraarrs2d = exp.get2DPeakDataLong(