Skip to content

Commit 885ae45

Browse files
authored
Update peptides_proteins.rst
checked for spacing etc.
1 parent e75ffd0 commit 885ae45

File tree

1 file changed

+34
-45
lines changed

1 file changed

+34
-45
lines changed

docs/source/user_guide/peptides_proteins.rst

+34-45
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ some commonly used operations like chemical formula, weight, and isotope distrib
1313
The example below shows how amino acid sequences can be created and how basic mass calculations are conducted.
1414

1515
.. code-block:: python
16-
:linenos:
1716
1817
import pyopenms as oms
1918
@@ -96,7 +95,6 @@ The N- and C-Terminus as well as the residues themself can be modified.
9695
The example below shows how to check for such modifications.
9796

9897
.. code-block:: python
99-
:linenos:
10098
10199
seq = oms.AASequence.fromString("C[143]PKCK(Label:13C(6)15N(2))CR")
102100
@@ -136,7 +134,6 @@ about :py:class:`~.EmpiricalFormula` to get accurate mass and isotope distributi
136134
the amino acid sequence. But first, let's get the formula of peptide:
137135

138136
.. code-block:: python
139-
:linenos:
140137
141138
seq = oms.AASequence.fromString("DFPIANGER")
142139
seq_formula = seq.getFormula()
@@ -149,7 +146,6 @@ Isotope Patterns
149146
We now want to print the coarse (e.g., peaks only at nominal masses) distribution.
150147

151148
.. code-block:: python
152-
:linenos:
153149
154150
# print coarse isotope distribution
155151
coarse_isotopes = seq_formula.getIsotopeDistribution(
@@ -165,7 +161,6 @@ But if we deal with very high resolution instruments, we still might want to cal
165161
We use the :py:class:`~.FineIsotopePatternGenerator` in OpenMS to reveal these additional peaks:
166162

167163
.. code-block:: python
168-
:linenos:
169164
170165
# print fine structure of isotope distribution
171166
fine_isotopes = seq_formula.getIsotopeDistribution(
@@ -180,7 +175,6 @@ We use the :py:class:`~.FineIsotopePatternGenerator` in OpenMS to reveal these a
180175
And plot the very similar looking distributions using standard ``matplotlib`` functionality:
181176

182177
.. code-block:: python
183-
:linenos:
184178
185179
import math
186180
from matplotlib import pyplot as plt
@@ -223,7 +217,6 @@ Fragment Ions
223217
We can easily calculate different ion types for amino acid sequences:
224218

225219
.. code-block:: python
226-
:linenos:
227220
228221
suffix = seq.getSuffix(3) # y3 ion "GER"
229222
print("=" * 35)
@@ -264,7 +257,6 @@ peptide "DFPIAMGER" with an oxidized methionine. There are multiple ways to spec
264257

265258

266259
.. code-block:: python
267-
:linenos:
268260
269261
seq = oms.AASequence.fromString("PEPTIDESEKUEM(Oxidation)CER")
270262
print(seq.toUnmodifiedString())
@@ -310,7 +302,6 @@ respectively, but ``".DFPIAMGER(Phospho)."`` will be interpreted as a
310302
phosphorylation of the last arginine at its side chain:
311303

312304
.. code-block:: python
313-
:linenos:
314305
315306
s = oms.AASequence.fromString(".(Dimethyl)DFPIAMGER.")
316307
print(s, s.hasNTerminalModification())
@@ -334,43 +325,43 @@ Applying Fixed or Variable Modifications to Sequences
334325
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.
335326

336327
.. 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)"]
347328
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
368330
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)
373342
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+
374365
The above code outputs:
375366

376367
.. code-block:: output
@@ -390,7 +381,6 @@ Protein sequences, can be loaded from and stored in :term:`FASTA` protein databa
390381
The example below shows how protein sequences can be stored in :term:`FASTA` files and loaded back in pyOpenMS:
391382

392383
.. code-block:: python
393-
:linenos:
394384
395385
bsa = oms.FASTAEntry() # one entry in a FASTA file
396386
bsa.sequence = "MKWVTFISLLLLFSSAYSRGVFRRDTHKSEIAHRFKDLGE"
@@ -409,7 +399,6 @@ The example below shows how protein sequences can be stored in :term:`FASTA` fil
409399
Afterwards, the ``example.fasta`` file can be read again from the disk:
410400

411401
.. code-block:: python
412-
:linenos:
413402
414403
entries = []
415404
f = oms.FASTAFile()

0 commit comments

Comments
 (0)