ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/trunk/testPdb.java
Revision: 207
Committed: Wed Jun 27 11:06:34 2007 UTC (17 years, 3 months ago) by duarte
File size: 2411 byte(s)
Log Message:
Restructured construction of Pdb and Graph objects: now subclasses for each case
Cleaned up and made consistent database connections
Now can also pass a MySQLConnection in all cases (as well as having default values for a default connection)
PdbaseInfo and MsdsdInfo classes removed: now merged into PdbasePdb and MsdsdPdb respectively
Updated following this changes testPdb and compareCMs

Line File contents
1 import java.io.IOException;
2 import java.sql.SQLException;
3 //import java.util.ArrayList;
4
5 import proteinstructure.*;
6
7 //import java.util.TreeMap;
8
9 public class testPdb {
10
11 /**
12 * Test class for classes in aglappe.proteinstructure package (Pdb, Graph, AA, Contact)
13 * 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 * @throws SQLException
16 */
17
18 public static void main(String[] args) throws IOException, PdbaseInconsistencyError, PdbaseAcCodeNotFoundError, MsdsdAcCodeNotFoundError, MsdsdInconsistentResidueNumbersError, SQLException{
19 String accode="1bxy";
20 String chaincode="A";
21 // data from pdbase
22 System.out.println("loading structure from pdbase");
23 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
24 System.out.println("dumping structure to pdb file");
25 pdb.dump2pdbfile("testpdb.txt");
26 String chain = pdb.getChainCode();
27 System.out.println("getting graph");
28 Graph graph = pdb.get_graph("ALL", 4.1);
29 System.out.println("dumping contacts to file");
30 graph.write_contacts_to_file("test.txt");
31 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 }
37 System.out.println();
38 }
39
40 // data from msdsd
41 System.out.println("loading structure from msdsd");
42 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
43 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 System.out.println("reading from dumped pdb file");
52 Pdb pdb3 = new PdbfilePdb("testpdb.txt",chain); // we read from the file dumped from pdbase, note that dumped file contains internal chain identifier
53 System.out.println("getting graph");
54 Graph graph3 = pdb3.get_graph("ALL", 4.1);
55 System.out.println("dumping contacts to file");
56 graph3.write_contacts_to_file("test3.txt");
57 }
58
59 }