Urgent.News

What's breaking now, across thousands of outlets.

Tech

Building a Peptide Monoisotopic and Average Mass Calculator in Python

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…

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.

This 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.

There 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.

To 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.

The 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.

Finally, 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.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

CVE-2026-104935: Ivanti Connect Secure Authentication Bypass Vulnerability — Analysis & Mitigation

Summary On October 13, 2026, Ivanti disclosed CVE-2026-104935 , a high-severity authentication bypass vulnerability in Ivanti Connect Secure (ICS) — the company's enterprise SSL-VPN edge gateway…

  • Ivanti disclosed authentication bypass vulnerability CVE-2026-104935 on October 13, 2026
  • Remote attacker can bypass authentication and execute commands without credentials
  • Versions before 25.1.3.0 affected, including 25.1.x and 22.8R2.4 and earlier

Part 6: Quotient Filters - the Theory

In the previous articles of this series, we saw Bloom Filters, with restrictions on removing added values. Here we'll see Quotient Filters, which free the caller from those limits.

  • Quotient Filters (QFs) address Bloom Filters' removal limitations
  • QFs compute a single hash per item, split into quotient and remainder
  • Quotient determines slot, remainder stored as fingerprint within slot

More from Wednesday 14 October →