@@ -17,7 +17,7 @@ public class PeptidePropertiesImplTester {
1717 */
1818 private final String sequence = "MTADGPCRELLCQLRAAVRHRWWC1" ;
1919 private final String fullInvalidSequence = "3176412372301230183--2310" ;
20-
20+
2121 @ Test
2222 public void testAAComposition () {
2323 //'W', 'C', 'M', 'H', 'Y', 'F', 'Q', 'N', 'I', 'R', 'D', 'P', 'T', 'K', 'E', 'V', 'S', 'G', 'A', 'L'
@@ -43,7 +43,7 @@ public void testAAComposition() {
4343 assertEquals (1.0 /sequenceLength , composition .get ("G" ));
4444 assertEquals (3.0 /sequenceLength , composition .get ("A" ));
4545 assertEquals (3.0 /sequenceLength , composition .get ("L" ));
46-
46+
4747 Map <String , Double > iComposition = PeptideProperties .getAACompositionString (fullInvalidSequence );
4848 assertEquals (0.0 , iComposition .get ("W" ));
4949 assertEquals (0.0 , iComposition .get ("C" ));
@@ -72,7 +72,7 @@ public void testAAComposition() {
7272 assertNull (composition .get ("" ));
7373 assertNull (composition .get ("1" ));
7474 }
75-
75+
7676 @ Test ()
7777 public void testEnrichment () {
7878 //'W', 'C', 'M', 'H', 'Y', 'F', 'Q', 'N', 'I', 'R', 'D', 'P', 'T', 'K', 'E', 'V', 'S', 'G', 'A', 'L'
@@ -97,7 +97,7 @@ public void testEnrichment() {
9797 assertEquals (1.0 /sequenceLength , PeptideProperties .getEnrichment (sequence , "G" ));
9898 assertEquals (3.0 /sequenceLength , PeptideProperties .getEnrichment (sequence , "A" ));
9999 assertEquals (3.0 /sequenceLength , PeptideProperties .getEnrichment (sequence , "L" ));
100-
100+
101101 assertEquals (0.0 , PeptideProperties .getEnrichment (fullInvalidSequence , "W" ));
102102 assertEquals (0.0 , PeptideProperties .getEnrichment (fullInvalidSequence , "C" ));
103103 assertEquals (0.0 , PeptideProperties .getEnrichment (fullInvalidSequence , "M" ));
@@ -120,13 +120,13 @@ public void testEnrichment() {
120120 assertEquals (0.0 , PeptideProperties .getEnrichment (fullInvalidSequence , "L" ));
121121 assertEquals (0.0 , PeptideProperties .getEnrichment (sequence , "X" ));
122122 }
123-
123+
124124 @ Test (expected = NullPointerException .class )
125125 public void testEnrichmentNull (){
126126 assertNull (PeptideProperties .getEnrichment (sequence , "1" ));
127127 assertEquals (0.0 , PeptideProperties .getEnrichment (sequence , "" ));
128128 }
129-
129+
130130 @ Test
131131 public void testMolecularWeight (){
132132 //http://www.innovagen.se/custom-peptide-synthesis/peptide-property-calculator/peptide-property-calculator.asp
@@ -135,113 +135,113 @@ public void testMolecularWeight(){
135135 assertEquals (2872.4 , Utils .roundToDecimals (PeptideProperties .getMolecularWeight (sequence ), 1 ));
136136 assertEquals (0.0 , PeptideProperties .getMolecularWeight ("Z" ));
137137 assertEquals (0.0 , PeptideProperties .getMolecularWeight ("1" ));
138-
138+
139139 assertEquals (0.0 , PeptideProperties .getMolecularWeight (fullInvalidSequence ));
140140 }
141-
141+
142142 @ Test
143143 public void testMolecularWeightXML () throws FileNotFoundException , JAXBException {
144144 File elementMassFile = new File ("./src/main/resources/ElementMass.xml" );
145145 File aminoAcidCompositionFile = new File ("./src/main/resources/AminoAcidComposition.xml" );
146-
146+
147147 assertEquals (
148- Utils .roundToDecimals (PeptideProperties .getMolecularWeight ("A" , elementMassFile , aminoAcidCompositionFile )
149- * 5.0 - 4 * (17.0073 + 1.0079 ), 5 ),
150- Utils .roundToDecimals (PeptideProperties .getMolecularWeight ("AAAAA" , elementMassFile , aminoAcidCompositionFile ), 5 ));
148+ Utils .roundToDecimals (PeptideProperties .getMolecularWeight ("A" , elementMassFile , aminoAcidCompositionFile )
149+ * 5.0 - 4 * (17.0073 + 1.0079 ), 5 ),
150+ Utils .roundToDecimals (PeptideProperties .getMolecularWeight ("AAAAA" , elementMassFile , aminoAcidCompositionFile ), 5 ));
151151 }
152-
152+
153153 @ Test
154154 public void testMolecularWeightXMLSingleFile () throws FileNotFoundException , JAXBException {
155155 File aminoAcidCompositionFile = new File ("./src/main/resources/AminoAcidComposition.xml" );
156-
156+
157157 assertEquals (
158- Utils .roundToDecimals (PeptideProperties .getMolecularWeight ("A" , aminoAcidCompositionFile ) * 5.0 - 4 * (17.0073 + 1.0079 ), 5 ),
159- Utils .roundToDecimals (PeptideProperties .getMolecularWeight ("AAAAA" , aminoAcidCompositionFile ), 5 ));
158+ Utils .roundToDecimals (PeptideProperties .getMolecularWeight ("A" , aminoAcidCompositionFile ) * 5.0 - 4 * (17.0073 + 1.0079 ), 5 ),
159+ Utils .roundToDecimals (PeptideProperties .getMolecularWeight ("AAAAA" , aminoAcidCompositionFile ), 5 ));
160160 }
161-
161+
162162 @ Test
163163 public void testMolecularWeightBasedOnAminoAcidCompositionTable () throws Exception {
164164 File elementMassFile = new File ("./src/main/resources/ElementMass.xml" );
165165 File aminoAcidCompositionFile = new File ("./src/main/resources/AminoAcidComposition.xml" );
166166 AminoAcidCompositionTable table = PeptideProperties .obtainAminoAcidCompositionTable (elementMassFile , aminoAcidCompositionFile );
167-
167+
168168 assertEquals (
169- Utils .roundToDecimals (PeptideProperties .getMolecularWeightBasedOnXML ("A" , table ) * 5.0 - 4 * (17.0073 + 1.0079 ), 5 ),
170- Utils .roundToDecimals (PeptideProperties .getMolecularWeightBasedOnXML ("AAAAA" , table ), 5 ));
169+ Utils .roundToDecimals (PeptideProperties .getMolecularWeightBasedOnXML ("A" , table ) * 5.0 - 4 * (17.0073 + 1.0079 ), 5 ),
170+ Utils .roundToDecimals (PeptideProperties .getMolecularWeightBasedOnXML ("AAAAA" , table ), 5 ));
171171 }
172-
172+
173173 @ Test (expected = NullPointerException .class )
174174 public void testMolecularWeightXMLNull () throws FileNotFoundException , JAXBException {
175175 PeptideProperties .getMolecularWeight (sequence , null , null );
176176 }
177-
177+
178178 @ Test
179179 public void testExtinctionCoefficient (){
180180 //http://au.expasy.org/cgi-bin/protparam
181181 assertEquals (11125.0 , PeptideProperties .getExtinctionCoefficient (sequence , false ));
182182 assertEquals (11000.0 , PeptideProperties .getExtinctionCoefficient (sequence , true ));
183-
183+
184184 assertEquals (0.0 , PeptideProperties .getExtinctionCoefficient (fullInvalidSequence , true ));
185185 assertEquals (0.0 , PeptideProperties .getExtinctionCoefficient (fullInvalidSequence , false ));
186186 }
187-
187+
188188 @ Test (expected = NullPointerException .class )
189189 public void testExtinctionCoefficientNull (){
190190 assertEquals (11000.0 , PeptideProperties .getExtinctionCoefficient (null , true ));
191191 }
192-
192+
193193 @ Test
194194 public void testAbsorbance (){
195195 //http://au.expasy.org/cgi-bin/protparam
196196 assertEquals (3.830 , Utils .roundToDecimals (PeptideProperties .getAbsorbance (sequence , true ), 3 ));
197197 assertEquals (3.873 , Utils .roundToDecimals (PeptideProperties .getAbsorbance (sequence , false ), 3 ));
198-
198+
199199 assertEquals (0.0 , Utils .roundToDecimals (PeptideProperties .getAbsorbance (fullInvalidSequence , true ), 3 ));
200200 assertEquals (0.0 , Utils .roundToDecimals (PeptideProperties .getAbsorbance (fullInvalidSequence , false ), 3 ));
201201 }
202-
202+
203203 @ Test (expected = NullPointerException .class )
204204 public void testAbsorbanceNull (){
205205 assertEquals (3.830 , PeptideProperties .getAbsorbance (null , false ));
206206 }
207-
208-
207+
208+
209209 @ Test
210210 public void testInstabilityIndex (){
211211 //http://au.expasy.org/cgi-bin/protparam
212212 assertEquals (38.48 , Utils .roundToDecimals (PeptideProperties .getInstabilityIndex (sequence ), 2 ));
213213 assertEquals (0.0 , Utils .roundToDecimals (PeptideProperties .getInstabilityIndex (fullInvalidSequence ), 2 ));
214214 }
215-
215+
216216 @ Test (expected = NullPointerException .class )
217217 public void testInstabilityIndexNull (){
218218 assertEquals (38.48 , PeptideProperties .getInstabilityIndex (null ));
219219 }
220-
220+
221221 @ Test
222222 public void testApliphaticIndex (){
223223 //http://au.expasy.org/cgi-bin/protparam
224224 assertEquals (73.33 , Utils .roundToDecimals (PeptideProperties .getApliphaticIndex (sequence ), 2 ));
225225 assertEquals (0.0 , Utils .roundToDecimals (PeptideProperties .getApliphaticIndex (fullInvalidSequence ), 2 ));
226226 }
227-
227+
228228 @ Test (expected = NullPointerException .class )
229229 public void testApliphaticIndexNull (){
230230 assertEquals (73.33 , Utils .roundToDecimals (PeptideProperties .getApliphaticIndex (null ), 2 ));
231231 }
232-
232+
233233 @ Test
234234 public void testAverageHydropathy (){
235235 //http://au.expasy.org/cgi-bin/protparam
236236 assertEquals (-0.242 , Utils .roundToDecimals (PeptideProperties .getAvgHydropathy (sequence ), 3 ));
237237 assertEquals (0.0 , Utils .roundToDecimals (PeptideProperties .getAvgHydropathy (fullInvalidSequence ), 3 ));
238238 }
239-
239+
240240 @ Test (expected = NullPointerException .class )
241241 public void testAverageHydropathyNull (){
242242 assertEquals (-0.242 , Utils .roundToDecimals (PeptideProperties .getAvgHydropathy (null ), 3 ));
243243 }
244-
244+
245245 @ Test
246246 public void testIsoelectricPointInnovagen (){
247247 /*
@@ -250,41 +250,41 @@ public void testIsoelectricPointInnovagen(){
250250 //http://www.innovagen.se/custom-peptide-synthesis/peptide-property-calculator/peptide-property-calculator.asp
251251 assertEquals (9.01 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint (sequence , false ), 2 ));
252252 assertEquals (7.00 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint (fullInvalidSequence , false ), 2 ));
253-
253+
254254 assertEquals (2.70 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint ("ACCACAAADADADACA" , false ), 2 ));
255255 }
256-
256+
257257 @ Test
258258 public void testIsoelectricPointExpasy (){
259259 /*
260260 * Test for Expasy
261261 */
262262 assertEquals (3.42 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint ("ACCACAAADADADACA" ), 2 ));
263263 assertEquals (3.42 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint ("ACCACAAADADADACM" ), 2 ));
264- //
264+ //
265265 assertEquals (3.37 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint ("ECCACAAADADADACS" , true ), 2 ));
266-
267-
266+
267+
268268 assertEquals (3.24 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint ("ADCCACAAADADADACDAAAAAAAAAAAA" , true ), 2 ));
269-
269+
270270 //3.32 at Expasy
271271 assertEquals (3.32 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint ("DCCACAAADADADACS" , true ), 2 ));
272-
272+
273273 assertEquals (3.17 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint ("DCCACAAADADADACDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD" , true ), 2 ));
274274 assertEquals (3.37 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint ("ACCACAAADADADACE" , true ), 2 ));
275275 assertEquals (3.32 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint ("ACCACAAADADADACAAAAAAAAAAAAAAD" , true ), 2 ));
276276 assertEquals (3.28 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint ("DCCACAAADADADACE" , true ), 2 ));
277-
277+
278278 assertEquals (8.71 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint ("MTADGPCRELLCQLRAAVRHRWWC" , true ), 2 ));
279279 assertEquals (8.71 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint (sequence , true ), 2 ));
280280 assertEquals (0.0 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint (fullInvalidSequence , true ), 1 ));
281281 }
282-
282+
283283 @ Test (expected = NullPointerException .class )
284284 public void testIsoelectricPointNull (){
285285 assertEquals (8.6 , Utils .roundToDecimals (PeptideProperties .getIsoelectricPoint (null ), 1 ));
286286 }
287-
287+
288288 @ Test
289289 public void testNetCharge (){
290290 /*
@@ -293,15 +293,35 @@ public void testNetCharge(){
293293 //http://www.innovagen.se/custom-peptide-synthesis/peptide-property-calculator/peptide-property-calculator.asp
294294 assertEquals (2.9 , Utils .roundToDecimals (PeptideProperties .getNetCharge (sequence , false ), 1 ));
295295 assertEquals (0.0 , Utils .roundToDecimals (PeptideProperties .getNetCharge (fullInvalidSequence , false ), 1 ));
296-
296+
297297 assertEquals (-3.2 , Utils .roundToDecimals (PeptideProperties .getNetCharge ("ACCACAAADADADACA" , false ), 1 ));
298298 /*
299299 * Did not test for Expasy because in their website, net charge is not given.
300300 * However, since Isoelectric point is given which rely on getNetCharge values therefore,
301301 * we infer that if getIsoelectricPoint is correct, getNetCharge would be correct for Expasy.
302302 */
303+
304+
305+ /*
306+ * Provided by Steve Darnell to compare the difference between Innovagen and Expasy
307+ */
308+ String [] alpha = {"A" ,/*"B",*/ "C" ,"D" ,"E" ,"F" ,"G" ,"H" ,"I" ,/*"J",*/
309+ "K" ,"L" ,"M" ,"N" ,/*"O",*/ "P" ,"Q" ,"R" ,"S" ,"T" ,
310+ /*"U",*/ "V" ,"W" ,/*"X",*/ "Y" /*,"Z"*/ };
311+ for (String aa : alpha ) {
312+ String p = String .format ("AA%sAA" , aa );
313+ System .out .println (p );
314+ System .out .println ("pH\t Innovagen\t Expasy\t diff" );
315+ for ( int i = 1 ; i < 15 ; i ++) {
316+ double phPoint = (new Double (i )).doubleValue ();
317+ double chrgInnovagen = PeptideProperties .getNetCharge (p ,false ,phPoint );
318+ double chrgExpasy = PeptideProperties .getNetCharge (p ,true ,phPoint );
319+ System .out .println (String .format ("%2.1f\t %2.2f\t %2.2f\t %2.2f" , phPoint , chrgInnovagen ,
320+ chrgExpasy , chrgInnovagen - chrgExpasy ));
321+ }
322+ }
303323 }
304-
324+
305325 @ Test (expected = NullPointerException .class )
306326 public void testNetChargeNull (){
307327 assertEquals (8.6 , PeptideProperties .getNetCharge (null ));
0 commit comments