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
/// A rule determining the placement of a modification
#[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
pub enum PlacementRule {
/// Placed on an aminoacid on the given position
AminoAcid(Vec<AminoAcid>, Position),
/// Placed on an another modification on the given position
PsiModification(usize, Position),
/// Placed on a terminal position
Terminal(Position),
/// Just anywhere
Anywhere,
}
/// A position where a modification can be placed
#[derive(
Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Default, Serialize, Deserialize,
)]
pub enum Position {
/// At any location
#[default]
Anywhere,
/// At the N term of a peptide or protein
AnyNTerm,
/// At the C term of a peptide or protein
AnyCTerm,
/// At the N term of a protein
ProteinNTerm,
/// At the C term of a protein
ProteinCTerm,
}
impl std::fmt::Display for Position {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(
f,
"{}",
match self {
Self::Anywhere => "Anywhere",
Self::AnyNTerm => "AnyNTerm",
Self::AnyCTerm => "AnyCTerm",
Self::ProteinNTerm => "ProteinNTerm",
Self::ProteinCTerm => "ProteinCTerm",
},
)
}
}