1 |
|
import proteinstructure.*; |
2 |
|
import java.util.*; |
3 |
|
|
4 |
+ |
import edu.uci.ics.jung.graph.util.Pair; |
5 |
+ |
|
6 |
|
/** |
7 |
|
* Calculate a matrix containing the element-wise differences between the distance maps of two proteins |
8 |
|
* @author stehr |
21 |
|
String chainCode2 = "B"; |
22 |
|
|
23 |
|
System.out.println("Loading pdb objects..."); |
24 |
< |
Pdb pdb1 = new PdbasePdb("12as", "B"); |
24 |
> |
Pdb pdb1 = new PdbasePdb("12as"); |
25 |
> |
pdb1.load("B"); |
26 |
|
assert(pdb1 != null); |
27 |
< |
Pdb pdb2 = new PdbasePdb("12as", "A"); |
27 |
> |
Pdb pdb2 = new PdbasePdb("12as"); |
28 |
> |
pdb2.load("A"); |
29 |
|
assert(pdb2 != null); |
30 |
|
|
31 |
|
System.out.println("Calculating distance maps..."); |
32 |
< |
HashMap<Edge,Double> distMap1 = pdb1.calculate_dist_matrix("Ca"); |
32 |
> |
HashMap<Pair<Integer>,Double> distMap1 = pdb1.calculate_dist_matrix("Ca"); |
33 |
|
assert(distMap1 != null); |
34 |
< |
HashMap<Edge,Double> distMap2 = pdb2.calculate_dist_matrix("Ca"); |
34 |
> |
HashMap<Pair<Integer>,Double> distMap2 = pdb2.calculate_dist_matrix("Ca"); |
35 |
|
assert(distMap2 != null); |
36 |
|
|
37 |
|
System.out.println("Calculating difference distance map..."); |
38 |
< |
HashMap<Edge,Double> diffDistMap = pdb1.getDiffDistMap("Ca", pdb2, "Ca"); |
38 |
> |
HashMap<Pair<Integer>,Double> diffDistMap = pdb1.getDiffDistMap("Ca", pdb2, "Ca"); |
39 |
|
assert(diffDistMap != null); |
40 |
|
assert(diffDistMap.size() == distMap1.size()); |
41 |
|
assert(diffDistMap.size() == distMap2.size()); |
44 |
|
int mis = 0; |
45 |
|
for(int i=1; i<=pdb1.getFullLength();i++) { |
46 |
|
for(int j=1; j<i;j++) { |
47 |
< |
if(!diffDistMap.containsKey(new Edge(j,i))) { |
47 |
> |
if(!diffDistMap.containsKey(new Pair<Integer>(j,i))) { |
48 |
|
//System.out.print("(" + i + "," + j + ") "); |
49 |
|
mis++; |
50 |
|
} |
52 |
|
} |
53 |
|
System.out.println(mis); |
54 |
|
|
55 |
< |
Edge e = new Edge(27,30); |
55 |
> |
Pair<Integer> e = new Pair<Integer>(27,30); |
56 |
|
|
57 |
|
double dist1 = distMap1.get(e); |
58 |
|
double dist2 = distMap2.get(e); |