@@ -29,32 +29,35 @@ public static void TestParsimony()
29
29
var totalVirtualPeptideList = new HashSet < PeptideWithSetModifications > ( ) ;
30
30
31
31
var p1 = new Protein ( sequence1 , "1" , temp1 , temp3 , temp3 , null , "Test1" , "TestFullName1" , 0 , false , false ) ;
32
- var p2 = new Protein ( sequence2 , "2" , temp1 , temp3 , temp3 , null , "Test2 " , "TestFullName2 " , 0 , false , false ) ;
32
+ var p2 = new Protein ( sequence2 , "2" , temp1 , temp3 , temp3 , null , "DECOY_Test2 " , "DECOY_TestFullName2 " , 0 , true , false ) ;
33
33
var p3 = new Protein ( sequence3 , "3" , temp1 , temp3 , temp3 , null , "Test3" , "TestFullName3" , 0 , false , false ) ;
34
34
35
35
IEnumerable < PeptideWithPossibleModifications > digestedList1 = p1 . Digest ( protease , 2 , InitiatorMethionineBehavior . Variable ) ;
36
36
IEnumerable < PeptideWithPossibleModifications > digestedList2 = p2 . Digest ( protease , 2 , InitiatorMethionineBehavior . Variable ) ;
37
37
IEnumerable < PeptideWithPossibleModifications > digestedList3 = p3 . Digest ( protease , 2 , InitiatorMethionineBehavior . Variable ) ;
38
+ IEnumerable < PeptideWithSetModifications > peptides1 = null ;
39
+ IEnumerable < PeptideWithSetModifications > peptides2 = null ;
40
+ IEnumerable < PeptideWithSetModifications > peptides3 = null ;
38
41
39
42
foreach ( var protein in digestedList1 )
40
43
{
41
- IEnumerable < PeptideWithSetModifications > peptides1 = protein . GetPeptideWithSetModifications ( temp2 , 4098 , 3 ) ;
44
+ peptides1 = protein . GetPeptideWithSetModifications ( temp2 , 4098 , 3 ) ;
42
45
43
46
foreach ( var peptide in peptides1 )
44
47
totalVirtualPeptideList . Add ( peptide ) ;
45
48
}
46
49
47
50
foreach ( var protein in digestedList2 )
48
51
{
49
- IEnumerable < PeptideWithSetModifications > peptides2 = protein . GetPeptideWithSetModifications ( temp2 , 4098 , 3 ) ;
52
+ peptides2 = protein . GetPeptideWithSetModifications ( temp2 , 4098 , 3 ) ;
50
53
51
54
foreach ( var peptide in peptides2 )
52
55
totalVirtualPeptideList . Add ( peptide ) ;
53
56
}
54
57
55
58
foreach ( var protein in digestedList3 )
56
59
{
57
- IEnumerable < PeptideWithSetModifications > peptides3 = protein . GetPeptideWithSetModifications ( temp2 , 4098 , 3 ) ;
60
+ peptides3 = protein . GetPeptideWithSetModifications ( temp2 , 4098 , 3 ) ;
58
61
59
62
foreach ( var peptide in peptides3 )
60
63
totalVirtualPeptideList . Add ( peptide ) ;
@@ -95,11 +98,18 @@ public static void TestParsimony()
95
98
dictionary . Add ( peptides [ i ] , virtualPeptideSets [ i ] ) ;
96
99
}
97
100
}
98
- List < ProteinGroup > pg = new List < ProteinGroup > ( ) ;
101
+ List < ProteinGroup > proteinGroups = new List < ProteinGroup > ( ) ;
99
102
AnalysisEngine ae = new AnalysisEngine ( null , dictionary , null , null , null , null , null , null , null , null , null , null , null , true , 0 , 0 , false , new List < ProductType > { ProductType . B , ProductType . Y } ) ;
100
103
104
+ Dictionary < CompactPeptide , HashSet < PeptideWithSetModifications > > initialDictionary = new Dictionary < CompactPeptide , HashSet < PeptideWithSetModifications > > ( ) ;
105
+ foreach ( var kvp in dictionary )
106
+ {
107
+ initialDictionary . Add ( kvp . Key , kvp . Value ) ;
108
+ }
109
+
110
+
101
111
// apply parsimony to initial dictionary
102
- ae . ApplyProteinParsimony ( out pg ) ;
112
+ ae . ApplyProteinParsimony ( out proteinGroups ) ;
103
113
104
114
var parsimonyProteinList = new List < Protein > ( ) ;
105
115
string [ ] parsimonyBaseSequences = new string [ 3 ] ;
@@ -121,50 +131,90 @@ public static void TestParsimony()
121
131
}
122
132
}
123
133
134
+
135
+
136
+ List < NewPsmWithFdr > psms = new List < NewPsmWithFdr > ( ) ;
137
+
138
+ foreach ( var kvp in dictionary )
139
+ {
140
+ foreach ( var peptide in kvp . Value )
141
+ {
142
+ HashSet < PeptideWithSetModifications > hashSet = new HashSet < PeptideWithSetModifications > ( ) ;
143
+ hashSet . Add ( peptide ) ;
144
+
145
+ switch ( peptide . BaseSequence )
146
+ {
147
+ case "AK" : psms . Add ( new NewPsmWithFdr ( new PSMwithProteinHashSet ( new ClassicSpectrumMatch ( peptide , null , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 ) , hashSet , null , null , null ) , 1 , 0 , 0.29 ) ) ; break ;
148
+ case "CK" : psms . Add ( new NewPsmWithFdr ( new PSMwithProteinHashSet ( new ClassicSpectrumMatch ( peptide , null , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 9 ) , hashSet , null , null , null ) , 1 , 0 , 0.0 ) ) ; break ;
149
+ case "BK" : psms . Add ( new NewPsmWithFdr ( new PSMwithProteinHashSet ( new ClassicSpectrumMatch ( peptide , null , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 8 ) , hashSet , null , null , null ) , 1 , 0 , 0.0 ) ) ; break ;
150
+ case "AKCK" : psms . Add ( new NewPsmWithFdr ( new PSMwithProteinHashSet ( new ClassicSpectrumMatch ( peptide , null , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 7 ) , hashSet , null , null , null ) , 1 , 0 , 0.0 ) ) ; break ;
151
+ case "CKBK" : psms . Add ( new NewPsmWithFdr ( new PSMwithProteinHashSet ( new ClassicSpectrumMatch ( peptide , null , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 6 ) , hashSet , null , null , null ) , 1 , 0 , 0.0 ) ) ; break ;
152
+ case "AKCKBK" : psms . Add ( new NewPsmWithFdr ( new PSMwithProteinHashSet ( new ClassicSpectrumMatch ( peptide , null , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 5 ) , hashSet , null , null , null ) , 1 , 0 , 0.0 ) ) ; break ;
153
+ case "DK" : psms . Add ( new NewPsmWithFdr ( new PSMwithProteinHashSet ( new ClassicSpectrumMatch ( peptide , null , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4 ) , hashSet , null , null , null ) , 1 , 0 , 0.2 ) ) ; break ;
154
+ case "DKCK" : psms . Add ( new NewPsmWithFdr ( new PSMwithProteinHashSet ( new ClassicSpectrumMatch ( peptide , null , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 ) , hashSet , null , null , null ) , 1 , 0 , 0.4 ) ) ; break ;
155
+ case "AAAAK" : psms . Add ( new NewPsmWithFdr ( new PSMwithProteinHashSet ( new ClassicSpectrumMatch ( peptide , null , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2 ) , hashSet , null , null , null ) , 1 , 0 , 0.33 ) ) ; break ;
156
+ }
157
+ }
158
+ }
159
+
160
+ ae . ScoreProteinGroups ( proteinGroups , psms ) ;
161
+ ae . DoProteinFdr ( proteinGroups ) ;
162
+
163
+
124
164
/*
125
165
// prints initial dictionary
126
166
List<Protein> proteinList = new List<Protein>();
127
167
128
- Console.WriteLine("----Initial Dictionary----");
129
- Console.WriteLine("PEPTIDE\t\t\tPROTEIN\t\t\tPeptideWithSetModifications");
168
+ System. Console.WriteLine("----Initial Dictionary----");
169
+ System. Console.WriteLine("PEPTIDE\t\t\tPROTEIN\t\t\tPeptideWithSetModifications");
130
170
foreach (var kvp in initialDictionary)
131
171
{
132
172
proteinList = new List<Protein>();
133
- Console.Write(string.Join("", kvp.Key.BaseSequence.Select(b => char.ConvertFromUtf32(b))) + " \t\t\t ");
173
+ System. Console.Write(string.Join("", kvp.Key.BaseSequence.Select(b => char.ConvertFromUtf32(b))) + " \t\t\t ");
134
174
foreach (var peptide in kvp.Value)
135
175
{
136
- if (!proteinList.Contains(peptide.protein ))
176
+ if (!proteinList.Contains(peptide.Protein ))
137
177
{
138
- Console.Write(peptide.protein .BaseSequence + " ;; ");
139
- proteinList.Add(peptide.protein );
178
+ System. Console.Write(peptide.Protein .BaseSequence + " ;; ");
179
+ proteinList.Add(peptide.Protein );
140
180
}
141
181
}
142
- Console.WriteLine();
182
+ System. Console.WriteLine();
143
183
}
144
184
145
185
// prints parsimonious dictionary
146
- Console.WriteLine("----Parsimonious Dictionary----");
147
- Console.WriteLine("PEPTIDE\t\t\tPROTEIN\t\t\tPeptideWithSetModifications");
148
- foreach (var kvp in parsimonyTest )
186
+ System. Console.WriteLine("----Parsimonious Dictionary----");
187
+ System. Console.WriteLine("PEPTIDE\t\t\tPROTEIN\t\t\tPeptideWithSetModifications");
188
+ foreach (var kvp in dictionary )
149
189
{
150
190
proteinList = new List<Protein>();
151
- Console.Write(string.Join("", kvp.Key.BaseSequence.Select(b => char.ConvertFromUtf32(b))) + " \t\t\t ");
191
+ System. Console.Write(string.Join("", kvp.Key.BaseSequence.Select(b => char.ConvertFromUtf32(b))) + " \t\t\t ");
152
192
foreach (var peptide in kvp.Value)
153
193
{
154
- if (!proteinList.Contains(peptide.protein ))
194
+ if (!proteinList.Contains(peptide.Protein ))
155
195
{
156
- Console.Write(peptide.protein .BaseSequence + " ;; ");
157
- proteinList.Add(peptide.protein );
196
+ System. Console.Write(peptide.Protein .BaseSequence + " ;; ");
197
+ proteinList.Add(peptide.Protein );
158
198
}
159
199
}
160
- Console.WriteLine();
200
+ System.Console.WriteLine();
201
+ }
202
+
203
+
204
+ // prints protein groups after scoring/fdr
205
+ System.Console.WriteLine(ProteinGroup.TabSeparatedHeader);
206
+ foreach (var proteinGroup in proteinGroups)
207
+ {
208
+ System.Console.WriteLine(proteinGroup);
161
209
}
162
210
*/
163
211
164
212
Assert . That ( parsimonyProteinList . Count == 3 ) ;
165
213
Assert . That ( parsimonyBaseSequences . Contains ( sequence1 ) ) ;
166
214
Assert . That ( parsimonyBaseSequences . Contains ( sequence2 ) ) ;
167
215
Assert . That ( parsimonyBaseSequences . Contains ( sequence3 ) ) ;
216
+ Assert . That ( proteinGroups . Count == 2 ) ;
217
+ Assert . That ( proteinGroups . First ( ) . proteinGroupScore > 10 ) ;
168
218
}
169
219
170
220
#endregion Public Methods
0 commit comments