rustms/chemistry/
unimod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
use std::collections::HashMap;

/// Unimod Modifications
///
/// # Arguments
///
/// None
///
/// # Returns
///
/// * `HashMap<String, HashMap<&'static str, i32>>` - a map of unimod modification names to their atomic compositions
///
/// # Example
///
/// ```
/// use rustms::chemistry::unimod::modification_atomic_composition;
/// use std::collections::HashMap;
///
/// let composition = modification_atomic_composition();
/// assert_eq!(composition.get("[UNIMOD:1]"), Some(&HashMap::from([("C", 2), ("H", 2), ("O", 1)])));
/// ```
pub fn modification_atomic_composition() -> HashMap<String, HashMap<&'static str, i32>> {
    let mut composition: HashMap<String, HashMap<&'static str, i32>> = HashMap::new();
    composition.insert("[UNIMOD:1]".to_string(), HashMap::from([("C", 2), ("H", 2), ("O", 1)])); // Acetyl
    composition.insert("[UNIMOD:3]".to_string(), HashMap::from([("N", 2), ("C", 10), ("H", 14), ("O", 2), ("S", 1)])); //  	Biotinylation
    composition.insert("[UNIMOD:4]".to_string(), HashMap::from([("C", 2), ("H", 3), ("O", 1), ("N", 1)]));
    composition.insert("[UNIMOD:7]".to_string(), HashMap::from([("H", -1), ("N", -1), ("O", 1)])); // Hydroxylation
    composition.insert("[UNIMOD:21]".to_string(), HashMap::from([("H", 1),("O", 3), ("P", 1)])); // Phosphorylation
    composition.insert("[UNIMOD:34]".to_string(), HashMap::from([("H", 2), ("C", 1)])); //  Methylation
    composition.insert("[UNIMOD:35]".to_string(), HashMap::from([("O", 1)])); // Hydroxylation
    // composition.insert("[UNIMOD:43]".to_string(), HashMap::from([("C", 8), ("H", 15), ("N", 1), ("O", 6)])); // HexNAc ??
    composition.insert("[UNIMOD:58]".to_string(), HashMap::from([("C", 3), ("H", 4), ("O", 1)])); // Propionyl
    composition.insert("[UNIMOD:121]".to_string(), HashMap::from([("C", 4), ("H", 6), ("O", 2), ("N", 2)])); // ubiquitinylation residue
    composition.insert("[UNIMOD:122]".to_string(), HashMap::from([("C", 1), ("O", 1)])); // Formylation
    composition.insert("[UNIMOD:312]".to_string(), HashMap::from([("C", 3), ("H", 5), ("O", 2), ("N", 1), ("S", 1)])); // Cysteinyl
    composition.insert("[UNIMOD:354]".to_string(), HashMap::from([("H", -1), ("O", 2), ("N", 1)])); // Oxidation to nitro
    // composition.insert("[UNIMOD:408]".to_string(), HashMap::from([("C", -1), ("H", -2), ("N", 1), ("O", 2)])); // Glycosyl ??
    composition.insert("[UNIMOD:747]".to_string(), HashMap::from([("C", 3), ("H", 2), ("O", 3)])); // Malonylation
    composition.insert("[UNIMOD:1289]".to_string(), HashMap::from([("C", 4), ("H", 6), ("O", 1)])); // Butyryl
    composition.insert("[UNIMOD:1363]".to_string(), HashMap::from([("C", 4), ("H", 4), ("O", 1)])); // Crotonylation

    composition
}

/// Unimod Modifications Mass
///
/// # Arguments
///
/// None
///
/// # Returns
///
/// * `HashMap<&'static str, f64>` - a map of unimod modification names to their mass
///
/// # Example
///
/// ```
/// use rustms::chemistry::unimod::unimod_modifications_mass;
///
/// let mass = unimod_modifications_mass();
/// assert_eq!(mass.get("[UNIMOD:1]"), Some(&42.010565));
/// ```
pub fn unimod_modifications_mass() -> HashMap<&'static str, f64> {
    let mut map = HashMap::new();
    map.insert("[UNIMOD:58]", 56.026215);
    map.insert("[UNIMOD:408]", 148.037173);
    map.insert("[UNIMOD:43]", 203.079373);
    map.insert("[UNIMOD:7]", 0.984016);
    map.insert("[UNIMOD:1]", 42.010565);
    map.insert("[UNIMOD:35]", 15.994915);
    map.insert("[UNIMOD:1289]", 70.041865);
    map.insert("[UNIMOD:3]", 226.077598);
    map.insert("[UNIMOD:1363]", 68.026215);
    map.insert("[UNIMOD:36]", 28.031300);
    map.insert("[UNIMOD:122]", 27.994915);
    map.insert("[UNIMOD:1848]", 114.031694);
    map.insert("[UNIMOD:1849]", 86.036779);
    map.insert("[UNIMOD:64]", 100.016044);
    map.insert("[UNIMOD:37]", 42.046950);
    map.insert("[UNIMOD:121]", 114.042927);
    map.insert("[UNIMOD:747]", 86.000394);
    map.insert("[UNIMOD:34]", 14.015650);
    map.insert("[UNIMOD:354]", 44.985078);
    map.insert("[UNIMOD:4]", 57.021464);
    map.insert("[UNIMOD:21]", 79.966331);
    map.insert("[UNIMOD:312]", 119.004099);
    map
}

/// Unimod Modifications Mass Numerical
///
/// # Arguments
///
/// None
///
/// # Returns
///
/// * `HashMap<u32, f64>` - a map of unimod modification numerical ids to their mass
///
/// # Example
///
/// ```
/// use rustms::chemistry::unimod::unimod_modifications_mass_numerical;
///
/// let mass = unimod_modifications_mass_numerical();
/// assert_eq!(mass.get(&58), Some(&56.026215));
/// ```
pub fn unimod_modifications_mass_numerical() -> HashMap<u32, f64> {
    let mut map = HashMap::new();
    map.insert(58, 56.026215);
    map.insert(408, 148.037173);
    map.insert(43, 203.079373);
    map.insert(7, 0.984016);
    map.insert(1, 42.010565);
    map.insert(35, 15.994915);
    map.insert(1289, 70.041865);
    map.insert(3, 226.077598);
    map.insert(1363, 68.026215);
    map.insert(36, 28.031300);
    map.insert(122, 27.994915);
    map.insert(1848, 114.031694);
    map.insert(1849, 86.036779);
    map.insert(64, 100.016044);
    map.insert(37, 42.046950);
    map.insert(121, 114.042927);
    map.insert(747, 86.000394);
    map.insert(34, 14.015650);
    map.insert(354, 44.985078);
    map.insert(4, 57.021464);
    map.insert(21, 79.966331);
    map.insert(312, 119.004099);
    map
}