File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,15 @@ def test_isotope_distribution_chlorine_m2_peak():
5959 assert any (np .isclose (delta , 1.997 , atol = 0.01 ) for delta in deltas )
6060
6161
62+ def test_adduct_terms_chloride_uses_chloride_anion_mass ():
63+ # [M+Cl]- uses Cl- (atomic mass + electron mass), not neutral Cl.
64+ from vimms .Common import ELECTRON_MASS , NATURAL_ISOTOPES
65+
66+ _ , cl_shift = ADDUCT_TERMS ["M+Cl" ]
67+ cl_atomic = NATURAL_ISOTOPES ["Cl" ][0 ][0 ]
68+ assert np .isclose (cl_shift - cl_atomic , ELECTRON_MASS , atol = 1e-12 )
69+
70+
6271def test_isotope_distribution_preserves_mono_when_filtered ():
6372 formula = Formula ("C500H1000" )
6473 isotopes = Isotopes (formula )
Original file line number Diff line number Diff line change 7272DEFAULT_SOURCE_CID_ENERGY = 0
7373
7474PROTON_MASS = 1.00727645199076
75+ ELECTRON_MASS = 0.000548579909065 # u
7576
7677CHROM_TYPE_EMPIRICAL = "empirical"
7778CHROM_TYPE_CONSTANT = "constant"
110111 "2M+H" : (2 , 1.007276 ),
111112 "2M+NH4" : (2 , 18 ),
112113 "M-H" : (1 , - PROTON_MASS ),
113- "M+Cl" : (1 , 34.96885268 ),
114+ # [M+Cl]- adds Cl- (atomic mass + electron mass), not neutral Cl.
115+ "M+Cl" : (1 , 34.96885268 + ELECTRON_MASS ),
114116 "M+FA-H" : (1 , 44.998201 ),
115117 "M+Ac-H" : (1 , 59.013851 ),
116118}
Original file line number Diff line number Diff line change 44
55import numpy as np
66
7- from vimms .Common import C13_MZ_DIFF , NATURAL_ISOTOPES
7+ from vimms .Common import C13_MZ_DIFF , NATURAL_ISOTOPES , ELECTRON_MASS
88
99
1010@dataclass (frozen = True )
@@ -328,7 +328,7 @@ def deadduct_with_pyopenms(
328328 # while MS m/z shifts correspond to charged species (atomic +/- e- mass).
329329 # Correcting by the electron mass ensures we recover a chemically-sensible
330330 # neutral mass from observed m/z values.
331- electron_mass = 0.000548579909065 # u
331+ electron_mass = ELECTRON_MASS
332332
333333 def infer_negative_mode () -> bool :
334334 charges = []
You can’t perform that action at this time.
0 commit comments