rustms/chemistry/
unimod.rs

1use std::collections::HashMap;
2
3/// Unimod Modifications
4///
5/// # Arguments
6///
7/// None
8///
9/// # Returns
10///
11/// * `HashMap<String, HashMap<&'static str, i32>>` - a map of unimod modification names to their atomic compositions
12///
13/// # Example
14///
15/// ```
16/// use rustms::chemistry::unimod::modification_atomic_composition;
17/// use std::collections::HashMap;
18///
19/// let composition = modification_atomic_composition();
20/// assert_eq!(composition.get("[UNIMOD:1]"), Some(&HashMap::from([("C", 2), ("H", 2), ("O", 1)])));
21/// ```
22pub fn modification_atomic_composition() -> HashMap<String, HashMap<&'static str, i32>> {
23    let mut composition: HashMap<String, HashMap<&'static str, i32>> = HashMap::new();
24    composition.insert("[UNIMOD:1]".to_string(), HashMap::from([("C", 2), ("H", 2), ("O", 1)])); // Acetyl
25    composition.insert("[UNIMOD:3]".to_string(), HashMap::from([("N", 2), ("C", 10), ("H", 14), ("O", 2), ("S", 1)])); //  	Biotinylation
26    composition.insert("[UNIMOD:4]".to_string(), HashMap::from([("C", 2), ("H", 3), ("O", 1), ("N", 1)]));
27    composition.insert("[UNIMOD:7]".to_string(), HashMap::from([("H", -1), ("N", -1), ("O", 1)])); // Hydroxylation
28    composition.insert("[UNIMOD:21]".to_string(), HashMap::from([("H", 1),("O", 3), ("P", 1)])); // Phosphorylation
29    composition.insert("[UNIMOD:34]".to_string(), HashMap::from([("H", 2), ("C", 1)])); //  Methylation
30    composition.insert("[UNIMOD:35]".to_string(), HashMap::from([("O", 1)])); // Hydroxylation
31    // composition.insert("[UNIMOD:43]".to_string(), HashMap::from([("C", 8), ("H", 15), ("N", 1), ("O", 6)])); // HexNAc ??
32    composition.insert("[UNIMOD:58]".to_string(), HashMap::from([("C", 3), ("H", 4), ("O", 1)])); // Propionyl
33    composition.insert("[UNIMOD:121]".to_string(), HashMap::from([("C", 4), ("H", 6), ("O", 2), ("N", 2)])); // ubiquitinylation residue
34    composition.insert("[UNIMOD:122]".to_string(), HashMap::from([("C", 1), ("O", 1)])); // Formylation
35    composition.insert("[UNIMOD:312]".to_string(), HashMap::from([("C", 3), ("H", 5), ("O", 2), ("N", 1), ("S", 1)])); // Cysteinyl
36    composition.insert("[UNIMOD:354]".to_string(), HashMap::from([("H", -1), ("O", 2), ("N", 1)])); // Oxidation to nitro
37    // composition.insert("[UNIMOD:408]".to_string(), HashMap::from([("C", -1), ("H", -2), ("N", 1), ("O", 2)])); // Glycosyl ??
38    composition.insert("[UNIMOD:747]".to_string(), HashMap::from([("C", 3), ("H", 2), ("O", 3)])); // Malonylation
39    composition.insert("[UNIMOD:1289]".to_string(), HashMap::from([("C", 4), ("H", 6), ("O", 1)])); // Butyryl
40    composition.insert("[UNIMOD:1363]".to_string(), HashMap::from([("C", 4), ("H", 4), ("O", 1)])); // Crotonylation
41
42    composition
43}
44
45/// Unimod Modifications Mass
46///
47/// # Arguments
48///
49/// None
50///
51/// # Returns
52///
53/// * `HashMap<&'static str, f64>` - a map of unimod modification names to their mass
54///
55/// # Example
56///
57/// ```
58/// use rustms::chemistry::unimod::unimod_modifications_mass;
59///
60/// let mass = unimod_modifications_mass();
61/// assert_eq!(mass.get("[UNIMOD:1]"), Some(&42.010565));
62/// ```
63pub fn unimod_modifications_mass() -> HashMap<&'static str, f64> {
64    let mut map = HashMap::new();
65    map.insert("[UNIMOD:58]", 56.026215);
66    map.insert("[UNIMOD:408]", 148.037173);
67    map.insert("[UNIMOD:43]", 203.079373);
68    map.insert("[UNIMOD:7]", 0.984016);
69    map.insert("[UNIMOD:1]", 42.010565);
70    map.insert("[UNIMOD:35]", 15.994915);
71    map.insert("[UNIMOD:1289]", 70.041865);
72    map.insert("[UNIMOD:3]", 226.077598);
73    map.insert("[UNIMOD:1363]", 68.026215);
74    map.insert("[UNIMOD:36]", 28.031300);
75    map.insert("[UNIMOD:122]", 27.994915);
76    map.insert("[UNIMOD:1848]", 114.031694);
77    map.insert("[UNIMOD:1849]", 86.036779);
78    map.insert("[UNIMOD:64]", 100.016044);
79    map.insert("[UNIMOD:37]", 42.046950);
80    map.insert("[UNIMOD:121]", 114.042927);
81    map.insert("[UNIMOD:747]", 86.000394);
82    map.insert("[UNIMOD:34]", 14.015650);
83    map.insert("[UNIMOD:354]", 44.985078);
84    map.insert("[UNIMOD:4]", 57.021464);
85    map.insert("[UNIMOD:21]", 79.966331);
86    map.insert("[UNIMOD:312]", 119.004099);
87    map
88}
89
90/// Unimod Modifications Mass Numerical
91///
92/// # Arguments
93///
94/// None
95///
96/// # Returns
97///
98/// * `HashMap<u32, f64>` - a map of unimod modification numerical ids to their mass
99///
100/// # Example
101///
102/// ```
103/// use rustms::chemistry::unimod::unimod_modifications_mass_numerical;
104///
105/// let mass = unimod_modifications_mass_numerical();
106/// assert_eq!(mass.get(&58), Some(&56.026215));
107/// ```
108pub fn unimod_modifications_mass_numerical() -> HashMap<u32, f64> {
109    let mut map = HashMap::new();
110    map.insert(58, 56.026215);
111    map.insert(408, 148.037173);
112    map.insert(43, 203.079373);
113    map.insert(7, 0.984016);
114    map.insert(1, 42.010565);
115    map.insert(35, 15.994915);
116    map.insert(1289, 70.041865);
117    map.insert(3, 226.077598);
118    map.insert(1363, 68.026215);
119    map.insert(36, 28.031300);
120    map.insert(122, 27.994915);
121    map.insert(1848, 114.031694);
122    map.insert(1849, 86.036779);
123    map.insert(64, 100.016044);
124    map.insert(37, 42.046950);
125    map.insert(121, 114.042927);
126    map.insert(747, 86.000394);
127    map.insert(34, 14.015650);
128    map.insert(354, 44.985078);
129    map.insert(4, 57.021464);
130    map.insert(21, 79.966331);
131    map.insert(312, 119.004099);
132    map
133}