ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/trunk/testPdb.java
Revision: 208
Committed: Wed Jun 27 14:42:12 2007 UTC (17 years, 3 months ago) by duarte
File size: 2433 byte(s)
Log Message:
FIXED BUGS:
- directed was not set when reading from cm file
- pdbChainCode not set when reading from db given pdbCode
- filling pdbresser2resser and resser2pdbresser hashmaps also in reading from pdb file
- using "A" as chainCode when reading from pdb file
- some error handling for file formats: new exception classes GraphFileFormatError and PdbfileFormatError
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 208 public static void main(String[] args)
19     throws IOException, PdbaseInconsistencyError, PdbaseAcCodeNotFoundError, MsdsdAcCodeNotFoundError,
20     MsdsdInconsistentResidueNumbersError, SQLException, PdbfileFormatError{
21    
22 duarte 162 String accode="1bxy";
23     String chaincode="A";
24 duarte 132 // data from pdbase
25     System.out.println("loading structure from pdbase");
26 duarte 207 Pdb pdb = new PdbasePdb(accode,chaincode); // by default it goes to database "pdbase", a name for another pdbase database + a MySQLConnection can also be passed
27 duarte 127 System.out.println("dumping structure to pdb file");
28     pdb.dump2pdbfile("testpdb.txt");
29 duarte 206 String chain = pdb.getChainCode();
30 duarte 125 System.out.println("getting graph");
31 duarte 132 Graph graph = pdb.get_graph("ALL", 4.1);
32 duarte 125 System.out.println("dumping contacts to file");
33 duarte 208 graph.write_graph_to_file("test.txt");
34 duarte 162 System.out.println("getting start of contact map matrix from graph");
35     int[][] mat = graph.getIntMatrix();
36     for (int i=0;i<10;i++){
37     for (int j=0;j<10;j++){
38     System.out.print(mat[i][j]);
39 duarte 132 }
40 duarte 162 System.out.println();
41 duarte 132 }
42    
43     // data from msdsd
44     System.out.println("loading structure from msdsd");
45 duarte 207 Pdb pdb2 = new MsdsdPdb(accode,chaincode); // by default it goes to database "msdsd_00_07_a", a name for another msdsd database + a MySQLConnection can also be passed
46 duarte 132 System.out.println("dumping structure to pdb file");
47     pdb2.dump2pdbfile("testpdb2.txt");
48     System.out.println("getting graph");
49     Graph graph2 = pdb2.get_graph("ALL", 4.1);
50     System.out.println("dumping contacts to file");
51 duarte 208 graph2.write_graph_to_file("test2.txt");
52 duarte 132
53     // data from pdb
54 duarte 127 System.out.println("reading from dumped pdb file");
55 duarte 207 Pdb pdb3 = new PdbfilePdb("testpdb.txt",chain); // we read from the file dumped from pdbase, note that dumped file contains internal chain identifier
56 duarte 127 System.out.println("getting graph");
57 duarte 132 Graph graph3 = pdb3.get_graph("ALL", 4.1);
58 duarte 127 System.out.println("dumping contacts to file");
59 duarte 208 graph3.write_graph_to_file("test3.txt");
60 duarte 125 }
61    
62     }