@@ -13,7 +13,6 @@ some commonly used operations like chemical formula, weight, and isotope distrib
13
13
The example below shows how amino acid sequences can be created and how basic mass calculations are conducted.
14
14
15
15
.. code-block :: python
16
- :linenos:
17
16
18
17
import pyopenms as oms
19
18
@@ -96,7 +95,6 @@ The N- and C-Terminus as well as the residues themself can be modified.
96
95
The example below shows how to check for such modifications.
97
96
98
97
.. code-block :: python
99
- :linenos:
100
98
101
99
seq = oms.AASequence.fromString(" C[143]PKCK(Label:13C(6)15N(2))CR" )
102
100
@@ -136,7 +134,6 @@ about :py:class:`~.EmpiricalFormula` to get accurate mass and isotope distributi
136
134
the amino acid sequence. But first, let's get the formula of peptide:
137
135
138
136
.. code-block :: python
139
- :linenos:
140
137
141
138
seq = oms.AASequence.fromString(" DFPIANGER" )
142
139
seq_formula = seq.getFormula()
@@ -149,7 +146,6 @@ Isotope Patterns
149
146
We now want to print the coarse (e.g., peaks only at nominal masses) distribution.
150
147
151
148
.. code-block :: python
152
- :linenos:
153
149
154
150
# print coarse isotope distribution
155
151
coarse_isotopes = seq_formula.getIsotopeDistribution(
@@ -165,7 +161,6 @@ But if we deal with very high resolution instruments, we still might want to cal
165
161
We use the :py:class: `~.FineIsotopePatternGenerator ` in OpenMS to reveal these additional peaks:
166
162
167
163
.. code-block :: python
168
- :linenos:
169
164
170
165
# print fine structure of isotope distribution
171
166
fine_isotopes = seq_formula.getIsotopeDistribution(
@@ -180,7 +175,6 @@ We use the :py:class:`~.FineIsotopePatternGenerator` in OpenMS to reveal these a
180
175
And plot the very similar looking distributions using standard ``matplotlib `` functionality:
181
176
182
177
.. code-block :: python
183
- :linenos:
184
178
185
179
import math
186
180
from matplotlib import pyplot as plt
@@ -223,7 +217,6 @@ Fragment Ions
223
217
We can easily calculate different ion types for amino acid sequences:
224
218
225
219
.. code-block :: python
226
- :linenos:
227
220
228
221
suffix = seq.getSuffix(3 ) # y3 ion "GER"
229
222
print (" =" * 35 )
@@ -264,7 +257,6 @@ peptide "DFPIAMGER" with an oxidized methionine. There are multiple ways to spec
264
257
265
258
266
259
.. code-block :: python
267
- :linenos:
268
260
269
261
seq = oms.AASequence.fromString(" PEPTIDESEKUEM(Oxidation)CER" )
270
262
print (seq.toUnmodifiedString())
@@ -310,7 +302,6 @@ respectively, but ``".DFPIAMGER(Phospho)."`` will be interpreted as a
310
302
phosphorylation of the last arginine at its side chain:
311
303
312
304
.. code-block :: python
313
- :linenos:
314
305
315
306
s = oms.AASequence.fromString(" .(Dimethyl)DFPIAMGER." )
316
307
print (s, s.hasNTerminalModification())
@@ -334,43 +325,43 @@ Applying Fixed or Variable Modifications to Sequences
334
325
In this tutorial, we will cover a step-by-step guide on how to use the pyopenms library to generate modified peptides from a given amino acid sequence.
335
326
336
327
.. code-block :: python
337
- :linenos:
338
- import pyopenms as poms
339
-
340
- # Create an amino acid sequence using the fromString() method of the AASequence class.
341
- # In this example, we will use the amino acid sequence "TESTMTECSTMTESTR"
342
- sequence = poms.AASequence.fromString("TESTMTECSTMTESTR")
343
-
344
- # We use the names "Oxidation (M)" and "Carbamidomethyl (C)" for the variable and fixed modifications, respectively.
345
- variable_mod_names = [b"Oxidation (M)"]
346
- fixed_mod_names = [b"Carbamidomethyl (C)"]
347
328
348
- # We then use the getModifications() method of the ModifiedPeptideGenerator class to get the modifications for these names.
349
- variable_modifications = poms.ModifiedPeptideGenerator.getModifications(variable_mod_names)
350
- fixed_modifications = poms.ModifiedPeptideGenerator.getModifications(fixed_mod_names)
351
-
352
- # Apply the fixed modifications to the amino acid sequence
353
- poms.ModifiedPeptideGenerator.applyFixedModifications(fixed_modifications, sequence)
354
-
355
- # Define the maximum number of variable modifications allowed
356
- max_variable_mods = 1
357
-
358
- # Generate the modified peptides
359
- peptides_with_variable_modifications = []
360
- keep_unmodified_in_result = False
361
- poms.ModifiedPeptideGenerator.applyVariableModifications(variable_modifications, sequence, max_variable_mods,
362
- peptides_with_variable_modifications,
363
- keep_unmodified_in_result)
364
-
365
- # Print the modified peptides generated using Fixed modifications and their mono-isotopic mass.
366
- print("Fixed:", sequence.toString())
367
- print("Mono-isotopic mass:", sequence.getMonoWeight())
329
+ import pyopenms as poms
368
330
369
- # Print the modified peptides generated using variable modifications and their mono-isotopic mass.
370
- for peptide in peptides_with_variable_modifications:
371
- print("Variable:", peptide.toString())
372
- print("Mono-isotopic mass:", peptide.getMonoWeight())
331
+ # Create an amino acid sequence using the fromString() method of the AASequence class.
332
+ # In this example, we will use the amino acid sequence "TESTMTECSTMTESTR"
333
+ sequence = poms.AASequence.fromString(" TESTMTECSTMTESTR" )
334
+
335
+ # We use the names "Oxidation (M)" and "Carbamidomethyl (C)" for the variable and fixed modifications, respectively.
336
+ variable_mod_names = [b " Oxidation (M)" ]
337
+ fixed_mod_names = [b " Carbamidomethyl (C)" ]
338
+
339
+ # We then use the getModifications() method of the ModifiedPeptideGenerator class to get the modifications for these names.
340
+ variable_modifications = poms.ModifiedPeptideGenerator.getModifications(variable_mod_names)
341
+ fixed_modifications = poms.ModifiedPeptideGenerator.getModifications(fixed_mod_names)
373
342
343
+ # Apply the fixed modifications to the amino acid sequence
344
+ poms.ModifiedPeptideGenerator.applyFixedModifications(fixed_modifications, sequence)
345
+
346
+ # Define the maximum number of variable modifications allowed
347
+ max_variable_mods = 1
348
+
349
+ # Generate the modified peptides
350
+ peptides_with_variable_modifications = []
351
+ keep_unmodified_in_result = False
352
+ poms.ModifiedPeptideGenerator.applyVariableModifications(variable_modifications, sequence, max_variable_mods,
353
+ peptides_with_variable_modifications,
354
+ keep_unmodified_in_result)
355
+
356
+ # Print the modified peptides generated using Fixed modifications and their mono-isotopic mass.
357
+ print (" Fixed:" , sequence.toString())
358
+ print (" Mono-isotopic mass:" , sequence.getMonoWeight())
359
+
360
+ # Print the modified peptides generated using variable modifications and their mono-isotopic mass.
361
+ for peptide in peptides_with_variable_modifications:
362
+ print (" Variable:" , peptide.toString())
363
+ print (" Mono-isotopic mass:" , peptide.getMonoWeight())
364
+
374
365
The above code outputs:
375
366
376
367
.. code-block :: output
@@ -390,7 +381,6 @@ Protein sequences, can be loaded from and stored in :term:`FASTA` protein databa
390
381
The example below shows how protein sequences can be stored in :term: `FASTA ` files and loaded back in pyOpenMS:
391
382
392
383
.. code-block :: python
393
- :linenos:
394
384
395
385
bsa = oms.FASTAEntry() # one entry in a FASTA file
396
386
bsa.sequence = " MKWVTFISLLLLFSSAYSRGVFRRDTHKSEIAHRFKDLGE"
@@ -409,7 +399,6 @@ The example below shows how protein sequences can be stored in :term:`FASTA` fil
409
399
Afterwards, the ``example.fasta `` file can be read again from the disk:
410
400
411
401
.. code-block :: python
412
- :linenos:
413
402
414
403
entries = []
415
404
f = oms.FASTAFile()
0 commit comments