From df06fc86eba99a5e8913de69e2500595fc71ee73 Mon Sep 17 00:00:00 2001 From: Ayesha-Feroz <94114994+Ayesha-Feroz@users.noreply.github.com> Date: Thu, 7 Mar 2024 13:52:43 +0100 Subject: [PATCH] Update peptides_proteins.rst (#433) * 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 17c8b194bd7f18dd4c4ecc25e32672f90467433d. * Revert "Update peptides_proteins.rst" This reverts commit 885ae45b57d7efe63c7e744156f8a5075403f054. * 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 --- docs/source/user_guide/peptides_proteins.rst | 55 ++++++++++---------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/docs/source/user_guide/peptides_proteins.rst b/docs/source/user_guide/peptides_proteins.rst index d1ee14908..c3c5dec36 100644 --- a/docs/source/user_guide/peptides_proteins.rst +++ b/docs/source/user_guide/peptides_proteins.rst @@ -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: