text: user704: I'm using the Peptides package in R to calculate the mass of peptides with the mw() method. The thing is that I want to calculate them for different pH values, and thus I wrote this little function to take the pH value into account according this image:
  
  My code is this:
  phmw = function(pept_seq , unimod_location, pH ){
  
    monoisotopic_hydrogen_mass = 1.00794
  
    if(pH < 7){
  
      # mol_weight = mol_weight_of_peptide + mol_weight_of_Hydrogen
      mol_weight = mw(pept_seq, monoisotopic = T) + monoisotopic_hydrogen_mass
  
    }else if(pH > 7){
  
      # mol_weight = mol_weight_of_peptide - mol_weight_of_Hydrogen
      mol_weight = mw(pept_seq, monoisotopic = T) - monoisotopic_hydrogen_mass
  
    }else if(pH == 7){
  
      # mol_weight = mol_weight_of_peptide 
      mol_weight = mw(pept_seq, monoisotopic = T) 
    }
  
    return(mol_weight)
  
  }
  
  Do you think that this approach is correct or not?
  
  user2597: Amino-acid content (eg Lys, Asp) can have drastic effect on observance in a particular MS-mode.
  You should consider including Peptides::pI() or Peptides::charge() to determine the likelihood of (de-)protonation in your calculations.
  
  user388: Your approach in general seems to be OK, but I have a few suggestions:
  
  You are basing all your calculations on whether the pH is above or below 7. However the N and C termini have pKa values that determine whether these groups will be ionized (8 and 3, respectively). You should check whether the pH is above/below these values instead of 7.
  Different amino acid side chains can also be ionized and should be accounted for when calculating the MW. Amino acid pKas can be found here
  Code wise: you pass a variable unimod_location in your function but it's never used. If it's not being used then take it out.
  
  
original_text: 704: <p>I'm using the <em>Peptides</em> package in R to calculate the mass of peptides with the mw() method. The thing is that I want to calculate them for different pH values, and thus I wrote this little function to take the pH value into account according this image:</p>
  
  <p><a href="https://i.stack.imgur.com/iA96t.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iA96t.jpg" alt="Enter image description here"></a></p>
  
  <p>My code is this:</p>
  
  <pre><code>phmw = function(pept_seq , unimod_location, pH ){
  
    monoisotopic_hydrogen_mass = 1.00794
  
    if(pH &lt; 7){
  
      # mol_weight = mol_weight_of_peptide + mol_weight_of_Hydrogen
      mol_weight = mw(pept_seq, monoisotopic = T) + monoisotopic_hydrogen_mass
  
    }else if(pH &gt; 7){
  
      # mol_weight = mol_weight_of_peptide - mol_weight_of_Hydrogen
      mol_weight = mw(pept_seq, monoisotopic = T) - monoisotopic_hydrogen_mass
  
    }else if(pH == 7){
  
      # mol_weight = mol_weight_of_peptide 
      mol_weight = mw(pept_seq, monoisotopic = T) 
    }
  
    return(mol_weight)
  
  }
  </code></pre>
  
  <p>Do you think that this approach is correct or not?</p>
   2597: <p>Amino-acid content (eg Lys, Asp) can have drastic effect on observance in a particular MS-mode.</p>
  
  <p>You should consider including <code>Peptides::pI()</code> or <code>Peptides::charge()</code> to determine the likelihood of (de-)protonation in your calculations.</p>
   388: <p>Your approach in general seems to be OK, but I have a few suggestions:</p>
  
  <ol>
  <li>You are basing all your calculations on whether the pH is above or below 7. However the N and C termini have pKa values that determine whether these groups will be ionized (8 and 3, respectively). You should check whether the pH is above/below these values instead of 7.</li>
  <li>Different amino acid side chains can also be ionized and should be accounted for when calculating the MW. Amino acid pKas can be found <a href="http://www.chem.ucla.edu/~rebecca/153A/amino_acids.pdf" rel="noreferrer">here</a></li>
  <li>Code wise: you pass a variable unimod_location in your function but it's never used. If it's not being used then take it out.</li>
  </ol>
  