-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPosition.pde
53 lines (42 loc) · 1000 Bytes
/
Position.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class Position{
int index;
ArrayList<Node> nodes;
HashMap<String, Node> node_map;
ArrayList<Edge> edges;
HashMap<String, Edge> edge_map; //key = "A_A"
//display
float gap_size;
float height;
Rectangle label_rect;
float uncertainty;
float informationContent;
Position(int i){
index = i;
nodes = new ArrayList<Node>();
edges = new ArrayList<Edge>();
node_map = new HashMap<String, Node>();
edge_map = new HashMap<String, Edge>();
}
ArrayList<Edge> getAllEdgesStartsWith(String aa){
ArrayList<Edge> result = new ArrayList<Edge>();
for(String key : edge_map.keySet()){
if(key.startsWith(aa)){
Edge e = (Edge) edge_map.get(key);
result.add(e);
}
}
//sorthing to be implemented...
return result;
}
String getMostFrequentResidue(){
String result = "";
int count = 0;
for(Node n : nodes){
if(count < n.sequences.size()){
count = n.sequences.size();
result = ""+n.aminoAcid;
}
}
return result;
}
}