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) |
19 |
throws IOException, PdbaseInconsistencyError, PdbCodeNotFoundError, PdbChainCodeNotFoundError, |
20 |
MsdsdInconsistentResidueNumbersError, SQLException, PdbfileFormatError{ |
21 |
|
22 |
String accode="1bxy"; |
23 |
String chaincode="A"; |
24 |
// data from pdbase |
25 |
System.out.println("loading structure from pdbase"); |
26 |
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 |
System.out.println("dumping structure to pdb file"); |
28 |
pdb.dump2pdbfile("testpdb.txt"); |
29 |
String chain = pdb.getChainCode(); |
30 |
System.out.println("getting graph"); |
31 |
Graph graph = pdb.get_graph("ALL", 4.1); |
32 |
System.out.println("dumping contacts to file"); |
33 |
graph.write_graph_to_file("test.txt"); |
34 |
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 |
} |
40 |
System.out.println(); |
41 |
} |
42 |
|
43 |
// data from msdsd |
44 |
System.out.println("loading structure from msdsd"); |
45 |
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 |
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 |
graph2.write_graph_to_file("test2.txt"); |
52 |
|
53 |
// data from pdb |
54 |
System.out.println("reading from dumped pdb file"); |
55 |
Pdb pdb3 = new PdbfilePdb("testpdb.txt",chain); // we read from the file dumped from pdbase, note that dumped file contains internal chain identifier |
56 |
System.out.println("getting graph"); |
57 |
Graph graph3 = pdb3.get_graph("ALL", 4.1); |
58 |
System.out.println("dumping contacts to file"); |
59 |
graph3.write_graph_to_file("test3.txt"); |
60 |
} |
61 |
|
62 |
} |