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: