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 package org.utgenome.gwt.utgb.client.bio;
26
27 import java.util.Map;
28
29 import com.google.gwt.user.client.rpc.IsSerializable;
30
31
32
33
34
35
36
37 public class Coordinate implements IsSerializable {
38
39
40
41
42 private String group = "utgb";
43
44
45
46
47 private String species;
48
49
50
51
52 private String revision;
53
54
55
56 private String name;
57
58 public Coordinate() {
59 }
60
61 public Coordinate(String group, String species, String revision, String name) {
62 this.group = group;
63 this.species = species;
64 this.revision = revision;
65 this.name = name;
66 }
67
68 public String getTrackURL(String baseURL, Map additionalProperties) {
69
70 String url = getTrackURL(baseURL);
71 StringBuilder buf = new StringBuilder();
72 buf.append(url);
73 for (Object eachKey : additionalProperties.keySet()) {
74 buf.append("&");
75 buf.append(eachKey.toString());
76 buf.append("=");
77 buf.append(additionalProperties.get(eachKey).toString());
78 }
79 return buf.toString();
80 }
81
82 public String getTrackURL(String baseURL) {
83
84 if (baseURL.contains("%q"))
85 baseURL = baseURL.replace("%q", "group=%group&species=%species&revision=%ref&name=%chr&start=%start&end=%end&width=%pixelwidth");
86
87 baseURL = baseURL.replaceAll("%group", group);
88 baseURL = baseURL.replaceAll("%species", species);
89 baseURL = baseURL.replaceAll("%ref", revision);
90 baseURL = baseURL.replaceAll("%chr", name);
91
92 return baseURL.trim();
93
94 }
95
96
97
98
99
100
101
102
103
104 public static Coordinate newUTGBCoordinate(String species, String revision, String coordinateName) {
105 return new Coordinate("utgb", species, revision, coordinateName);
106 }
107
108 public String getGroup() {
109 return group;
110 }
111
112 public void setGroup(String group) {
113 this.group = group;
114 }
115
116 public String getName() {
117 return name;
118 }
119
120 public void setName(String name) {
121 this.name = name;
122 }
123
124 public String getSpecies() {
125 return species;
126 }
127
128 public void setSpecies(String species) {
129 this.species = species;
130 }
131
132 public String getRevision() {
133 return revision;
134 }
135
136 public void setRevision(String revision) {
137 this.revision = revision;
138 }
139
140 }