Skip to content

Commit ada3654

Browse files
committed
change to PeptideIdentificationList
1 parent 2332706 commit ada3654

10 files changed

+24
-25
lines changed

docs/source/user_guide/PSM_to_features.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Next, load the PeptideIdentifications from an `.idXML` file:
4545

4646
.. code-block:: python
4747
48-
peptide_ids = []
48+
peptide_ids = oms.PeptideIdentificationList()
4949
protein_ids = []
5050
oms.IdXMLFile().load(idxml_file, protein_ids, peptide_ids)
5151

docs/source/user_guide/export_files_GNPS.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ from your :py:class:`~.ConsensusMap` that have no :term:`MS2` spectra annotated.
4747
filtered_map = oms.ConsensusMap(consensus_map)
4848
filtered_map.clear(False)
4949
for feature in consensus_map:
50-
if feature.getPeptideIdentifications():
50+
if feature.getPeptideIdentifications().size() > 0:
5151
filtered_map.push_back(feature)
5252
5353
consensusXML_file = "filtered.consensusXML"

docs/source/user_guide/export_pandas_dataframe.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ PeptideIdentification
110110
111111
urlretrieve(url + "small.idXML", "small.idXML")
112112
prot_ids = []
113-
pep_ids = []
113+
pep_ids = oms.PeptideIdentificationList()
114114
oms.IdXMLFile().load("small.idXML", prot_ids, pep_ids)
115115
116116
df = oms.peptide_identifications_to_df(pep_ids)

docs/source/user_guide/identification_data.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ We can now display the peptides we just stored:
161161
:linenos:
162162
163163
# Iterate over PeptideIdentification
164-
peptide_ids = [peptide_id]
164+
peptide_ids = oms.PeptideIdentificationList()
165+
peptide_ids.push_back(peptide_id)
165166
for peptide_id in peptide_ids:
166167
# Peptide identification values
167168
print("Peptide ID m/z:", peptide_id.getMZ())
@@ -193,7 +194,7 @@ discussed :ref:`anchor-other-id-data`) which we would do as follows:
193194
oms.IdXMLFile().store("out.idXML", [protein_id], peptide_ids)
194195
# and load it back into memory
195196
prot_ids = []
196-
pep_ids = []
197+
pep_ids = oms.PeptideIdentificationList()
197198
oms.IdXMLFile().load("out.idXML", prot_ids, pep_ids)
198199
199200
# Iterate over all protein hits

docs/source/user_guide/interactive_plots.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,14 @@ interactively zoomed-in if you execute the code in a notebook
7575
min_alpha=0,
7676
)
7777
.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-
)
8678
)
8779
88-
hd.dynspread(raster, threshold=0.7, how="add", shape="square")
80+
hd.dynspread(raster, threshold=0.7, how="add", shape="square").opts(
81+
width=800,
82+
height=800,
83+
xlabel="Retention time (s)",
84+
ylabel="mass/charge (Da)",
85+
)
8986

9087

9188
Result:

docs/source/user_guide/other_ms_data_formats.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ You can store and load identification data from an `idXML` file as follows:
1717
gh = gh = "https://raw.githubusercontent.com/OpenMS/pyopenms-docs/master"
1818
urlretrieve(gh + "/src/data/IdXMLFile_whole.idXML", "test.idXML")
1919
protein_ids = []
20-
peptide_ids = []
20+
peptide_ids = oms.PeptideIdentificationList()
2121
oms.IdXMLFile().load("test.idXML", protein_ids, peptide_ids)
2222
oms.IdXMLFile().store("test.out.idXML", protein_ids, peptide_ids)
2323
@@ -31,7 +31,7 @@ You can store and load identification data from an `mzIdentML` file as follows:
3131
gh = gh = "https://raw.githubusercontent.com/OpenMS/pyopenms-docs/master"
3232
urlretrieve(gh + "/src/data/MzIdentML_3runs.mzid", "test.mzid")
3333
protein_ids = []
34-
peptide_ids = []
34+
peptide_ids = oms.PeptideIdentificationList()
3535
oms.MzIdentMLFile().load("test.mzid", protein_ids, peptide_ids)
3636
oms.MzIdentMLFile().store("test.out.mzid", protein_ids, peptide_ids)
3737
.. # alternatively: -- dont do this, doesnt work
@@ -48,7 +48,7 @@ You can store and load identification data from a TPP `pepXML` file as follows:
4848
gh = gh = "https://raw.githubusercontent.com/OpenMS/pyopenms-docs/master"
4949
urlretrieve(gh + "/src/data/PepXMLFile_test.pepxml", "test.pepxml")
5050
protein_ids = []
51-
peptide_ids = []
51+
peptide_ids = oms.PeptideIdentificationList()
5252
oms.PepXMLFile().load("test.pepxml", protein_ids, peptide_ids)
5353
oms.PepXMLFile().store("test.out.pepxml", protein_ids, peptide_ids)
5454

docs/source/user_guide/peptide_search.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ a fasta database of protein sequences:
3131
urlretrieve(gh + "/src/data/SimpleSearchEngine_1.mzML", "searchfile.mzML")
3232
urlretrieve(gh + "/src/data/SimpleSearchEngine_1.fasta", "search.fasta")
3333
protein_ids = []
34-
peptide_ids = []
34+
peptide_ids = oms.PeptideIdentificationList()
3535
oms.SimpleSearchEngineAlgorithm().search(
3636
"searchfile.mzML", "search.fasta", protein_ids, peptide_ids
3737
)
@@ -143,9 +143,9 @@ ppm\ (\pm 2\ ppm)`, we expect that we will not find the hit at :math:`775.38` m/
143143
salgo.setParameters(p)
144144
145145
protein_ids = []
146-
peptide_ids = []
146+
peptide_ids = oms.PeptideIdentificationList()
147147
salgo.search("searchfile.mzML", "search.fasta", protein_ids, peptide_ids)
148-
print("Found", len(peptide_ids), "peptides")
148+
print("Found", peptide_ids.size(), "peptides")
149149
150150
As we can see, using a smaller precursor mass tolerance leads the algorithm to
151151
find only one hit instead of two. Similarly, if we use the wrong enzyme for
@@ -189,7 +189,7 @@ Now include some additional decoy database generation step as well as subsequent
189189
190190
# Run SimpleSearchAlgorithm, store protein and peptide ids
191191
protein_ids = []
192-
peptide_ids = []
192+
peptide_ids = oms.PeptideIdentificationList()
193193
194194
# set some custom search parameters
195195
simplesearch = oms.SimpleSearchEngineAlgorithm()
@@ -224,7 +224,7 @@ This is done by applying one of the available protein inference algorithms on th
224224
:linenos:
225225
226226
protein_ids = []
227-
peptide_ids = []
227+
peptide_ids = oms.PeptideIdentificationList()
228228
229229
# Re-run search since we need to keep decoy hits for inference
230230
simplesearch.search(searchfile, target_decoy_database, protein_ids, peptide_ids)

docs/source/user_guide/quality_control.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ proteomics and metabolomics quality metrics.
4343
oms.FeatureXMLFile().load("features.featureXML", feature_map)
4444
4545
prot_ids = [] # list of ProteinIdentification()
46-
pep_ids = [] # list of PeptideIdentification()
46+
pep_ids = oms.PeptideIdentificationList() # list of PeptideIdentification()
4747
# OPTIONAL: get protein and peptide identifications from idXML file
4848
urlretrieve(gh + "/src/data/OpenPepXL_output.idXML", "ids.idXML")
4949
oms.IdXMLFile().load("ids.idXML", prot_ids, pep_ids)

docs/source/user_guide/untargeted_metabolomics_preprocessing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Map :term:`MS2` spectra to features as :py:class:`~.PeptideIdentification` objec
141141
if feature_map.getMetaValue("spectra_data")[
142142
0
143143
].decode() == exp.getMetaValue("mzML_path"):
144-
peptide_ids = []
144+
peptide_ids = oms.PeptideIdentificationList()
145145
protein_ids = []
146146
mapper.annotate(
147147
feature_map,
@@ -161,7 +161,7 @@ Map :term:`MS2` spectra to features as :py:class:`~.PeptideIdentification` objec
161161
prot_ids.append(prot_id)
162162
fm_new.setProteinIdentifications(prot_ids)
163163
for feature in feature_map:
164-
pep_ids = []
164+
pep_ids = oms.PeptideIdentificationList()
165165
for pep_id in feature.getPeptideIdentifications():
166166
pep_id.setIdentifier(f"Identifier_{i}")
167167
pep_ids.append(pep_id)

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ scikit-learn
66
tabulate
77
requests
88
bokeh
9+
jupyter_bokeh
910
datashader
1011
holoviews
1112
pyviz_comms

0 commit comments

Comments
 (0)