1 |
duarte |
179 |
package proteinstructure; |
2 |
|
|
|
3 |
|
|
import java.util.TreeMap; |
4 |
|
|
import java.util.Collections; |
5 |
|
|
|
6 |
|
|
public class NodeNbh extends TreeMap<Integer,String> { |
7 |
|
|
|
8 |
|
|
|
9 |
|
|
private static final long serialVersionUID = 1L; |
10 |
|
|
|
11 |
|
|
public static final String centralLetter="x"; |
12 |
|
|
|
13 |
|
|
// central residue |
14 |
|
|
public int central_resser; |
15 |
|
|
public String central_resType; |
16 |
|
|
|
17 |
|
|
public NodeNbh(int i_resser, String i_resType){ |
18 |
|
|
super(); |
19 |
|
|
this.central_resser=i_resser; |
20 |
|
|
this.central_resType=i_resType; |
21 |
|
|
} |
22 |
|
|
|
23 |
|
|
public String getMotif(){ |
24 |
|
|
String motif=""; |
25 |
|
|
int min=Math.min(central_resser, Collections.min(this.keySet())); |
26 |
|
|
int max=Math.max(central_resser, Collections.max(this.keySet())); |
27 |
|
|
for (int i=min;i<=max;i++){ |
28 |
|
|
if (this.containsKey(i)){ |
29 |
|
|
motif+=AA.threeletter2oneletter(this.get(i)); |
30 |
|
|
} else if (i==central_resser){ |
31 |
|
|
motif+=centralLetter; |
32 |
|
|
} else { |
33 |
|
|
motif+="_"; |
34 |
|
|
} |
35 |
|
|
} |
36 |
|
|
return motif; |
37 |
|
|
} |
38 |
|
|
|
39 |
|
|
public String getMotifwg(){ |
40 |
|
|
String motif=""; |
41 |
|
|
int min=Math.min(central_resser, Collections.min(this.keySet())); |
42 |
|
|
int max=Math.max(central_resser, Collections.max(this.keySet())); |
43 |
|
|
int gapSize=0; |
44 |
|
|
String gap=""; |
45 |
|
|
for (int i=min;i<=max;i++){ |
46 |
|
|
if (this.containsKey(i)){ |
47 |
|
|
motif+=gap; |
48 |
|
|
motif+=AA.threeletter2oneletter(this.get(i)); |
49 |
|
|
gapSize=0; |
50 |
|
|
gap=""; |
51 |
|
|
} else if (i==central_resser){ |
52 |
|
|
motif+=gap; |
53 |
|
|
motif+=centralLetter; |
54 |
|
|
gapSize=0; |
55 |
|
|
gap=""; |
56 |
|
|
} else { |
57 |
|
|
gapSize++; |
58 |
|
|
gap="_{"+gapSize+"}"; |
59 |
|
|
} |
60 |
|
|
} |
61 |
|
|
return motif; |
62 |
|
|
} |
63 |
|
|
|
64 |
|
|
} |