1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.bin; |
22 |
|
|
23 |
|
import jalview.ext.so.SequenceOntology; |
24 |
|
import jalview.gui.AlignFrame; |
25 |
|
import jalview.gui.Desktop; |
26 |
|
import jalview.gui.PromptUserConfig; |
27 |
|
import jalview.io.AppletFormatAdapter; |
28 |
|
import jalview.io.BioJsHTMLOutput; |
29 |
|
import jalview.io.DataSourceType; |
30 |
|
import jalview.io.FileFormat; |
31 |
|
import jalview.io.FileFormatException; |
32 |
|
import jalview.io.FileFormatI; |
33 |
|
import jalview.io.FileLoader; |
34 |
|
import jalview.io.HtmlSvgOutput; |
35 |
|
import jalview.io.IdentifyFile; |
36 |
|
import jalview.io.NewickFile; |
37 |
|
import jalview.io.gff.SequenceOntologyFactory; |
38 |
|
import jalview.schemes.ColourSchemeI; |
39 |
|
import jalview.schemes.ColourSchemeProperty; |
40 |
|
import jalview.util.MessageManager; |
41 |
|
import jalview.util.Platform; |
42 |
|
import jalview.ws.jws2.Jws2Discoverer; |
43 |
|
|
44 |
|
import java.io.BufferedReader; |
45 |
|
import java.io.File; |
46 |
|
import java.io.FileOutputStream; |
47 |
|
import java.io.IOException; |
48 |
|
import java.io.InputStreamReader; |
49 |
|
import java.io.OutputStreamWriter; |
50 |
|
import java.io.PrintWriter; |
51 |
|
import java.net.MalformedURLException; |
52 |
|
import java.net.URI; |
53 |
|
import java.net.URISyntaxException; |
54 |
|
import java.net.URL; |
55 |
|
import java.security.AllPermission; |
56 |
|
import java.security.CodeSource; |
57 |
|
import java.security.PermissionCollection; |
58 |
|
import java.security.Permissions; |
59 |
|
import java.security.Policy; |
60 |
|
import java.util.HashMap; |
61 |
|
import java.util.Map; |
62 |
|
import java.util.Vector; |
63 |
|
|
64 |
|
import javax.swing.LookAndFeel; |
65 |
|
import javax.swing.UIManager; |
66 |
|
|
67 |
|
import groovy.lang.Binding; |
68 |
|
import groovy.util.GroovyScriptEngine; |
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
@author |
76 |
|
@version |
77 |
|
|
|
|
| 23.1% |
Uncovered Elements: 449 (584) |
Complexity: 150 |
Complexity Density: 0.4 |
|
78 |
|
public class Jalview |
79 |
|
{ |
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
private static Jalview instance; |
87 |
|
|
88 |
|
private Desktop desktop; |
89 |
|
|
90 |
|
public static AlignFrame currentAlignFrame; |
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
@return |
97 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
98 |
81048 |
public static boolean isJS()... |
99 |
|
{ |
100 |
81048 |
return |
101 |
|
false; |
102 |
|
} |
103 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
104 |
1 |
static... |
105 |
|
{ |
106 |
1 |
if (!isJS()) |
107 |
|
{ |
108 |
|
|
109 |
1 |
Policy.setPolicy(new Policy() |
110 |
|
{ |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
111 |
0 |
@Override... |
112 |
|
public PermissionCollection getPermissions(CodeSource codesource) |
113 |
|
{ |
114 |
0 |
Permissions perms = new Permissions(); |
115 |
0 |
perms.add(new AllPermission()); |
116 |
0 |
return (perms); |
117 |
|
} |
118 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
119 |
0 |
@Override... |
120 |
|
public void refresh() |
121 |
|
{ |
122 |
|
} |
123 |
|
}); |
124 |
|
|
125 |
|
} |
126 |
|
} |
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
@author |
132 |
|
|
133 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 4 |
Complexity Density: 0.31 |
|
134 |
|
class FeatureFetcher |
135 |
|
{ |
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
private int queued = 0; |
142 |
|
|
143 |
|
private int running = 0; |
144 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
145 |
0 |
public FeatureFetcher()... |
146 |
|
{ |
147 |
|
|
148 |
|
} |
149 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
150 |
0 |
public void addFetcher(final AlignFrame af,... |
151 |
|
final Vector<String> dasSources) |
152 |
|
{ |
153 |
0 |
final long id = System.currentTimeMillis(); |
154 |
0 |
queued++; |
155 |
0 |
final FeatureFetcher us = this; |
156 |
0 |
new Thread(new Runnable() |
157 |
|
{ |
158 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
159 |
0 |
@Override... |
160 |
|
public void run() |
161 |
|
{ |
162 |
0 |
synchronized (us) |
163 |
|
{ |
164 |
0 |
queued--; |
165 |
0 |
running++; |
166 |
|
} |
167 |
|
|
168 |
0 |
af.setProgressBar(MessageManager |
169 |
|
.getString("status.das_features_being_retrived"), id); |
170 |
0 |
af.featureSettings_actionPerformed(null); |
171 |
0 |
af.setProgressBar(null, id); |
172 |
0 |
synchronized (us) |
173 |
|
{ |
174 |
0 |
running--; |
175 |
|
} |
176 |
|
} |
177 |
|
}).start(); |
178 |
|
} |
179 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
180 |
0 |
public synchronized boolean allFinished()... |
181 |
|
{ |
182 |
0 |
return queued == 0 && running == 0; |
183 |
|
} |
184 |
|
|
185 |
|
} |
186 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
187 |
0 |
public static Jalview getInstance()... |
188 |
|
{ |
189 |
0 |
return instance; |
190 |
|
} |
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
@param |
196 |
|
|
197 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
198 |
11 |
public static void main(String[] args)... |
199 |
|
{ |
200 |
11 |
instance = new Jalview(); |
201 |
11 |
instance.doMain(args); |
202 |
|
} |
203 |
|
|
204 |
|
|
205 |
|
@param |
206 |
|
|
|
|
| 25.6% |
Uncovered Elements: 302 (406) |
Complexity: 99 |
Complexity Density: 0.38 |
|
207 |
11 |
void doMain(String[] args)... |
208 |
|
{ |
209 |
|
|
210 |
11 |
if (!isJS()) |
211 |
|
{ |
212 |
11 |
System.setSecurityManager(null); |
213 |
|
} |
214 |
|
|
215 |
11 |
System.out |
216 |
|
.println("Java version: " + System.getProperty("java.version")); |
217 |
11 |
System.out.println(System.getProperty("os.arch") + " " |
218 |
|
+ System.getProperty("os.name") + " " |
219 |
|
+ System.getProperty("os.version")); |
220 |
|
|
221 |
11 |
ArgsParser aparser = new ArgsParser(args); |
222 |
11 |
boolean headless = false; |
223 |
|
|
224 |
11 |
String usrPropsFile = aparser.getValue("props"); |
225 |
11 |
Cache.loadProperties(usrPropsFile); |
226 |
11 |
if (usrPropsFile != null) |
227 |
|
{ |
228 |
7 |
System.out.println( |
229 |
|
"CMD [-props " + usrPropsFile + "] executed successfully!"); |
230 |
|
} |
231 |
|
|
232 |
|
|
233 |
|
|
234 |
|
|
235 |
|
|
236 |
|
|
237 |
|
{ |
238 |
11 |
if (aparser.contains("help") || aparser.contains("h")) |
239 |
|
{ |
240 |
0 |
showUsage(); |
241 |
0 |
System.exit(0); |
242 |
|
} |
243 |
11 |
if (aparser.contains("nodisplay") || aparser.contains("nogui") |
244 |
|
|| aparser.contains("headless")) |
245 |
|
{ |
246 |
0 |
System.setProperty("java.awt.headless", "true"); |
247 |
0 |
headless = true; |
248 |
|
} |
249 |
|
|
250 |
|
|
251 |
11 |
final String jabawsUrl = aparser.getValue("jabaws"); |
252 |
11 |
if (jabawsUrl != null) |
253 |
|
{ |
254 |
0 |
try |
255 |
|
{ |
256 |
0 |
Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl); |
257 |
0 |
System.out.println( |
258 |
|
"CMD [-jabaws " + jabawsUrl + "] executed successfully!"); |
259 |
|
} catch (MalformedURLException e) |
260 |
|
{ |
261 |
0 |
System.err.println( |
262 |
|
"Invalid jabaws parameter: " + jabawsUrl + " ignored"); |
263 |
|
} |
264 |
|
} |
265 |
|
|
266 |
|
} |
267 |
11 |
String defs = aparser.getValue("setprop"); |
268 |
11 |
while (defs != null) |
269 |
|
{ |
270 |
0 |
int p = defs.indexOf('='); |
271 |
0 |
if (p == -1) |
272 |
|
{ |
273 |
0 |
System.err.println("Ignoring invalid setprop argument : " + defs); |
274 |
|
} |
275 |
|
else |
276 |
|
{ |
277 |
0 |
System.out.println("Executing setprop argument: " + defs); |
278 |
|
|
279 |
|
|
280 |
|
|
281 |
|
} |
282 |
0 |
defs = aparser.getValue("setprop"); |
283 |
|
} |
284 |
11 |
if (System.getProperty("java.awt.headless") != null |
285 |
|
&& System.getProperty("java.awt.headless").equals("true")) |
286 |
|
{ |
287 |
0 |
headless = true; |
288 |
|
} |
289 |
11 |
System.setProperty("http.agent", |
290 |
|
"Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown")); |
291 |
11 |
try |
292 |
|
{ |
293 |
11 |
Cache.initLogger(); |
294 |
|
} catch (NoClassDefFoundError error) |
295 |
|
{ |
296 |
0 |
error.printStackTrace(); |
297 |
0 |
System.out.println("\nEssential logging libraries not found." |
298 |
|
+ "\nUse: java -Djava.ext.dirs=$PATH_TO_LIB$ jalview.bin.Jalview"); |
299 |
0 |
System.exit(0); |
300 |
|
} |
301 |
|
|
302 |
11 |
desktop = null; |
303 |
|
|
304 |
11 |
try |
305 |
|
{ |
306 |
11 |
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
307 |
|
} catch (Exception ex) |
308 |
|
{ |
309 |
0 |
System.err.println("Unexpected Look and Feel Exception"); |
310 |
0 |
ex.printStackTrace(); |
311 |
|
} |
312 |
11 |
if (Platform.isAMac()) |
313 |
|
{ |
314 |
|
|
315 |
0 |
LookAndFeel lookAndFeel = ch.randelshofer.quaqua.QuaquaManager |
316 |
|
.getLookAndFeel(); |
317 |
0 |
System.setProperty("com.apple.mrj.application.apple.menu.about.name", |
318 |
|
"Jalview"); |
319 |
0 |
System.setProperty("apple.laf.useScreenMenuBar", "true"); |
320 |
0 |
if (lookAndFeel != null) |
321 |
|
{ |
322 |
0 |
try |
323 |
|
{ |
324 |
0 |
UIManager.setLookAndFeel(lookAndFeel); |
325 |
|
} catch (Throwable e) |
326 |
|
{ |
327 |
0 |
System.err.println( |
328 |
|
"Failed to set QuaQua look and feel: " + e.toString()); |
329 |
|
} |
330 |
|
} |
331 |
0 |
if (lookAndFeel == null || !(lookAndFeel.getClass() |
332 |
|
.isAssignableFrom(UIManager.getLookAndFeel().getClass())) |
333 |
|
|| !UIManager.getLookAndFeel().getClass().toString() |
334 |
|
.toLowerCase().contains("quaqua")) |
335 |
|
{ |
336 |
0 |
try |
337 |
|
{ |
338 |
0 |
System.err.println( |
339 |
|
"Quaqua LaF not available on this plaform. Using VAqua(4).\nSee https://issues.jalview.org/browse/JAL-2976"); |
340 |
0 |
UIManager.setLookAndFeel("org.violetlib.aqua.AquaLookAndFeel"); |
341 |
|
} catch (Throwable e) |
342 |
|
{ |
343 |
0 |
System.err.println( |
344 |
|
"Failed to reset look and feel: " + e.toString()); |
345 |
|
} |
346 |
|
} |
347 |
|
} |
348 |
|
|
349 |
|
|
350 |
|
|
351 |
|
|
352 |
|
|
353 |
11 |
if (Cache.getDefault("USE_FULL_SO", false)) |
354 |
|
{ |
355 |
0 |
SequenceOntologyFactory.setInstance(new SequenceOntology()); |
356 |
|
} |
357 |
|
|
358 |
11 |
if (!headless) |
359 |
|
{ |
360 |
11 |
desktop = new Desktop(); |
361 |
11 |
desktop.setInBatchMode(true); |
362 |
11 |
desktop.setVisible(true); |
363 |
|
|
364 |
|
|
365 |
|
|
366 |
|
|
367 |
|
|
368 |
|
|
369 |
|
|
370 |
|
{ |
371 |
11 |
desktop.startServiceDiscovery(); |
372 |
11 |
if (!aparser.contains("nousagestats")) |
373 |
|
{ |
374 |
11 |
startUsageStats(desktop); |
375 |
|
} |
376 |
|
else |
377 |
|
{ |
378 |
0 |
System.err.println("CMD [-nousagestats] executed successfully!"); |
379 |
|
} |
380 |
|
|
381 |
11 |
if (!aparser.contains("noquestionnaire")) |
382 |
|
{ |
383 |
10 |
String url = aparser.getValue("questionnaire"); |
384 |
10 |
if (url != null) |
385 |
|
{ |
386 |
|
|
387 |
|
|
388 |
0 |
Cache.log.debug("Starting questionnaire url at " + url); |
389 |
0 |
desktop.checkForQuestionnaire(url); |
390 |
0 |
System.out.println("CMD questionnaire[-" + url |
391 |
|
+ "] executed successfully!"); |
392 |
|
} |
393 |
|
else |
394 |
|
{ |
395 |
10 |
if (Cache.getProperty("NOQUESTIONNAIRES") == null) |
396 |
|
{ |
397 |
|
|
398 |
|
|
399 |
|
|
400 |
|
|
401 |
|
|
402 |
4 |
String defurl = "http://www.jalview.org/cgi-bin/questionnaire.pl"; |
403 |
4 |
Cache.log.debug( |
404 |
|
"Starting questionnaire with default url: " + defurl); |
405 |
4 |
desktop.checkForQuestionnaire(defurl); |
406 |
|
} |
407 |
|
} |
408 |
|
} |
409 |
|
else |
410 |
|
{ |
411 |
1 |
System.err |
412 |
|
.println("CMD [-noquestionnaire] executed successfully!"); |
413 |
|
} |
414 |
|
|
415 |
11 |
if (!aparser.contains("nonews")) |
416 |
|
{ |
417 |
4 |
desktop.checkForNews(); |
418 |
|
} |
419 |
|
|
420 |
11 |
BioJsHTMLOutput.updateBioJS(); |
421 |
|
} |
422 |
|
} |
423 |
|
|
424 |
11 |
String file = null, data = null; |
425 |
11 |
FileFormatI format = null; |
426 |
11 |
DataSourceType protocol = null; |
427 |
11 |
FileLoader fileLoader = new FileLoader(!headless); |
428 |
11 |
Vector<String> getFeatures = null; |
429 |
|
|
430 |
|
|
431 |
|
|
432 |
11 |
String groovyscript = null; |
433 |
|
|
434 |
|
|
435 |
11 |
groovyscript = aparser.getValue("groovy", true); |
436 |
11 |
file = aparser.getValue("open", true); |
437 |
|
|
438 |
11 |
if (file == null && desktop == null) |
439 |
|
{ |
440 |
0 |
System.out.println("No files to open!"); |
441 |
0 |
System.exit(1); |
442 |
|
} |
443 |
11 |
String vamsasImport = aparser.getValue("vdoc"); |
444 |
11 |
String vamsasSession = aparser.getValue("vsess"); |
445 |
11 |
if (vamsasImport != null || vamsasSession != null) |
446 |
|
{ |
447 |
0 |
if (desktop == null || headless) |
448 |
|
{ |
449 |
0 |
System.out.println( |
450 |
|
"Headless vamsas sessions not yet supported. Sorry."); |
451 |
0 |
System.exit(1); |
452 |
|
} |
453 |
|
|
454 |
0 |
boolean inSession = false; |
455 |
0 |
if (vamsasImport != null) |
456 |
|
{ |
457 |
0 |
try |
458 |
|
{ |
459 |
0 |
DataSourceType viprotocol = AppletFormatAdapter |
460 |
|
.checkProtocol(vamsasImport); |
461 |
0 |
if (viprotocol == DataSourceType.FILE) |
462 |
|
{ |
463 |
0 |
inSession = desktop.vamsasImport(new File(vamsasImport)); |
464 |
|
} |
465 |
0 |
else if (viprotocol == DataSourceType.URL) |
466 |
|
{ |
467 |
0 |
inSession = desktop.vamsasImport(new URL(vamsasImport)); |
468 |
|
} |
469 |
|
|
470 |
|
} catch (Exception e) |
471 |
|
{ |
472 |
0 |
System.err.println("Exeption when importing " + vamsasImport |
473 |
|
+ " as a vamsas document."); |
474 |
0 |
e.printStackTrace(); |
475 |
|
} |
476 |
0 |
if (!inSession) |
477 |
|
{ |
478 |
0 |
System.err.println("Failed to import " + vamsasImport |
479 |
|
+ " as a vamsas document."); |
480 |
|
} |
481 |
|
else |
482 |
|
{ |
483 |
0 |
System.out.println("Imported Successfully into new session " |
484 |
|
+ desktop.getVamsasApplication().getCurrentSession()); |
485 |
|
} |
486 |
|
} |
487 |
0 |
if (vamsasSession != null) |
488 |
|
{ |
489 |
0 |
if (vamsasImport != null) |
490 |
|
{ |
491 |
|
|
492 |
|
|
493 |
0 |
desktop.vamsasStop_actionPerformed(null); |
494 |
|
} |
495 |
|
|
496 |
0 |
try |
497 |
|
{ |
498 |
0 |
if (desktop.joinVamsasSession(vamsasSession)) |
499 |
|
{ |
500 |
0 |
System.out.println( |
501 |
|
"Successfully joined vamsas session " + vamsasSession); |
502 |
|
} |
503 |
|
else |
504 |
|
{ |
505 |
0 |
System.err.println("WARNING: Failed to join vamsas session " |
506 |
|
+ vamsasSession); |
507 |
|
} |
508 |
|
} catch (Exception e) |
509 |
|
{ |
510 |
0 |
System.err.println( |
511 |
|
"ERROR: Failed to join vamsas session " + vamsasSession); |
512 |
0 |
e.printStackTrace(); |
513 |
|
} |
514 |
0 |
if (vamsasImport != null) |
515 |
|
{ |
516 |
|
|
517 |
|
|
518 |
0 |
Cache.log.info( |
519 |
|
"Skipping Push for import of data into existing vamsas session."); |
520 |
|
|
521 |
|
|
522 |
|
|
523 |
|
|
524 |
|
|
525 |
|
} |
526 |
|
} |
527 |
|
} |
528 |
11 |
long progress = -1; |
529 |
|
|
530 |
11 |
if (file != null) |
531 |
|
{ |
532 |
0 |
if (!headless) |
533 |
|
{ |
534 |
0 |
desktop.setProgressBar( |
535 |
|
MessageManager |
536 |
|
.getString("status.processing_commandline_args"), |
537 |
|
progress = System.currentTimeMillis()); |
538 |
|
} |
539 |
0 |
System.out.println("CMD [-open " + file + "] executed successfully!"); |
540 |
|
|
541 |
0 |
if (!isJS() && !file.startsWith("http://")) |
542 |
|
{ |
543 |
0 |
if (!(new File(file)).exists()) |
544 |
|
{ |
545 |
0 |
System.out.println("Can't find " + file); |
546 |
0 |
if (headless) |
547 |
|
{ |
548 |
0 |
System.exit(1); |
549 |
|
} |
550 |
|
} |
551 |
|
} |
552 |
|
|
553 |
0 |
protocol = AppletFormatAdapter.checkProtocol(file); |
554 |
|
|
555 |
0 |
try |
556 |
|
{ |
557 |
0 |
format = new IdentifyFile().identify(file, protocol); |
558 |
|
} catch (FileFormatException e1) |
559 |
|
{ |
560 |
|
|
561 |
|
} |
562 |
|
|
563 |
0 |
AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol, |
564 |
|
format); |
565 |
0 |
if (af == null) |
566 |
|
{ |
567 |
0 |
System.out.println("error"); |
568 |
|
} |
569 |
|
else |
570 |
|
{ |
571 |
0 |
setCurrentAlignFrame(af); |
572 |
0 |
data = aparser.getValue("colour", true); |
573 |
0 |
if (data != null) |
574 |
|
{ |
575 |
0 |
data.replaceAll("%20", " "); |
576 |
|
|
577 |
0 |
ColourSchemeI cs = ColourSchemeProperty |
578 |
|
.getColourScheme(af.getViewport().getAlignment(), data); |
579 |
|
|
580 |
0 |
if (cs != null) |
581 |
|
{ |
582 |
0 |
System.out.println( |
583 |
|
"CMD [-color " + data + "] executed successfully!"); |
584 |
|
} |
585 |
0 |
af.changeColour(cs); |
586 |
|
} |
587 |
|
|
588 |
|
|
589 |
0 |
data = aparser.getValue("groups", true); |
590 |
0 |
if (data != null) |
591 |
|
{ |
592 |
0 |
af.parseFeaturesFile(data, |
593 |
|
AppletFormatAdapter.checkProtocol(data)); |
594 |
|
|
595 |
0 |
System.out.println( |
596 |
|
"CMD groups[-" + data + "] executed successfully!"); |
597 |
|
} |
598 |
0 |
data = aparser.getValue("features", true); |
599 |
0 |
if (data != null) |
600 |
|
{ |
601 |
0 |
af.parseFeaturesFile(data, |
602 |
|
AppletFormatAdapter.checkProtocol(data)); |
603 |
|
|
604 |
0 |
System.out.println( |
605 |
|
"CMD [-features " + data + "] executed successfully!"); |
606 |
|
} |
607 |
|
|
608 |
0 |
data = aparser.getValue("annotations", true); |
609 |
0 |
if (data != null) |
610 |
|
{ |
611 |
0 |
af.loadJalviewDataFile(data, null, null, null); |
612 |
|
|
613 |
0 |
System.out.println( |
614 |
|
"CMD [-annotations " + data + "] executed successfully!"); |
615 |
|
} |
616 |
|
|
617 |
0 |
if (aparser.contains("sortbytree")) |
618 |
|
{ |
619 |
0 |
af.getViewport().setSortByTree(true); |
620 |
0 |
if (af.getViewport().getSortByTree()) |
621 |
|
{ |
622 |
0 |
System.out.println("CMD [-sortbytree] executed successfully!"); |
623 |
|
} |
624 |
|
} |
625 |
0 |
if (aparser.contains("no-annotation")) |
626 |
|
{ |
627 |
0 |
af.getViewport().setShowAnnotation(false); |
628 |
0 |
if (!af.getViewport().isShowAnnotation()) |
629 |
|
{ |
630 |
0 |
System.out.println("CMD no-annotation executed successfully!"); |
631 |
|
} |
632 |
|
} |
633 |
0 |
if (aparser.contains("nosortbytree")) |
634 |
|
{ |
635 |
0 |
af.getViewport().setSortByTree(false); |
636 |
0 |
if (!af.getViewport().getSortByTree()) |
637 |
|
{ |
638 |
0 |
System.out |
639 |
|
.println("CMD [-nosortbytree] executed successfully!"); |
640 |
|
} |
641 |
|
} |
642 |
0 |
data = aparser.getValue("tree", true); |
643 |
0 |
if (data != null) |
644 |
|
{ |
645 |
0 |
try |
646 |
|
{ |
647 |
0 |
System.out.println( |
648 |
|
"CMD [-tree " + data + "] executed successfully!"); |
649 |
0 |
NewickFile nf = new NewickFile(data, |
650 |
|
AppletFormatAdapter.checkProtocol(data)); |
651 |
0 |
af.getViewport() |
652 |
|
.setCurrentTree(af.showNewickTree(nf, data).getTree()); |
653 |
|
} catch (IOException ex) |
654 |
|
{ |
655 |
0 |
System.err.println("Couldn't add tree " + data); |
656 |
0 |
ex.printStackTrace(System.err); |
657 |
|
} |
658 |
|
} |
659 |
|
|
660 |
|
|
661 |
|
|
662 |
|
|
663 |
0 |
getFeatures = checkDasArguments(aparser); |
664 |
0 |
if (af != null && getFeatures != null) |
665 |
|
{ |
666 |
0 |
FeatureFetcher ff = startFeatureFetching(getFeatures); |
667 |
0 |
if (ff != null) |
668 |
|
{ |
669 |
0 |
while (!ff.allFinished() || af.operationInProgress()) |
670 |
|
{ |
671 |
|
|
672 |
0 |
try |
673 |
|
{ |
674 |
0 |
Thread.sleep(100); |
675 |
|
} catch (Exception e) |
676 |
|
{ |
677 |
|
|
678 |
|
} |
679 |
|
} |
680 |
|
} |
681 |
0 |
getFeatures = null; |
682 |
|
} |
683 |
0 |
if (groovyscript != null) |
684 |
|
{ |
685 |
|
|
686 |
|
|
687 |
0 |
System.out.println("Executing script " + groovyscript); |
688 |
0 |
executeGroovyScript(groovyscript, af); |
689 |
0 |
System.out.println("CMD groovy[" + groovyscript |
690 |
|
+ "] executed successfully!"); |
691 |
0 |
groovyscript = null; |
692 |
|
} |
693 |
0 |
String imageName = "unnamed.png"; |
694 |
0 |
while (aparser.getSize() > 1) |
695 |
|
{ |
696 |
0 |
String outputFormat = aparser.nextValue(); |
697 |
0 |
file = aparser.nextValue(); |
698 |
|
|
699 |
0 |
if (outputFormat.equalsIgnoreCase("png")) |
700 |
|
{ |
701 |
0 |
af.createPNG(new File(file)); |
702 |
0 |
imageName = (new File(file)).getName(); |
703 |
0 |
System.out.println("Creating PNG image: " + file); |
704 |
0 |
continue; |
705 |
|
} |
706 |
0 |
else if (outputFormat.equalsIgnoreCase("svg")) |
707 |
|
{ |
708 |
0 |
File imageFile = new File(file); |
709 |
0 |
imageName = imageFile.getName(); |
710 |
0 |
af.createSVG(imageFile); |
711 |
0 |
System.out.println("Creating SVG image: " + file); |
712 |
0 |
continue; |
713 |
|
} |
714 |
0 |
else if (outputFormat.equalsIgnoreCase("html")) |
715 |
|
{ |
716 |
0 |
File imageFile = new File(file); |
717 |
0 |
imageName = imageFile.getName(); |
718 |
0 |
HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel); |
719 |
0 |
htmlSVG.exportHTML(file); |
720 |
|
|
721 |
0 |
System.out.println("Creating HTML image: " + file); |
722 |
0 |
continue; |
723 |
|
} |
724 |
0 |
else if (outputFormat.equalsIgnoreCase("biojsmsa")) |
725 |
|
{ |
726 |
0 |
if (file == null) |
727 |
|
{ |
728 |
0 |
System.err.println("The output html file must not be null"); |
729 |
0 |
return; |
730 |
|
} |
731 |
0 |
try |
732 |
|
{ |
733 |
0 |
BioJsHTMLOutput.refreshVersionInfo( |
734 |
|
BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY); |
735 |
|
} catch (URISyntaxException e) |
736 |
|
{ |
737 |
0 |
e.printStackTrace(); |
738 |
|
} |
739 |
0 |
BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel); |
740 |
0 |
bjs.exportHTML(file); |
741 |
0 |
System.out |
742 |
|
.println("Creating BioJS MSA Viwer HTML file: " + file); |
743 |
0 |
continue; |
744 |
|
} |
745 |
0 |
else if (outputFormat.equalsIgnoreCase("imgMap")) |
746 |
|
{ |
747 |
0 |
af.createImageMap(new File(file), imageName); |
748 |
0 |
System.out.println("Creating image map: " + file); |
749 |
0 |
continue; |
750 |
|
} |
751 |
0 |
else if (outputFormat.equalsIgnoreCase("eps")) |
752 |
|
{ |
753 |
0 |
File outputFile = new File(file); |
754 |
0 |
System.out.println( |
755 |
|
"Creating EPS file: " + outputFile.getAbsolutePath()); |
756 |
0 |
af.createEPS(outputFile); |
757 |
0 |
continue; |
758 |
|
} |
759 |
|
|
760 |
0 |
af.saveAlignment(file, format); |
761 |
0 |
if (af.isSaveAlignmentSuccessful()) |
762 |
|
{ |
763 |
0 |
System.out.println("Written alignment in " + format |
764 |
|
+ " format to " + file); |
765 |
|
} |
766 |
|
else |
767 |
|
{ |
768 |
0 |
System.out.println("Error writing file " + file + " in " |
769 |
|
+ format + " format!!"); |
770 |
|
} |
771 |
|
|
772 |
|
} |
773 |
|
|
774 |
0 |
while (aparser.getSize() > 0) |
775 |
|
{ |
776 |
0 |
System.out.println("Unknown arg: " + aparser.nextValue()); |
777 |
|
} |
778 |
|
} |
779 |
|
} |
780 |
11 |
AlignFrame startUpAlframe = null; |
781 |
|
|
782 |
|
|
783 |
|
|
784 |
|
|
785 |
11 |
if ( |
786 |
11 |
!headless && file == null && vamsasImport == null |
787 |
|
&& jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true)) |
788 |
|
{ |
789 |
4 |
file = jalview.bin.Cache.getDefault("STARTUP_FILE", |
790 |
|
jalview.bin.Cache.getDefault("www.jalview.org", |
791 |
|
"http://www.jalview.org") |
792 |
|
+ "/examples/exampleFile_2_7.jar"); |
793 |
4 |
if (file.equals( |
794 |
|
"http://www.jalview.org/examples/exampleFile_2_3.jar")) |
795 |
|
{ |
796 |
|
|
797 |
0 |
file.replace("_2_3.jar", "_2_7.jar"); |
798 |
|
|
799 |
0 |
jalview.bin.Cache.removeProperty("STARTUP_FILE"); |
800 |
|
} |
801 |
|
|
802 |
4 |
protocol = DataSourceType.FILE; |
803 |
|
|
804 |
4 |
if (file.indexOf("http:") > -1) |
805 |
|
{ |
806 |
4 |
protocol = DataSourceType.URL; |
807 |
|
} |
808 |
|
|
809 |
4 |
if (file.endsWith(".jar")) |
810 |
|
{ |
811 |
4 |
format = FileFormat.Jalview; |
812 |
|
} |
813 |
|
else |
814 |
|
{ |
815 |
0 |
try |
816 |
|
{ |
817 |
0 |
format = new IdentifyFile().identify(file, protocol); |
818 |
|
} catch (FileFormatException e) |
819 |
|
{ |
820 |
|
|
821 |
|
} |
822 |
|
} |
823 |
|
|
824 |
4 |
startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol, |
825 |
|
format); |
826 |
4 |
getFeatures = checkDasArguments(aparser); |
827 |
|
|
828 |
|
} |
829 |
|
|
830 |
|
|
831 |
|
|
832 |
|
|
833 |
11 |
if (getFeatures != null) |
834 |
|
{ |
835 |
0 |
if (startUpAlframe != null) |
836 |
|
{ |
837 |
0 |
startFeatureFetching(getFeatures); |
838 |
|
} |
839 |
|
} |
840 |
|
|
841 |
11 |
if (groovyscript != null) |
842 |
|
{ |
843 |
0 |
if (Cache.groovyJarsPresent()) |
844 |
|
{ |
845 |
0 |
System.out.println("Executing script " + groovyscript); |
846 |
0 |
executeGroovyScript(groovyscript, startUpAlframe); |
847 |
|
} |
848 |
|
else |
849 |
|
{ |
850 |
0 |
System.err.println( |
851 |
|
"Sorry. Groovy Support is not available, so ignoring the provided groovy script " |
852 |
|
+ groovyscript); |
853 |
|
} |
854 |
|
} |
855 |
|
|
856 |
11 |
if (desktop != null) |
857 |
|
{ |
858 |
11 |
if (progress != -1) |
859 |
|
{ |
860 |
0 |
desktop.setProgressBar(null, progress); |
861 |
|
} |
862 |
11 |
desktop.setInBatchMode(false); |
863 |
|
} |
864 |
|
} |
865 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
866 |
0 |
private static void showUsage()... |
867 |
|
{ |
868 |
0 |
System.out.println( |
869 |
|
"Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n" |
870 |
|
+ "-nodisplay\tRun Jalview without User Interface.\n" |
871 |
|
+ "-props FILE\tUse the given Jalview properties file instead of users default.\n" |
872 |
|
+ "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n" |
873 |
|
+ "-annotations FILE\tAdd precalculated annotations to the alignment.\n" |
874 |
|
+ "-tree FILE\tLoad the given newick format tree file onto the alignment\n" |
875 |
|
+ "-features FILE\tUse the given file to mark features on the alignment.\n" |
876 |
|
+ "-fasta FILE\tCreate alignment file FILE in Fasta format.\n" |
877 |
|
+ "-clustal FILE\tCreate alignment file FILE in Clustal format.\n" |
878 |
|
+ "-pfam FILE\tCreate alignment file FILE in PFAM format.\n" |
879 |
|
+ "-msf FILE\tCreate alignment file FILE in MSF format.\n" |
880 |
|
+ "-pileup FILE\tCreate alignment file FILE in Pileup format\n" |
881 |
|
+ "-pir FILE\tCreate alignment file FILE in PIR format.\n" |
882 |
|
+ "-blc FILE\tCreate alignment file FILE in BLC format.\n" |
883 |
|
+ "-json FILE\tCreate alignment file FILE in JSON format.\n" |
884 |
|
+ "-jalview FILE\tCreate alignment file FILE in Jalview format.\n" |
885 |
|
+ "-png FILE\tCreate PNG image FILE from alignment.\n" |
886 |
|
+ "-svg FILE\tCreate SVG image FILE from alignment.\n" |
887 |
|
+ "-html FILE\tCreate HTML file from alignment.\n" |
888 |
|
+ "-biojsMSA FILE\tCreate BioJS MSA Viewer HTML file from alignment.\n" |
889 |
|
+ "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n" |
890 |
|
+ "-eps FILE\tCreate EPS file FILE from alignment.\n" |
891 |
|
+ "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n" |
892 |
|
+ "-noquestionnaire\tTurn off questionnaire check.\n" |
893 |
|
+ "-nonews\tTurn off check for Jalview news.\n" |
894 |
|
+ "-nousagestats\tTurn off google analytics tracking for this session.\n" |
895 |
|
+ "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n" |
896 |
|
|
897 |
|
|
898 |
|
|
899 |
|
|
900 |
|
|
901 |
|
+ "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n" |
902 |
|
+ "-dasserver nickname=URL\tAdd and enable a das server with given nickname\n\t\t\t(alphanumeric or underscores only) for retrieval of features for all alignments.\n" |
903 |
|
+ "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n" |
904 |
|
+ "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n" |
905 |
|
+ "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n" |
906 |
|
|
907 |
|
|
908 |
|
|
909 |
|
|
910 |
|
+ "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n" |
911 |
|
+ "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n"); |
912 |
|
} |
913 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
914 |
11 |
private static void startUsageStats(final Desktop desktop)... |
915 |
|
{ |
916 |
|
|
917 |
|
|
918 |
|
|
919 |
11 |
PromptUserConfig prompter = new PromptUserConfig(Desktop.desktop, |
920 |
|
"USAGESTATS", "Jalview Usage Statistics", |
921 |
|
"Do you want to help make Jalview better by enabling " |
922 |
|
+ "the collection of usage statistics with Google Analytics ?" |
923 |
|
+ "\n\n(you can enable or disable usage tracking in the preferences)", |
924 |
|
new Runnable() |
925 |
|
{ |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
926 |
0 |
@Override... |
927 |
|
public void run() |
928 |
|
{ |
929 |
0 |
Cache.log.debug( |
930 |
|
"Initialising googletracker for usage stats."); |
931 |
0 |
Cache.initGoogleTracker(); |
932 |
0 |
Cache.log.debug("Tracking enabled."); |
933 |
|
} |
934 |
|
}, new Runnable() |
935 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
936 |
2 |
@Override... |
937 |
|
public void run() |
938 |
|
{ |
939 |
2 |
Cache.log.debug("Not enabling Google Tracking."); |
940 |
|
} |
941 |
|
}, null, true); |
942 |
11 |
desktop.addDialogThread(prompter); |
943 |
|
} |
944 |
|
|
945 |
|
|
946 |
|
|
947 |
|
|
948 |
|
@param |
949 |
|
|
950 |
|
@param |
951 |
|
|
952 |
|
|
953 |
|
|
|
|
| 0% |
Uncovered Elements: 65 (65) |
Complexity: 14 |
Complexity Density: 0.29 |
|
954 |
0 |
private void executeGroovyScript(String groovyscript, AlignFrame af)... |
955 |
|
{ |
956 |
|
|
957 |
|
|
958 |
|
|
959 |
0 |
File tfile = null; |
960 |
|
|
961 |
|
|
962 |
|
|
963 |
0 |
URL sfile = null; |
964 |
0 |
if (groovyscript.trim().equals("STDIN")) |
965 |
|
{ |
966 |
|
|
967 |
0 |
try |
968 |
|
{ |
969 |
0 |
tfile = File.createTempFile("jalview", "groovy"); |
970 |
0 |
PrintWriter outfile = new PrintWriter( |
971 |
|
new OutputStreamWriter(new FileOutputStream(tfile))); |
972 |
0 |
BufferedReader br = new BufferedReader( |
973 |
|
new InputStreamReader(System.in)); |
974 |
0 |
String line = null; |
975 |
0 |
while ((line = br.readLine()) != null) |
976 |
|
{ |
977 |
0 |
outfile.write(line + "\n"); |
978 |
|
} |
979 |
0 |
br.close(); |
980 |
0 |
outfile.flush(); |
981 |
0 |
outfile.close(); |
982 |
|
|
983 |
|
} catch (Exception ex) |
984 |
|
{ |
985 |
0 |
System.err.println("Failed to read from STDIN into tempfile " |
986 |
0 |
+ ((tfile == null) ? "(tempfile wasn't created)" |
987 |
|
: tfile.toString())); |
988 |
0 |
ex.printStackTrace(); |
989 |
0 |
return; |
990 |
|
} |
991 |
0 |
try |
992 |
|
{ |
993 |
0 |
sfile = tfile.toURI().toURL(); |
994 |
|
} catch (Exception x) |
995 |
|
{ |
996 |
0 |
System.err.println( |
997 |
|
"Unexpected Malformed URL Exception for temporary file created from STDIN: " |
998 |
|
+ tfile.toURI()); |
999 |
0 |
x.printStackTrace(); |
1000 |
0 |
return; |
1001 |
|
} |
1002 |
|
} |
1003 |
|
else |
1004 |
|
{ |
1005 |
0 |
try |
1006 |
|
{ |
1007 |
0 |
sfile = new URI(groovyscript).toURL(); |
1008 |
|
} catch (Exception x) |
1009 |
|
{ |
1010 |
0 |
tfile = new File(groovyscript); |
1011 |
0 |
if (!tfile.exists()) |
1012 |
|
{ |
1013 |
0 |
System.err.println("File '" + groovyscript + "' does not exist."); |
1014 |
0 |
return; |
1015 |
|
} |
1016 |
0 |
if (!tfile.canRead()) |
1017 |
|
{ |
1018 |
0 |
System.err.println("File '" + groovyscript + "' cannot be read."); |
1019 |
0 |
return; |
1020 |
|
} |
1021 |
0 |
if (tfile.length() < 1) |
1022 |
|
{ |
1023 |
0 |
System.err.println("File '" + groovyscript + "' is empty."); |
1024 |
0 |
return; |
1025 |
|
} |
1026 |
0 |
try |
1027 |
|
{ |
1028 |
0 |
sfile = tfile.getAbsoluteFile().toURI().toURL(); |
1029 |
|
} catch (Exception ex) |
1030 |
|
{ |
1031 |
0 |
System.err.println("Failed to create a file URL for " |
1032 |
|
+ tfile.getAbsoluteFile()); |
1033 |
0 |
return; |
1034 |
|
} |
1035 |
|
} |
1036 |
|
} |
1037 |
0 |
try |
1038 |
|
{ |
1039 |
0 |
Map<String, Object> vbinding = new HashMap<>(); |
1040 |
0 |
vbinding.put("Jalview", this); |
1041 |
0 |
if (af != null) |
1042 |
|
{ |
1043 |
0 |
vbinding.put("currentAlFrame", af); |
1044 |
|
} |
1045 |
0 |
Binding gbinding = new Binding(vbinding); |
1046 |
0 |
GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile }); |
1047 |
0 |
gse.run(sfile.toString(), gbinding); |
1048 |
0 |
if ("STDIN".equals(groovyscript)) |
1049 |
|
{ |
1050 |
|
|
1051 |
|
|
1052 |
0 |
tfile.delete(); |
1053 |
|
} |
1054 |
|
} catch (Exception e) |
1055 |
|
{ |
1056 |
0 |
System.err.println("Exception Whilst trying to execute file " + sfile |
1057 |
|
+ " as a groovy script."); |
1058 |
0 |
e.printStackTrace(System.err); |
1059 |
|
|
1060 |
|
} |
1061 |
|
} |
1062 |
|
|
1063 |
|
|
1064 |
|
|
1065 |
|
|
1066 |
|
@return |
1067 |
|
|
|
|
| 16.3% |
Uncovered Elements: 41 (49) |
Complexity: 13 |
Complexity Density: 0.42 |
|
1068 |
4 |
private static Vector<String> checkDasArguments(ArgsParser aparser)... |
1069 |
|
{ |
1070 |
4 |
Vector<String> source = null; |
1071 |
4 |
String data; |
1072 |
4 |
String locsources = Cache.getProperty(Cache.DAS_LOCAL_SOURCE); |
1073 |
? |
while ((data = aparser.getValue("dasserver", true)) != null) |
1074 |
|
{ |
1075 |
0 |
String nickname = null; |
1076 |
0 |
String url = null; |
1077 |
0 |
int pos = data.indexOf('='); |
1078 |
|
|
1079 |
0 |
if (pos > 0) |
1080 |
|
{ |
1081 |
0 |
nickname = data.substring(0, pos); |
1082 |
|
} |
1083 |
0 |
url = data.substring(pos + 1); |
1084 |
0 |
if (url != null && (url.startsWith("http:") |
1085 |
|
|| url.startsWith("sequence:http:"))) |
1086 |
|
{ |
1087 |
0 |
if (nickname == null) |
1088 |
|
{ |
1089 |
0 |
nickname = url; |
1090 |
|
} |
1091 |
0 |
if (locsources == null) |
1092 |
|
{ |
1093 |
0 |
locsources = ""; |
1094 |
|
} |
1095 |
|
else |
1096 |
|
{ |
1097 |
0 |
locsources += "\t"; |
1098 |
|
} |
1099 |
0 |
locsources = locsources + nickname + "|" + url; |
1100 |
0 |
System.err.println( |
1101 |
|
"NOTE! dasserver parameter not yet really supported (got args of " |
1102 |
|
+ nickname + "|" + url); |
1103 |
0 |
if (source == null) |
1104 |
|
{ |
1105 |
0 |
source = new Vector<>(); |
1106 |
|
} |
1107 |
0 |
source.addElement(nickname); |
1108 |
|
} |
1109 |
0 |
System.out.println( |
1110 |
|
"CMD [-dasserver " + data + "] executed successfully!"); |
1111 |
|
} |
1112 |
4 |
if (locsources != null && locsources.indexOf('|') > -1) |
1113 |
|
{ |
1114 |
0 |
Cache.log.debug("Setting local source list in properties file to:\n" |
1115 |
|
+ locsources); |
1116 |
0 |
Cache.setProperty(Cache.DAS_LOCAL_SOURCE, locsources); |
1117 |
|
} |
1118 |
? |
while ((data = aparser.getValue("fetchfrom", true)) != null) |
1119 |
|
{ |
1120 |
0 |
System.out.println("adding source '" + data + "'"); |
1121 |
0 |
if (source == null) |
1122 |
|
{ |
1123 |
0 |
source = new Vector<>(); |
1124 |
|
} |
1125 |
0 |
source.addElement(data); |
1126 |
|
} |
1127 |
4 |
return source; |
1128 |
|
} |
1129 |
|
|
1130 |
|
|
1131 |
|
|
1132 |
|
|
1133 |
|
@param |
1134 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 4 |
Complexity Density: 0.57 |
|
1135 |
0 |
private FeatureFetcher startFeatureFetching(... |
1136 |
|
final Vector<String> dasSources) |
1137 |
|
{ |
1138 |
0 |
FeatureFetcher ff = new FeatureFetcher(); |
1139 |
0 |
AlignFrame afs[] = Desktop.getAlignFrames(); |
1140 |
0 |
if (afs == null || afs.length == 0) |
1141 |
|
{ |
1142 |
0 |
return null; |
1143 |
|
} |
1144 |
0 |
for (int i = 0; i < afs.length; i++) |
1145 |
|
{ |
1146 |
0 |
ff.addFetcher(afs[i], dasSources); |
1147 |
|
} |
1148 |
0 |
return ff; |
1149 |
|
} |
1150 |
|
|
|
|
| 66.7% |
Uncovered Elements: 2 (6) |
Complexity: 3 |
Complexity Density: 0.75 |
|
1151 |
298 |
public static boolean isHeadlessMode()... |
1152 |
|
{ |
1153 |
298 |
String isheadless = System.getProperty("java.awt.headless"); |
1154 |
298 |
if (isheadless != null && isheadless.equalsIgnoreCase("true")) |
1155 |
|
{ |
1156 |
0 |
return true; |
1157 |
|
} |
1158 |
298 |
return false; |
1159 |
|
} |
1160 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
1161 |
0 |
public AlignFrame[] getAlignFrames()... |
1162 |
|
{ |
1163 |
0 |
return desktop == null ? new AlignFrame[] { getCurrentAlignFrame() } |
1164 |
|
: Desktop.getAlignFrames(); |
1165 |
|
|
1166 |
|
} |
1167 |
|
|
1168 |
|
|
1169 |
|
|
1170 |
|
|
1171 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
1172 |
0 |
public void quit()... |
1173 |
|
{ |
1174 |
0 |
if (desktop != null) |
1175 |
|
{ |
1176 |
0 |
desktop.quit(); |
1177 |
|
} |
1178 |
|
else |
1179 |
|
{ |
1180 |
0 |
System.exit(0); |
1181 |
|
} |
1182 |
|
} |
1183 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1184 |
0 |
public static AlignFrame getCurrentAlignFrame()... |
1185 |
|
{ |
1186 |
0 |
return Jalview.currentAlignFrame; |
1187 |
|
} |
1188 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1189 |
341 |
public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)... |
1190 |
|
{ |
1191 |
341 |
Jalview.currentAlignFrame = currentAlignFrame; |
1192 |
|
} |
1193 |
|
} |