ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/owl/trunk/testPdb.java
Revision: 492
Committed: Wed Jan 2 13:18:57 2008 UTC (17 years, 1 month ago) by duarte
File size: 2135 byte(s)
Log Message:
Copied the aglappe-jung branch into trunk.

Line User Rev File contents
1 duarte 202 import java.sql.SQLException;
2     //import java.util.ArrayList;
3 duarte 125
4 duarte 132 import proteinstructure.*;
5    
6 duarte 202 //import java.util.TreeMap;
7 duarte 132
8 duarte 125 public class testPdb {
9    
10     /**
11     * Test class for classes in aglappe.proteinstructure package (Pdb, Graph, AA, Contact)
12 duarte 132 * Loads structure data from pdbase, msdsd and pdb file and calculates graph dumping contacts to file
13     * Also gets contact map object and some common neighbours from it
14 duarte 202 * @throws SQLException
15 duarte 125 */
16    
17 duarte 208 public static void main(String[] args)
18 duarte 441 throws Exception{
19 duarte 208
20 duarte 162 String accode="1bxy";
21     String chaincode="A";
22 duarte 132 // data from pdbase
23     System.out.println("loading structure from pdbase");
24 duarte 441 Pdb pdb = new PdbasePdb(accode); // by default it goes to database "pdbase", a name for another pdbase database + a MySQLConnection can also be passed
25     pdb.load(chaincode);
26 duarte 127 System.out.println("dumping structure to pdb file");
27     pdb.dump2pdbfile("testpdb.txt");
28 duarte 206 String chain = pdb.getChainCode();
29 duarte 125 System.out.println("getting graph");
30 duarte 420 RIGraph graph = pdb.get_graph("ALL", 4.1);
31 duarte 125 System.out.println("dumping contacts to file");
32 duarte 424 graph.write_graph_to_file("test.txt");
33 duarte 162 System.out.println("getting start of contact map matrix from graph");
34 duarte 132
35     // data from msdsd
36     System.out.println("loading structure from msdsd");
37 duarte 441 Pdb pdb2 = new MsdsdPdb(accode); // by default it goes to database "msdsd_00_07_a", a name for another msdsd database + a MySQLConnection can also be passed
38     pdb2.load(chaincode);
39 duarte 132 System.out.println("dumping structure to pdb file");
40     pdb2.dump2pdbfile("testpdb2.txt");
41     System.out.println("getting graph");
42 duarte 420 RIGraph graph2 = pdb2.get_graph("ALL", 4.1);
43 duarte 132 System.out.println("dumping contacts to file");
44 duarte 424 graph2.write_graph_to_file("test2.txt");
45 duarte 132
46     // data from pdb
47 duarte 127 System.out.println("reading from dumped pdb file");
48 duarte 441 Pdb pdb3 = new PdbfilePdb("testpdb.txt"); // we read from the file dumped from pdbase, note that dumped file contains internal chain identifier
49     pdb3.load(chain);
50 duarte 127 System.out.println("getting graph");
51 duarte 420 RIGraph graph3 = pdb3.get_graph("ALL", 4.1);
52 duarte 127 System.out.println("dumping contacts to file");
53 duarte 424 graph3.write_graph_to_file("test3.txt");
54 duarte 125 }
55    
56     }