1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ws.jws1; |
22 |
|
|
23 |
|
import java.util.Locale; |
24 |
|
|
25 |
|
import jalview.datamodel.AlignmentI; |
26 |
|
import jalview.datamodel.AlignmentView; |
27 |
|
import jalview.gui.AlignFrame; |
28 |
|
import jalview.gui.Desktop; |
29 |
|
import jalview.gui.JvOptionPane; |
30 |
|
import jalview.gui.WebserviceInfo; |
31 |
|
import jalview.util.MessageManager; |
32 |
|
|
33 |
|
import java.awt.event.ActionEvent; |
34 |
|
import java.awt.event.ActionListener; |
35 |
|
|
36 |
|
import javax.swing.JMenu; |
37 |
|
import javax.swing.JMenuItem; |
38 |
|
|
39 |
|
import ext.vamsas.MuscleWSServiceLocator; |
40 |
|
import ext.vamsas.MuscleWSSoapBindingStub; |
41 |
|
import ext.vamsas.ServiceHandle; |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
@author |
47 |
|
@version |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 76 (76) |
Complexity: 21 |
Complexity Density: 0.42 |
|
49 |
|
public class MsaWSClient extends WS1Client |
50 |
|
{ |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
ext.vamsas.MuscleWS server; |
55 |
|
|
56 |
|
AlignFrame alignFrame; |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
@param |
63 |
|
|
64 |
|
@param |
65 |
|
|
66 |
|
@param |
67 |
|
|
68 |
|
@param |
69 |
|
|
70 |
|
@param |
71 |
|
|
72 |
|
|
73 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 3 |
Complexity Density: 0.33 |
|
74 |
0 |
public MsaWSClient(ext.vamsas.ServiceHandle sh, String altitle,... |
75 |
|
jalview.datamodel.AlignmentView msa, boolean submitGaps, |
76 |
|
boolean preserveOrder, AlignmentI seqdataset, |
77 |
|
AlignFrame _alignFrame) |
78 |
|
{ |
79 |
0 |
super(); |
80 |
0 |
alignFrame = _alignFrame; |
81 |
0 |
if (!sh.getAbstractName().equals("MsaWS")) |
82 |
|
{ |
83 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, |
84 |
|
MessageManager.formatMessage( |
85 |
|
"label.service_called_is_not_msa_service", |
86 |
|
new String[] |
87 |
|
{ sh.getName() }), |
88 |
|
MessageManager.getString("label.internal_jalview_error"), |
89 |
|
JvOptionPane.WARNING_MESSAGE); |
90 |
|
|
91 |
0 |
return; |
92 |
|
} |
93 |
|
|
94 |
0 |
if ((wsInfo = setWebService(sh)) == null) |
95 |
|
{ |
96 |
0 |
JvOptionPane.showMessageDialog(Desktop.desktop, MessageManager |
97 |
|
.formatMessage("label.msa_service_is_unknown", new String[] |
98 |
|
{ sh.getName() }), |
99 |
|
MessageManager.getString("label.internal_jalview_error"), |
100 |
|
JvOptionPane.WARNING_MESSAGE); |
101 |
|
|
102 |
0 |
return; |
103 |
|
} |
104 |
0 |
startMsaWSClient(altitle, msa, submitGaps, preserveOrder, seqdataset); |
105 |
|
|
106 |
|
} |
107 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
108 |
0 |
public MsaWSClient()... |
109 |
|
{ |
110 |
0 |
super(); |
111 |
|
|
112 |
|
} |
113 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 8 |
Complexity Density: 0.62 |
|
114 |
0 |
private void startMsaWSClient(String altitle, AlignmentView msa,... |
115 |
|
boolean submitGaps, boolean preserveOrder, AlignmentI seqdataset) |
116 |
|
{ |
117 |
0 |
if (!locateWebService()) |
118 |
|
{ |
119 |
0 |
return; |
120 |
|
} |
121 |
|
|
122 |
0 |
wsInfo.setProgressText(((submitGaps) ? "Re-alignment" : "Alignment") |
123 |
|
+ " of " + altitle + "\nJob details\n"); |
124 |
0 |
String jobtitle = WebServiceName.toLowerCase(Locale.ROOT); |
125 |
0 |
if (jobtitle.endsWith("alignment")) |
126 |
|
{ |
127 |
0 |
if (submitGaps && (!jobtitle.endsWith("realignment") |
128 |
|
|| jobtitle.indexOf("profile") == -1)) |
129 |
|
{ |
130 |
0 |
int pos = jobtitle.indexOf("alignment"); |
131 |
0 |
jobtitle = WebServiceName.substring(0, pos) + "re-alignment of " |
132 |
|
+ altitle; |
133 |
|
} |
134 |
|
else |
135 |
|
{ |
136 |
0 |
jobtitle = WebServiceName + " of " + altitle; |
137 |
|
} |
138 |
|
} |
139 |
|
else |
140 |
|
{ |
141 |
0 |
jobtitle = WebServiceName + (submitGaps ? " re" : " ") |
142 |
|
+ "alignment of " + altitle; |
143 |
|
} |
144 |
|
|
145 |
0 |
MsaWSThread msathread = new MsaWSThread(server, WsURL, wsInfo, |
146 |
|
alignFrame, WebServiceName, jobtitle, msa, submitGaps, |
147 |
|
preserveOrder, seqdataset); |
148 |
0 |
wsInfo.setthisService(msathread); |
149 |
0 |
msathread.start(); |
150 |
|
} |
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
@return |
156 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.2 |
|
157 |
0 |
private boolean locateWebService()... |
158 |
|
{ |
159 |
|
|
160 |
0 |
MuscleWSServiceLocator loc = new MuscleWSServiceLocator(); |
161 |
|
|
162 |
0 |
try |
163 |
|
{ |
164 |
0 |
this.server = loc.getMuscleWS(new java.net.URL(WsURL)); |
165 |
0 |
((MuscleWSSoapBindingStub) this.server).setTimeout(60000); |
166 |
|
|
167 |
|
} catch (Exception ex) |
168 |
|
{ |
169 |
0 |
wsInfo.setProgressText("Serious! " + WebServiceName |
170 |
|
+ " Service location failed\nfor URL :" + WsURL + "\n" |
171 |
|
+ ex.getMessage()); |
172 |
0 |
wsInfo.setStatus(WebserviceInfo.ERROR); |
173 |
0 |
ex.printStackTrace(); |
174 |
|
|
175 |
0 |
return false; |
176 |
|
} |
177 |
|
|
178 |
0 |
loc.getEngine().setOption("axis", "1"); |
179 |
|
|
180 |
0 |
return true; |
181 |
|
} |
182 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
183 |
0 |
protected String getServiceActionKey()... |
184 |
|
{ |
185 |
0 |
return "MsaWS"; |
186 |
|
} |
187 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
188 |
0 |
protected String getServiceActionDescription()... |
189 |
|
{ |
190 |
0 |
return "Multiple Sequence Alignment"; |
191 |
|
} |
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
|
196 |
|
|
197 |
|
@return |
198 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
199 |
0 |
private boolean canSubmitGaps()... |
200 |
|
{ |
201 |
|
|
202 |
|
|
203 |
0 |
return (WebServiceName.indexOf("lustal") > -1); |
204 |
|
} |
205 |
|
|
|
|
| 0% |
Uncovered Elements: 12 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
206 |
0 |
@Override... |
207 |
|
public void attachWSMenuEntry(JMenu msawsmenu, |
208 |
|
final ServiceHandle serviceHandle, final AlignFrame alignFrame) |
209 |
|
{ |
210 |
0 |
setWebService(serviceHandle, true); |
211 |
0 |
JMenuItem method = new JMenuItem(WebServiceName); |
212 |
0 |
method.setToolTipText(WsURL); |
213 |
0 |
method.addActionListener(new ActionListener() |
214 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
215 |
0 |
@Override... |
216 |
|
public void actionPerformed(ActionEvent e) |
217 |
|
{ |
218 |
0 |
AlignmentView msa = alignFrame.gatherSequencesForAlignment(); |
219 |
0 |
new jalview.ws.jws1.MsaWSClient(serviceHandle, |
220 |
|
alignFrame.getTitle(), msa, false, true, |
221 |
|
alignFrame.getViewport().getAlignment().getDataset(), |
222 |
|
alignFrame); |
223 |
|
|
224 |
|
} |
225 |
|
|
226 |
|
}); |
227 |
0 |
msawsmenu.add(method); |
228 |
0 |
if (canSubmitGaps()) |
229 |
|
{ |
230 |
|
|
231 |
0 |
final JMenuItem methodR = new JMenuItem( |
232 |
|
serviceHandle.getName() + " Realign"); |
233 |
0 |
methodR.setToolTipText(WsURL); |
234 |
0 |
methodR.addActionListener(new ActionListener() |
235 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
236 |
0 |
@Override... |
237 |
|
public void actionPerformed(ActionEvent e) |
238 |
|
{ |
239 |
0 |
AlignmentView msa = alignFrame.gatherSequencesForAlignment(); |
240 |
0 |
new jalview.ws.jws1.MsaWSClient(serviceHandle, |
241 |
|
alignFrame.getTitle(), msa, true, true, |
242 |
|
alignFrame.getViewport().getAlignment().getDataset(), |
243 |
|
alignFrame); |
244 |
|
|
245 |
|
} |
246 |
|
|
247 |
|
}); |
248 |
0 |
msawsmenu.add(methodR); |
249 |
|
|
250 |
|
} |
251 |
|
|
252 |
|
} |
253 |
|
} |