ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/trunk/testPdb.java
Revision: 202
Committed: Thu Jun 21 17:18:11 2007 UTC (17 years, 4 months ago) by duarte
File size: 2255 byte(s)
Log Message:
MySQLConnection now throwing SQLException on connect
Many files changed following this: all calling classes now re-throwing or catching the SQLException
Line User Rev File contents
1 duarte 125 import java.io.IOException;
2 duarte 202 import java.sql.SQLException;
3     //import java.util.ArrayList;
4 duarte 125
5 duarte 132 import proteinstructure.*;
6    
7 duarte 202 //import java.util.TreeMap;
8 duarte 132
9 duarte 125 public class testPdb {
10    
11     /**
12     * Test class for classes in aglappe.proteinstructure package (Pdb, Graph, AA, Contact)
13 duarte 132 * Loads structure data from pdbase, msdsd and pdb file and calculates graph dumping contacts to file
14     * Also gets contact map object and some common neighbours from it
15 duarte 202 * @throws SQLException
16 duarte 125 */
17    
18 duarte 202 public static void main(String[] args) throws IOException, PdbaseInconsistencyError, PdbaseAcCodeNotFoundError, MsdsdAcCodeNotFoundError, MsdsdInconsistentResidueNumbersError, SQLException{
19 duarte 162 String accode="1bxy";
20     String chaincode="A";
21 duarte 132 // data from pdbase
22     System.out.println("loading structure from pdbase");
23 duarte 162 Pdb pdb = new Pdb(accode,chaincode); // pdbase is default source for constructor, a name for a pdbase database can also be passed
24 duarte 127 System.out.println("dumping structure to pdb file");
25     pdb.dump2pdbfile("testpdb.txt");
26 duarte 162 String chain = pdb.chain;
27 duarte 125 System.out.println("getting graph");
28 duarte 132 Graph graph = pdb.get_graph("ALL", 4.1);
29 duarte 125 System.out.println("dumping contacts to file");
30     graph.write_contacts_to_file("test.txt");
31 duarte 162 System.out.println("getting start of contact map matrix from graph");
32     int[][] mat = graph.getIntMatrix();
33     for (int i=0;i<10;i++){
34     for (int j=0;j<10;j++){
35     System.out.print(mat[i][j]);
36 duarte 132 }
37 duarte 162 System.out.println();
38 duarte 132 }
39    
40     // data from msdsd
41     System.out.println("loading structure from msdsd");
42 duarte 162 Pdb pdb2 = new Pdb(accode,chaincode,"msdsd_00_07_a");
43 duarte 132 System.out.println("dumping structure to pdb file");
44     pdb2.dump2pdbfile("testpdb2.txt");
45     System.out.println("getting graph");
46     Graph graph2 = pdb2.get_graph("ALL", 4.1);
47     System.out.println("dumping contacts to file");
48     graph2.write_contacts_to_file("test2.txt");
49    
50     // data from pdb
51 duarte 127 System.out.println("reading from dumped pdb file");
52 duarte 162 Pdb pdb3 = new Pdb("testpdb.txt",chain,false); // we read from the file dumped from pdbase, not that dumped file contains internal chain identifier
53 duarte 127 System.out.println("getting graph");
54 duarte 132 Graph graph3 = pdb3.get_graph("ALL", 4.1);
55 duarte 127 System.out.println("dumping contacts to file");
56 duarte 132 graph3.write_contacts_to_file("test3.txt");
57 duarte 125 }
58    
59     }