Skip to content
This repository was archived by the owner on Apr 9, 2026. It is now read-only.

Commit 51482db

Browse files
Investigate CI failure in pyopenms-docs PR (#489)
* 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. * 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. * 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. --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent d01034d commit 51482db

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

docs/source/user_guide/interactive_plots.rst

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ interactively zoomed-in if you execute the code in a notebook
1919
import holoviews.operation.datashader as hd
2020
from holoviews.plotting.util import process_cmap
2121
from holoviews import opts, dim
22-
import sys
2322
2423
hv.extension("bokeh")
2524
@@ -29,13 +28,20 @@ interactively zoomed-in if you execute the code in a notebook
2928
loadopts.setMSLevels([1])
3029
loadopts.setSkipXMLChecks(True)
3130
loadopts.setIntensity32Bit(True)
32-
loadopts.setIntensityRange(oms.DRange1(oms.DPosition1(5000), oms.DPosition1(sys.maxsize)))
3331
loader.setOptions(loadopts)
3432
loader.load("../../../src/data/BSA1.mzML", exp)
33+
34+
# Filter out low-intensity peaks using ThresholdMower
35+
threshold_filter = oms.ThresholdMower()
36+
params = threshold_filter.getDefaults()
37+
params.setValue(b"threshold", 5000.0)
38+
threshold_filter.setParameters(params)
39+
threshold_filter.filterPeakMap(exp)
40+
3541
exp.updateRanges()
3642
expandcols = ["RT", "mz", "inty"]
3743
spectraarrs2d = exp.get2DPeakDataLong(
38-
exp.getMinRT(), exp.getMaxRT(), exp.getMinMZ(), exp.getMaxMZ()
44+
exp.getMinRT(), exp.getMaxRT(), exp.getMinMZ(), exp.getMaxMZ(), 1
3945
)
4046
spectradf = pd.DataFrame(dict(zip(expandcols, spectraarrs2d)))
4147
spectradf = spectradf.set_index(["RT", "mz"])
@@ -75,17 +81,14 @@ interactively zoomed-in if you execute the code in a notebook
7581
min_alpha=0,
7682
)
7783
.opts(active_tools=["box_zoom"], tools=["hover"], hooks=[new_bounds_hook])
78-
.opts( # weird.. I have no idea why one has to do this. But with one opts you will get an error
79-
plot=dict(
80-
width=800,
81-
height=800,
82-
xlabel="Retention time (s)",
83-
ylabel="mass/charge (Da)",
84-
)
85-
)
8684
)
8785
88-
hd.dynspread(raster, threshold=0.7, how="add", shape="square")
86+
hd.dynspread(raster, threshold=0.7, how="add", shape="square").opts(
87+
width=800,
88+
height=800,
89+
xlabel="Retention time (s)",
90+
ylabel="mass/charge (Da)",
91+
)
8992
9093
9194
Result:

0 commit comments

Comments
 (0)