Skip to content

Commit 5698ab1

Browse files
committed
Merge branch 'master' of https://github.com/OpenMS/pyopenms-docs into fixs
2 parents 3f5a164 + c9c4752 commit 5698ab1

File tree

12 files changed

+392
-166
lines changed

12 files changed

+392
-166
lines changed

.github/workflows/code-blocks-linting.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
1717
- name: Get changed files
1818
id: changed-files
19-
uses: tj-actions/changed-files@v41
19+
uses: tj-actions/changed-files@v46
2020
with:
2121
dir_names_max_depth: 0
2222
files: |

.github/workflows/test-pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
- name: Get changed files
2121
id: changed-files
22-
uses: tj-actions/changed-files@v45
22+
uses: tj-actions/changed-files@v46
2323
with:
2424
dir_names_max_depth: 0
2525
files: |

docs/source/_static/OpenMS.svg

Lines changed: 162 additions & 57 deletions
Loading

docs/source/_static/custom.css

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ p.rubric+dl.py.function {
7070
/* Parameter names should look a bit different from types */
7171
.sig-param > span.n:nth-child(1) > .pre {
7272
font-weight: 500;
73-
color: #16324F;
73+
color: #3f87d3;
7474
}
7575

7676
/* In desktop mode, when the top navbar is filled, make the padding to
@@ -118,11 +118,6 @@ p.rubric+dl.py.function {
118118
100% {transform: rotate(-35deg) translate(0px, 0px);}
119119
}
120120

121-
/* Enlarge logo */
122-
.navbar-brand img {
123-
scale: 2.0
124-
}
125-
126121
/* In the right tocs:
127122
The edit pencil icon is a bit bigger than the show source file icon.
128123
Therefore pad it. */

docs/source/conf.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@
150150
# The type of image to be used (see below for details)
151151
"type": "fontawesome",
152152
},
153+
{
154+
"name": "Discord",
155+
"url": "https://discord.com/invite/4TAGhqJ7s5",
156+
"icon": "fa-brands fa-discord",
157+
},
153158
{
154159
"name": "PyPI",
155160
"url": "https://pypi.org/project/pyopenms",

docs/source/img/OpenMS.svg

Lines changed: 162 additions & 57 deletions
Loading
Lines changed: 9 additions & 10 deletions
Loading

docs/source/user_guide/charge_isotope_deconvolution.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ Let's look at a very heavy peptide, whose isotopic distribution is dominated by
124124
use_decreasing_model,
125125
start_intensity_check,
126126
False,
127+
True
127128
)
128129
for p in s:
129130
print("Mono peaks:", p.getMZ(), p.getIntensity())
@@ -156,6 +157,7 @@ state:
156157
:linenos:
157158
158159
from urllib.request import urlretrieve
160+
import matplotlib.pyplot as plt
159161
160162
gh = "https://raw.githubusercontent.com/OpenMS/pyopenms-docs/master"
161163
urlretrieve(gh + "/src/data/BSA1.mzML", "BSA1.mzML")
@@ -179,6 +181,7 @@ state:
179181
use_decreasing_model,
180182
start_intensity_check,
181183
False,
184+
True
182185
)
183186
184187
print(e[214].size())

docs/source/user_guide/faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Add an entry to ``src/pyOpenMS/pxds/CLASS_NAME.pxd`` with the signature of your
1212
How can I wrap a new class with pyOpenMS?
1313
*************************************************
1414

15-
Create a new file ``src/pyOpenMS/pxds/CLASS_NAME.pxd`` and use the `procedure outlined <wrap_classes.rst#how-to-wrap-new-classes>`_.
15+
Create a new file ``src/pyOpenMS/pxds/CLASS_NAME.pxd`` and use the `procedure outlined <../community/wrapping_workflows_new_classes.html#how-to-wrap-new-classes>`_.
1616

1717

1818
Can I use multiple output parameters?

docs/source/user_guide/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ can type
3131
We have binary packages for OSX, Linux and Windows (64 bit only) available from
3232
`PyPI <https://pypi.org/project/pyopenms>`_. Make sure to download
3333
the 64bit Python release for Windows. Currently we only support
34-
Python 3.9, 3.10 and 3.11.
34+
Python 3.9, 3.10, 3.11, 3.12 and 3.13.
3535

3636
You can install Python first from `here <https://www.python.org/downloads/>`_,
3737
again make sure to download the 64bit release. You can then open a shell and

docs/source/user_guide/quantitative_data.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ analysis.
2727
masstrace.push_back(p)
2828
2929
Usually, the quantitative features would be produced by a so-called
30-
:py:class:`~.FeatureFinder` algorithm, which we will discuss in the `next chapter <feature_detection.html>`_. The
30+
`FeatureFinder` algorithm, which we will discuss in the `next chapter <feature_detection.html>`_. The
3131
features can be stored in a :py:class:`~.FeatureMap` and written to disk.
3232

3333
.. code-block:: python

docs/source/user_guide/reading_raw_ms_data.rst

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,14 @@ chromatograms as they are read from the disk. A simple implementation could look
121121
122122
which can the be used as follows:
123123

124-
.. code-block:: output
124+
.. code-block:: python
125125
126126
filename = b"test.mzML"
127127
consumer = MSCallback()
128128
oms.MzMLFile().transform(filename, consumer)
129+
130+
.. code-block:: output
131+
129132
Read a spectrum
130133
Read a spectrum
131134
Read a spectrum
@@ -138,50 +141,61 @@ spectrum or chromatogram is read from disk, the function ``consumeSpectrum`` or
138141
``consumeChromatogram`` is called and a specific action is performed. We can
139142
use this to implement a simple filtering function for mass spectra:
140143

141-
.. code-block:: output
144+
.. code-block:: python
142145
143-
class FilteringConsumer:
144-
"""
145-
Consumer that forwards all calls the internal consumer (after
146-
filtering)
147-
"""
146+
import os
147+
import pyopenms as oms
148+
from urllib.request import urlretrieve
148149
149-
def __init__(self, consumer, filter_string):
150-
self._internal_consumer = consumer
151-
self.filter_string = filter_string
150+
gh = "https://raw.githubusercontent.com/OpenMS/pyopenms-docs/master"
151+
urlretrieve(gh + "/src/data/tiny.mzML", "test.mzML")
152152
153-
def setExperimentalSettings(self, s):
154-
self._internal_consumer.setExperimentalSettings(s)
153+
print("Current Working Directory where all files are stored:", os.getcwd())
155154
156-
def setExpectedSize(self, a, b):
157-
self._internal_consumer.setExpectedSize(a, b)
155+
class FilteringConsumer:
156+
"""
157+
Consumer that forwards all calls the internal consumer (after
158+
filtering out spectra with less than 'min_spec_size' peaks)
159+
"""
158160
159-
def consumeChromatogram(self, c):
160-
if c.getNativeID().find(self.filter_string) != -1:
161-
self._internal_consumer.consumeChromatogram(c)
161+
def __init__(self, consumer, min_spec_size = 0):
162+
self._internal_consumer = consumer
163+
self._min_spec_size = min_spec_size
162164
163-
def consumeSpectrum(self, s):
164-
if s.getNativeID().find(self.filter_string) != -1:
165-
self._internal_consumer.consumeSpectrum(s)
165+
def setExperimentalSettings(self, s):
166+
self._internal_consumer.setExperimentalSettings(s)
167+
168+
def setExpectedSize(self, a, b):
169+
self._internal_consumer.setExpectedSize(a, b)
170+
171+
def consumeChromatogram(self, c):
172+
# just forward; do nothing to chromatograms
173+
self._internal_consumer.consumeChromatogram(c)
174+
175+
def consumeSpectrum(self, s):
176+
print("Spec has size: ", s.size())
177+
if s.size() >= self._min_spec_size:
178+
print(" --> keep it")
179+
self._internal_consumer.consumeSpectrum(s)
180+
else:
181+
print(" --> discard it")
166182
167-
###################################
168-
filter_string = "DECOY"
169-
inputfile = "in.mzML"
170-
outputfile = "out.mzML"
171-
###################################
172183
173-
consumer = oms.PlainMSDataWritingConsumer(outputfile)
174-
consumer = FilteringConsumer(consumer, filter_string)
184+
min_spec_size = 11 ## we will keep spectra with 11 or more peaks and discard the others
185+
inputfile = "test.mzML"
186+
outputfile = "out.mzML"
175187
176-
oms.MzMLFile().transform(inputfile, consumer)
188+
consumer = oms.PlainMSDataWritingConsumer(outputfile)
189+
consumer = FilteringConsumer(consumer, min_spec_size)
177190
191+
oms.MzMLFile().transform(inputfile, consumer)
178192
179-
where the spectra and chromatograms are filtered by their native ids. It is
193+
, where the spectra are filtered by their size. It is
180194
similarly trivial to implement filtering by other attributes. Note how the data
181195
are written to disk using the :py:class:`~.PlainMSDataWritingConsumer` which is one of
182196
multiple available consumer classes -- this specific class will simply take the
183-
spectrum ``s`` or chromatogram ``c`` and write it to disk (the location of the
184-
output file is given by the ``outfile`` variable).
197+
:py:class:`~.MSSpectrum` ``s`` or :py:class:`~.MSChromatogram` ``c`` and write it to disk (the location of the
198+
output file is given by the ``outputfile`` variable).
185199

186200
Note that this approach is memory efficient in cases where computation should
187201
only occur on part of the data or the whole data may not fit into memory.

0 commit comments

Comments
 (0)