Skip to content

Commit

Permalink
Update peptides_proteins.rst (#433)
Browse files Browse the repository at this point in the history
* Update peptides_proteins.rst

checked for spacing etc.

* Update docs/source/user_guide/peptides_proteins.rst

look more good

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Revert "Update docs/source/user_guide/peptides_proteins.rst
"

This reverts commit 17c8b19.

* Revert "Update peptides_proteins.rst"

This reverts commit 885ae45.

* Applying Fixed or Variable Modifications to Sequences fixed in doc

---------

Co-authored-by: Arslan Siraj <93129328+Arslan-Siraj@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Arslan <arslan1.qau11@gmail.com>
  • Loading branch information
4 people authored Mar 7, 2024
1 parent e75ffd0 commit df06fc8
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions docs/source/user_guide/peptides_proteins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -335,41 +335,42 @@ In this tutorial, we will cover a step-by-step guide on how to use the pyopenms

.. code-block:: python
:linenos:
import pyopenms as poms
import pyopenms as poms
# Create an amino acid sequence using the fromString() method of the AASequence class.
# In this example, we will use the amino acid sequence "TESTMTECSTMTESTR"
sequence = poms.AASequence.fromString("TESTMTECSTMTESTR")
# Create an amino acid sequence using the fromString() method of the AASequence class.
# In this example, we will use the amino acid sequence "TESTMTECSTMTESTR"
sequence = poms.AASequence.fromString("TESTMTECSTMTESTR")
# We use the names "Oxidation (M)" and "Carbamidomethyl (C)" for the variable and fixed modifications, respectively.
variable_mod_names = [b"Oxidation (M)"]
fixed_mod_names = [b"Carbamidomethyl (C)"]
# We use the names "Oxidation (M)" and "Carbamidomethyl (C)" for the variable and fixed modifications, respectively.
variable_mod_names = [b"Oxidation (M)"]
fixed_mod_names = [b"Carbamidomethyl (C)"]
# We then use the getModifications() method of the ModifiedPeptideGenerator class to get the modifications for these names.
variable_modifications = poms.ModifiedPeptideGenerator.getModifications(variable_mod_names)
fixed_modifications = poms.ModifiedPeptideGenerator.getModifications(fixed_mod_names)
# We then use the getModifications() method of the ModifiedPeptideGenerator class to get the modifications for these names.
variable_modifications = poms.ModifiedPeptideGenerator.getModifications(variable_mod_names)
fixed_modifications = poms.ModifiedPeptideGenerator.getModifications(fixed_mod_names)
# Apply the fixed modifications to the amino acid sequence
poms.ModifiedPeptideGenerator.applyFixedModifications(fixed_modifications, sequence)
# Apply the fixed modifications to the amino acid sequence
poms.ModifiedPeptideGenerator.applyFixedModifications(fixed_modifications, sequence)
# Define the maximum number of variable modifications allowed
max_variable_mods = 1
# Define the maximum number of variable modifications allowed
max_variable_mods = 1
# Generate the modified peptides
peptides_with_variable_modifications = []
keep_unmodified_in_result = False
poms.ModifiedPeptideGenerator.applyVariableModifications(variable_modifications, sequence, max_variable_mods,
peptides_with_variable_modifications,
keep_unmodified_in_result)
# Generate the modified peptides
peptides_with_variable_modifications = []
keep_unmodified_in_result = False
poms.ModifiedPeptideGenerator.applyVariableModifications(variable_modifications, sequence, max_variable_mods,
peptides_with_variable_modifications,
keep_unmodified_in_result)
# Print the modified peptides generated using Fixed modifications and their mono-isotopic mass.
print("Fixed:", sequence.toString())
print("Mono-isotopic mass:", sequence.getMonoWeight())
# Print the modified peptides generated using Fixed modifications and their mono-isotopic mass.
print("Fixed:", sequence.toString())
print("Mono-isotopic mass:", sequence.getMonoWeight())
# Print the modified peptides generated using variable modifications and their mono-isotopic mass.
for peptide in peptides_with_variable_modifications:
print("Variable:", peptide.toString())
print("Mono-isotopic mass:", peptide.getMonoWeight())
# Print the modified peptides generated using variable modifications and their mono-isotopic mass.
for peptide in peptides_with_variable_modifications:
print("Variable:", peptide.toString())
print("Mono-isotopic mass:", peptide.getMonoWeight())
The above code outputs:

Expand Down

0 comments on commit df06fc8

Please sign in to comment.