{
  "id": 14509600,
  "title": "Building a Peptide Monoisotopic and Average Mass Calculator in Python",
  "url": "https://urgent.news/2026/10/14/building-a-peptide-monoisotopic-and-average-mass-calculator-in-python",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-14T18:31:44.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/peptideexpress/building-a-peptide-monoisotopic-and-average-mass-calculator-in-python-14m4"
  },
  "original_language": "en",
  "account": "In the world of synthetic peptides, determining the mass expected from a mass spectrometer is a common task. The calculation is straightforward: sum the residues, include one water molecule, and divide by the charge. However, it's easy to make mistakes along the way.\n\nThis article presents a simple calculator built from scratch in Python, explains the difference between monoisotopic and average masses, and verifies the results against an open-source package. All of the code was executed in a new virtual environment using Python 3.13.\n\nThere are two types of mass in this context. Monoisotopic mass uses only the most abundant isotope of each element, which is reflected in the first peak of a high-resolution isotope envelope. This number is what you compare against high-resolution mass spectrometry data. Average mass, on the other hand, uses the natural isotope mix, weighted by its abundance. It corresponds to the centroid of a low-resolution peak and is used for weighing samples on a balance.\n\nTo understand the discrepancy between these two mass types, it's important to note the source of the element masses. For monoisotopic masses, the NIST Atomic Weights and Isotopic Compositions database was consulted, providing values such as ¹H = 1.00782503223 u and ¹⁶O = 15.99491461957 u. For average masses, the IUPAC CIAAW Standard Atomic Weights were used, which include values like H = 1.0080 and C = 12.011.\n\nThe calculator stores each residue as an elemental formula, representing the amino acid without H₂O, the water lost during peptide bond formation. The full peptide mass is the sum of its residues plus one H₂O molecule for the free N- and C-termini. The code defines monoisotopic masses and average masses as dictionaries, with each element assigned its appropriate value. The proton mass is also defined, sourced from NIST CODATA 2022.\n\nFinally, a dictionary called RESIDUES maps amino acids to their elemental composition (C, H, N, O, S), excluding the H₂O molecule. This data is used to calculate the mass of any peptide sequence by summing the corresponding elemental masses.",
  "summary": "By Peptide.Express ( peptide.express ) If you work with synthetic peptides, sooner or later you need to know what mass to expect from a mass spectrometer. The math is simple: add up the residues, add one water, and divide by the charge. It is also easy to get slightly wrong. This post builds a small calculator from scratch, explains why monoisotopic and average masses differ, and checks the…",
  "key_points": [
    "Calculator built in Python to determine peptide mass",
    "Differentiates between monoisotopic and average masses",
    "Code verified against open-source package"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}