File: IsoelectricPointCalcTest.java

package info (click to toggle)
biojava-live 1%3A1.7.1-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 55,160 kB
  • sloc: java: 180,820; xml: 6,908; sql: 510; makefile: 50
file content (69 lines) | stat: -rw-r--r-- 2,517 bytes parent folder | download | duplicates (7)
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
/*
 * IsoelectricPointCalcTest.java
 *
 * Created on April 2, 2007, 4:01 PM
 *
 */

package org.biojava.bio.proteomics;

import junit.framework.TestCase;
import org.biojava.bio.BioException;
import org.biojava.bio.seq.ProteinTools;
import org.biojava.bio.symbol.IllegalSymbolException;
import org.biojava.bio.symbol.SymbolList;
import org.biojava.bio.symbol.SymbolPropertyTable;

/**
 *
 * @author George Waldon - testGetIsoelectricPointTest
 */
public class IsoelectricPointCalcTest extends TestCase {
    
    /** Test pK tables are loaded in proper order.
     */
    public void testPKTables() {
        SymbolPropertyTable PK_NtermTable = ProteinTools.getSymbolPropertyTable(SymbolPropertyTable.PK_Nterm);
        SymbolPropertyTable pKTable = ProteinTools.getSymbolPropertyTable(SymbolPropertyTable.PK);
        SymbolPropertyTable PK_CtermTable = ProteinTools.getSymbolPropertyTable(SymbolPropertyTable.PK_Cterm);
        try {
            double pK = PK_NtermTable.getDoubleValue(ProteinTools.d());
            assertTrue(pK == 7.50);
            pK = pKTable.getDoubleValue(ProteinTools.d());
            assertTrue(pK == -4.05);
            pK = PK_CtermTable.getDoubleValue(ProteinTools.d());
            assertTrue(pK == -4.55);
        } catch (IllegalSymbolException ex) {
            fail(ex.getMessage());
        }
    }
    
    public void testGetIsoelectricPointTest() {

        try {
            SymbolList pro = ProteinTools.createProtein("hhhhhher");
            double p1 = IsoelectricPointCalc.getIsoelectricPoint(pro); 
            pro = ProteinTools.createProtein("h-hhhhher");
            double p2 = IsoelectricPointCalc.getIsoelectricPoint(pro);
            pro = ProteinTools.createProtein("hxhhhhher");
            double p3 = IsoelectricPointCalc.getIsoelectricPoint(pro);
            assertTrue(p1==p2);
            assertTrue(p1==p3);

            pro = ProteinTools.createProtein("cdehkry");
            double p4 = IsoelectricPointCalc.getIsoelectricPoint(pro);
            assertTrue(p4==6.74);
            pro = ProteinTools.createProtein("da");
            p4 = IsoelectricPointCalc.getIsoelectricPoint(pro);
            assertTrue(p4==3.80);
            pro = ProteinTools.createProtein("ad");
            p4 = IsoelectricPointCalc.getIsoelectricPoint(pro);
            assertTrue(p4==4.30);
            
        } catch (IllegalSymbolException ex) {
            fail(ex.getMessage());
        } catch (BioException ex) {
            fail(ex.getMessage());
        }
    }
}