2
2
using TopDownProteomics . Chemistry ;
3
3
using TopDownProteomics . Proteomics ;
4
4
5
- namespace TopDownProteomics . ProForma . Validation
5
+ namespace TopDownProteomics . ProForma . Validation ;
6
+
7
+ /// <summary>
8
+ /// Lookup for Brno nomenclature for histone modifications.
9
+ /// https://doi.org/10.1038/nsmb0205-110
10
+ /// </summary>
11
+ /// <seealso cref="IProteoformModificationLookup" />
12
+ public class BrnoModificationLookup : IProteoformModificationLookup
6
13
{
14
+ BrnoModification [ ] _modifications ;
15
+
7
16
/// <summary>
8
- /// Lookup for Brno nomenclature for histone modifications.
9
- /// https://doi.org/10.1038/nsmb0205-110
17
+ /// Initializes a new instance of the <see cref="BrnoModificationLookup"/> class.
10
18
/// </summary>
11
- /// <seealso cref="IProteoformModificationLookup" / >
12
- public class BrnoModificationLookup : IProteoformModificationLookup
19
+ /// <param name="elementProvider">The element provider.</param >
20
+ public BrnoModificationLookup ( IElementProvider elementProvider )
13
21
{
14
- BrnoModification [ ] _modifications ;
22
+ _modifications = this . CreateModificationArray ( elementProvider ) ;
23
+ }
15
24
16
- /// <summary>
17
- /// Initializes a new instance of the <see cref="BrnoModificationLookup"/> class.
18
- /// </summary>
19
- /// <param name="elementProvider">The element provider.</param>
20
- public BrnoModificationLookup ( IElementProvider elementProvider )
21
- {
22
- _modifications = this . CreateModificationArray ( elementProvider ) ;
23
- }
25
+ /// <summary>
26
+ /// Determines whether this instance [can handle descriptor] the specified descriptor.
27
+ /// </summary>
28
+ /// <param name="descriptor">The descriptor.</param>
29
+ /// <returns>
30
+ /// <c>true</c> if this instance [can handle descriptor] the specified descriptor; otherwise, <c>false</c>.
31
+ /// </returns>
32
+ public bool CanHandleDescriptor ( IProFormaDescriptor descriptor )
33
+ {
34
+ return descriptor . Key == ProFormaKey . Name &&
35
+ descriptor . EvidenceType == ProFormaEvidenceType . Brno &&
36
+ descriptor . Value != null ;
37
+ }
24
38
25
- /// <summary>
26
- /// Determines whether this instance [can handle descriptor] the specified descriptor.
27
- /// </summary>
28
- /// <param name="descriptor">The descriptor.</param>
29
- /// <returns>
30
- /// <c>true</c> if this instance [can handle descriptor] the specified descriptor; otherwise, <c>false</c>.
31
- /// </returns>
32
- public bool CanHandleDescriptor ( IProFormaDescriptor descriptor )
39
+ /// <summary>
40
+ /// Gets the modification.
41
+ /// </summary>
42
+ /// <param name="descriptor">The descriptor.</param>
43
+ /// <returns></returns>
44
+ public IProteoformMassDelta GetModification ( IProFormaDescriptor descriptor )
45
+ {
46
+ string abbreviation = descriptor . Value ;
47
+
48
+ switch ( abbreviation )
33
49
{
34
- return descriptor . Key == ProFormaKey . Name &&
35
- descriptor . EvidenceType == ProFormaEvidenceType . Brno &&
36
- descriptor . Value != null ;
50
+ case "ac" : return _modifications [ 0 ] ;
51
+ case "me1" : return _modifications [ 1 ] ;
52
+ case "me2s" : return _modifications [ 2 ] ;
53
+ case "me2a" : return _modifications [ 3 ] ;
54
+ case "me2" : return _modifications [ 4 ] ;
55
+ case "me3" : return _modifications [ 5 ] ;
56
+ case "ph" : return _modifications [ 6 ] ;
57
+
58
+ default :
59
+ throw new ProteoformModificationLookupException ( $ "Couldn't handle value for descriptor { descriptor } .") ;
37
60
}
61
+ }
38
62
39
- /// <summary>
40
- /// Gets the modification.
41
- /// </summary>
42
- /// <param name="descriptor">The descriptor.</param>
43
- /// <returns></returns>
44
- public IProteoformMassDelta GetModification ( IProFormaDescriptor descriptor )
63
+ private BrnoModification [ ] CreateModificationArray ( IElementProvider elementProvider )
64
+ {
65
+ var mods = new BrnoModification [ 7 ] ;
66
+
67
+ var h = elementProvider . GetElement ( 1 ) ;
68
+ var c = elementProvider . GetElement ( 6 ) ;
69
+ var o = elementProvider . GetElement ( 8 ) ;
70
+ var p = elementProvider . GetElement ( 15 ) ;
71
+
72
+ mods [ 0 ] = new BrnoModification ( "B:ac" , new [ ]
45
73
{
46
- string abbreviation = descriptor . Value ;
47
-
48
- switch ( abbreviation )
49
- {
50
- case "ac" : return _modifications [ 0 ] ;
51
- case "me1" : return _modifications [ 1 ] ;
52
- case "me2s" : return _modifications [ 2 ] ;
53
- case "me2a" : return _modifications [ 3 ] ;
54
- case "me2" : return _modifications [ 4 ] ;
55
- case "me3" : return _modifications [ 5 ] ;
56
- case "ph" : return _modifications [ 6 ] ;
57
-
58
- default :
59
- throw new ProteoformModificationLookupException ( $ "Couldn't handle value for descriptor { descriptor } .") ;
60
- }
61
- }
74
+ new EntityCardinality < IElement > ( c , 2 ) ,
75
+ new EntityCardinality < IElement > ( h , 2 ) ,
76
+ new EntityCardinality < IElement > ( o , 1 )
77
+ } ) ;
78
+ mods [ 1 ] = new BrnoModification ( "B:me1" , new [ ]
79
+ {
80
+ new EntityCardinality < IElement > ( c , 1 ) ,
81
+ new EntityCardinality < IElement > ( h , 2 )
82
+ } ) ;
62
83
63
- private BrnoModification [ ] CreateModificationArray ( IElementProvider elementProvider )
84
+ var me2 = new [ ]
64
85
{
65
- var mods = new BrnoModification [ 7 ] ;
66
-
67
- var h = elementProvider . GetElement ( 1 ) ;
68
- var c = elementProvider . GetElement ( 6 ) ;
69
- var o = elementProvider . GetElement ( 8 ) ;
70
- var p = elementProvider . GetElement ( 15 ) ;
71
-
72
- mods [ 0 ] = new BrnoModification ( "B:ac" , new [ ]
73
- {
74
- new EntityCardinality < IElement > ( c , 2 ) ,
75
- new EntityCardinality < IElement > ( h , 2 ) ,
76
- new EntityCardinality < IElement > ( o , 1 )
77
- } ) ;
78
- mods [ 1 ] = new BrnoModification ( "B:me1" , new [ ]
79
- {
80
- new EntityCardinality < IElement > ( c , 1 ) ,
81
- new EntityCardinality < IElement > ( h , 2 )
82
- } ) ;
83
-
84
- var me2 = new [ ]
85
- {
86
- new EntityCardinality < IElement > ( c , 2 ) ,
87
- new EntityCardinality < IElement > ( h , 4 )
88
- } ;
89
- mods [ 2 ] = new BrnoModification ( "B:me2s" , me2 ) ;
90
- mods [ 3 ] = new BrnoModification ( "B:me2a" , me2 ) ;
91
- mods [ 4 ] = new BrnoModification ( "B:me2" , me2 ) ;
92
-
93
- mods [ 5 ] = new BrnoModification ( "B:me3" , new [ ]
94
- {
95
- new EntityCardinality < IElement > ( c , 3 ) ,
96
- new EntityCardinality < IElement > ( h , 6 )
97
- } ) ;
98
- mods [ 6 ] = new BrnoModification ( "B:ph" , new [ ]
99
- {
100
- new EntityCardinality < IElement > ( h , 1 ) ,
101
- new EntityCardinality < IElement > ( o , 3 ) ,
102
- new EntityCardinality < IElement > ( p , 1 ) ,
103
- } ) ;
104
-
105
- return mods ;
106
- }
86
+ new EntityCardinality < IElement > ( c , 2 ) ,
87
+ new EntityCardinality < IElement > ( h , 4 )
88
+ } ;
89
+ mods [ 2 ] = new BrnoModification ( "B:me2s" , me2 ) ;
90
+ mods [ 3 ] = new BrnoModification ( "B:me2a" , me2 ) ;
91
+ mods [ 4 ] = new BrnoModification ( "B:me2" , me2 ) ;
92
+
93
+ mods [ 5 ] = new BrnoModification ( "B:me3" , new [ ]
94
+ {
95
+ new EntityCardinality < IElement > ( c , 3 ) ,
96
+ new EntityCardinality < IElement > ( h , 6 )
97
+ } ) ;
98
+ mods [ 6 ] = new BrnoModification ( "B:ph" , new [ ]
99
+ {
100
+ new EntityCardinality < IElement > ( h , 1 ) ,
101
+ new EntityCardinality < IElement > ( o , 3 ) ,
102
+ new EntityCardinality < IElement > ( p , 1 ) ,
103
+ } ) ;
107
104
108
- private class BrnoModification : IProteoformOntologyDelta
105
+ return mods ;
106
+ }
107
+
108
+ private class BrnoModification : IProteoformOntologyDelta
109
+ {
110
+ public BrnoModification ( string abbreviation , IReadOnlyCollection < IEntityCardinality < IElement > > elements )
109
111
{
110
- public BrnoModification ( string abbreviation , IReadOnlyCollection < IEntityCardinality < IElement > > elements )
111
- {
112
- this . Abbreviation = abbreviation ;
113
- _elements = elements ;
114
- }
112
+ this . Abbreviation = abbreviation ;
113
+ _elements = elements ;
114
+ }
115
115
116
- private IReadOnlyCollection < IEntityCardinality < IElement > > _elements ;
117
- string Abbreviation { get ; }
116
+ private IReadOnlyCollection < IEntityCardinality < IElement > > _elements ;
117
+ string Abbreviation { get ; }
118
118
119
- public string Id => this . Abbreviation ;
119
+ public string Id => this . Abbreviation ;
120
120
121
- public string Name => this . Abbreviation ;
121
+ public string Name => this . Abbreviation ;
122
122
123
- public ChemicalFormula GetChemicalFormula ( ) => new ChemicalFormula ( _elements ) ;
123
+ public ProFormaEvidenceType EvidenceType => ProFormaEvidenceType . Brno ;
124
124
125
- public ProFormaDescriptor GetProFormaDescriptor ( )
126
- {
127
- return new ProFormaDescriptor ( ProFormaKey . Identifier , ProFormaEvidenceType . None , this . Abbreviation ) ;
128
- }
125
+ public ChemicalFormula GetChemicalFormula ( ) => new ChemicalFormula ( _elements ) ;
129
126
130
- public double GetMass ( MassType massType ) => this . GetChemicalFormula ( ) . GetMass ( massType ) ;
127
+ public ProFormaDescriptor GetProFormaDescriptor ( )
128
+ {
129
+ return new ProFormaDescriptor ( ProFormaKey . Identifier , ProFormaEvidenceType . None , this . Abbreviation ) ;
131
130
}
131
+
132
+ public double GetMass ( MassType massType ) => this . GetChemicalFormula ( ) . GetMass ( massType ) ;
132
133
}
133
134
}
0 commit comments