1 |
stehr |
321 |
import proteinstructure.*; |
2 |
|
|
import java.util.*; |
3 |
|
|
|
4 |
|
|
/** |
5 |
|
|
* Calculate a matrix containing the element-wise differences between the distance maps of two proteins |
6 |
|
|
* @author stehr |
7 |
|
|
* |
8 |
|
|
*/ |
9 |
|
|
public class testDeltaDistanceMap { |
10 |
|
|
|
11 |
|
|
/** |
12 |
|
|
* Run tests |
13 |
|
|
*/ |
14 |
|
|
public static void main(String[] args) { |
15 |
|
|
try { |
16 |
|
|
String pdbCode1 = "12as"; |
17 |
|
|
String chainCode1 = "A"; |
18 |
|
|
String pdbCode2 = "12as"; |
19 |
|
|
String chainCode2 = "B"; |
20 |
|
|
|
21 |
|
|
System.out.println("Loading pdb objects..."); |
22 |
|
|
Pdb pdb1 = new PdbasePdb("12as", "B"); |
23 |
|
|
assert(pdb1 != null); |
24 |
|
|
Pdb pdb2 = new PdbasePdb("12as", "A"); |
25 |
|
|
assert(pdb2 != null); |
26 |
|
|
|
27 |
|
|
System.out.println("Calculating distance maps..."); |
28 |
stehr |
327 |
HashMap<Edge,Double> distMap1 = pdb1.calculate_dist_matrix("Ca"); |
29 |
stehr |
321 |
assert(distMap1 != null); |
30 |
stehr |
327 |
HashMap<Edge,Double> distMap2 = pdb2.calculate_dist_matrix("Ca"); |
31 |
stehr |
321 |
assert(distMap2 != null); |
32 |
|
|
|
33 |
|
|
System.out.println("Calculating difference distance map..."); |
34 |
stehr |
327 |
HashMap<Edge,Double> diffDistMap = pdb1.getDiffDistMap("Ca", pdb2, "Ca"); |
35 |
stehr |
321 |
assert(diffDistMap != null); |
36 |
|
|
assert(diffDistMap.size() == distMap1.size()); |
37 |
|
|
assert(diffDistMap.size() == distMap2.size()); |
38 |
|
|
|
39 |
|
|
System.out.print("Missing matrix values (dim=" + pdb1.getFullLength() + "): "); |
40 |
|
|
int mis = 0; |
41 |
|
|
for(int i=1; i<=pdb1.getFullLength();i++) { |
42 |
|
|
for(int j=1; j<i;j++) { |
43 |
|
|
if(!diffDistMap.containsKey(new Edge(j,i))) { |
44 |
|
|
//System.out.print("(" + i + "," + j + ") "); |
45 |
|
|
mis++; |
46 |
|
|
} |
47 |
|
|
} |
48 |
|
|
} |
49 |
|
|
System.out.println(mis); |
50 |
|
|
|
51 |
|
|
Edge e = new Edge(27,30); |
52 |
|
|
|
53 |
|
|
double dist1 = distMap1.get(e); |
54 |
|
|
double dist2 = distMap2.get(e); |
55 |
|
|
double diffDist = diffDistMap.get(e); |
56 |
|
|
assert(diffDist == Math.abs(dist1 - dist2)); |
57 |
|
|
double min = Collections.min(diffDistMap.values()); |
58 |
|
|
double max = Collections.max(diffDistMap.values()); |
59 |
|
|
|
60 |
|
|
System.out.println("Checking difference distance map for " + pdbCode1 + chainCode1 + " and " + pdbCode2 + chainCode2); |
61 |
|
|
System.out.println("size=" + diffDistMap.size() + " min=" + min + " max= " + max); |
62 |
|
|
} |
63 |
|
|
catch(Exception e) { |
64 |
|
|
e.printStackTrace(); |
65 |
|
|
|
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
} |
69 |
|
|
|
70 |
|
|
} |