2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import java.awt.image.BufferedImage;
25 import java.io.IOException;
26 import java.nio.file.Files;
27 import java.util.Date;
28 import java.util.HashSet;
31 import javax.imageio.ImageIO;
32 import javax.swing.SwingUtilities;
34 import org.testng.Assert;
35 import org.testng.annotations.AfterClass;
36 import org.testng.annotations.AfterMethod;
37 import org.testng.annotations.BeforeClass;
38 import org.testng.annotations.DataProvider;
39 import org.testng.annotations.Test;
41 import jalview.gui.AlignFrame;
42 import jalview.gui.Desktop;
43 import jalview.gui.JvOptionPane;
44 import jalview.util.ArrayUtils;
46 public class CommandsTest
48 private static final String testfiles = "test/jalview/bin/argparser/testfiles";
50 @BeforeClass(alwaysRun = true)
51 public static void setUpBeforeClass() throws Exception
53 Cache.loadProperties("test/jalview/gui/quitProps.jvprops");
54 Date oneHourFromNow = new Date(
55 System.currentTimeMillis() + 3600 * 1000);
56 Cache.setDateProperty("JALVIEW_NEWS_RSS_LASTMODIFIED", oneHourFromNow);
59 @AfterClass(alwaysRun = true)
60 public static void resetProps()
62 Cache.loadProperties("test/jalview/testProps.jvprops");
65 @BeforeClass(alwaysRun = true)
66 public void setUpJvOptionPane()
68 JvOptionPane.setInteractiveMode(false);
69 JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
72 @AfterMethod(alwaysRun = true)
73 public void tearDown()
77 // occasionally we are blocked by Jmol redraws
78 SwingUtilities.invokeAndWait(new Runnable()
84 Desktop.closeDesktop();
87 } catch (Exception foo)
89 System.err.println("Failed during teardown with exception");
90 foo.printStackTrace();
95 public static void callJalviewMain(String[] args)
97 callJalviewMain(args, false);
100 public static void callJalviewMain(String[] args, boolean newJalview)
102 if (Jalview.getInstance() != null && !newJalview)
104 Jalview.getInstance().doMain(args);
112 /* --setprops is currently disabled so this test won't work
113 @Test(groups = "Functional")
114 public void setpropsTest()
116 final String MOSTLY_HARMLESS = "MOSTLY_HARMLESS";
117 String cmdLine = "--setprop=" + MOSTLY_HARMLESS + "=Earth";
118 String[] args = cmdLine.split("\\s+");
120 Assert.assertEquals(Cache.getDefault(MOSTLY_HARMLESS, "Magrathea"),
127 { "Functional", "testTask3" },
128 dataProvider = "cmdLines",
129 singleThreaded = true)
131 public void commandsOpenTest(String cmdLine, boolean cmdArgs,
132 int numFrames, String[] sequences)
136 String[] args = (cmdLine + " --gui").split("\\s+");
137 callJalviewMain(args);
138 Commands cmds = Jalview.getInstance().getCommands();
139 Assert.assertNotNull(cmds);
140 Assert.assertEquals(cmds.commandArgsProvided(), cmdArgs,
141 "Commands were not provided in the args");
142 Assert.assertEquals(cmds.argsWereParsed(), cmdArgs,
143 "Overall command parse and operation is false");
145 Assert.assertEquals(Desktop.getDesktopAlignFrames().length, numFrames,
146 "Wrong number of AlignFrames");
148 if (sequences != null)
150 Set<String> openedSequenceNames = new HashSet<>();
151 AlignFrame[] afs = Desktop.getDesktopAlignFrames();
152 for (AlignFrame af : afs)
154 openedSequenceNames.addAll(
155 af.getViewport().getAlignment().getSequenceNames());
157 for (String sequence : sequences)
159 Assert.assertTrue(openedSequenceNames.contains(sequence),
160 "Sequence '" + sequence
161 + "' was not found in opened alignment files: "
162 + cmdLine + ".\nOpened sequence names are:\n"
163 + String.join("\n", openedSequenceNames));
168 lookForSequenceName("THIS_SEQUENCE_ID_DOESN'T_EXIST"));
169 } catch (Exception x)
171 Assert.fail("Unexpected exception during commandsOpenTest", x);
181 { "Functional", "testTask3" },
182 dataProvider = "structureImageOutputFiles",
183 singleThreaded = true)
184 public void structureImageOutputTest(String cmdLine, String[] filenames)
187 cleanupFiles(filenames);
188 String[] args = (cmdLine + "").split("\\s+");
191 callJalviewMain(args);
192 Commands cmds = Jalview.getInstance().getCommands();
193 Assert.assertNotNull(cmds);
194 verifyIncreasingSize(cmdLine, filenames);
195 } catch (Exception x)
197 Assert.fail("Unexpected exception during structureImageOutputTest",
201 // cleanupFiles(filenames);
207 * given two command lines, compare the output files produced - they should
208 * exist and be equal in size
212 { "Functional", "testTask3" },
213 dataProvider = "compareHeadlessAndGUIOps",
214 singleThreaded = true)
215 public void headlessOrGuiImageOutputTest(String[] cmdLines,
216 String[] filenames) throws IOException
218 cleanupFiles(filenames);
221 for (String cmdLine : cmdLines)
223 CommandLineOperations.Worker runner = CommandLineOperations
224 .getJalviewDesktopRunner(false, cmdLine, 1000);
225 long timeOut = 10000;
226 while (runner.isAlive() && timeOut > 0)
233 * larger margin between IDs and alignment/annotations when in --gui mode
235 verifyOrderedFileSet(cmdLines[0] + " vs " + cmdLines[1], filenames, false);
238 verifySimilarEnoughImages(cmdLines[0] + " vs " + cmdLines[1],
239 filenames, 0.6f, 0f);
240 } catch (Exception x)
242 Assert.fail("Unexpected exception during structureImageOutputTest",
246 cleanupFiles(filenames);
251 @DataProvider(name = "compareHeadlessAndGUIOps")
252 public Object[][] compareHeadlessAndGUIOps()
254 return new Object[][] {
256 { new String[] { "--open examples/uniref50.fa "
257 + "--structure [seqid=FER1_SPIOL,tempfac=plddt,showssannotations,structureviewer=jmol]"
258 + "examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
259 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json --image="
261 + "test-al-pae-ss-gui.png --overwrite --gui --quit",
262 "--open examples/uniref50.fa "
263 + "--structure [seqid=FER1_SPIOL,tempfac=plddt,showssannotations,structureviewer=jmol]"
264 + "examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
265 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json --image="
267 + "test-al-pae-ss-nogui.png --overwrite --nogui" },
269 { testfiles + "/test-al-pae-ss-gui.png",
270 testfiles + "/test-al-pae-ss-nogui.png", } } };
273 private static void verifyIncreasingSize(String cmdLine,
274 String[] filenames) throws Exception
276 verifyOrderedFileSet(cmdLine, filenames, true);
279 private static void verifyOrderedFileSet(String cmdLine,
280 String[] filenames, boolean increasingSize) throws Exception
282 File lastFile = null;
283 for (String filename : filenames)
285 File file = new File(filename);
286 Assert.assertTrue(file.exists(), "File '" + filename
287 + "' was not created by '" + cmdLine + "'");
288 Assert.assertTrue(file.isFile(), "File '" + filename
289 + "' is not a file from '" + cmdLine + "'");
290 Assert.assertTrue(Files.size(file.toPath()) > 0, "File '" + filename
291 + "' has no content from '" + cmdLine + "'");
292 // make sure the successive output files get bigger!
293 if (lastFile != null)
295 waitForLastWrite(file, 25);
300 Files.size(file.toPath()) > Files.size(lastFile.toPath()),
301 "Expected " + file.toPath() + " to be larger than "
302 + lastFile.toPath());
306 Assert.assertEquals(Files.size(file.toPath()),
307 Files.size(lastFile.toPath()),
308 "New file " + file.toPath()
309 + " (actual size) not same as last file's size "
310 + lastFile.toString());
313 // remember it for next file
319 private static void verifySimilarEnoughImages(String cmdLine,
320 String[] filenames, float w_tolerance_pc, float h_tolerance_pc)
327 for (String filename : filenames)
329 File file = new File(filename);
330 Assert.assertTrue(file.exists(), "File '" + filename
331 + "' was not created by '" + cmdLine + "'");
332 Assert.assertTrue(file.isFile(), "File '" + filename
333 + "' is not a file from '" + cmdLine + "'");
334 Assert.assertTrue(Files.size(file.toPath()) > 0, "File '" + filename
335 + "' has no content from '" + cmdLine + "'");
337 BufferedImage img = ImageIO.read(file);
338 if (img.getWidth() < min_w || min_w == -1)
340 min_w = img.getWidth();
342 if (img.getWidth() > max_w || max_w == -1)
344 max_w = img.getWidth();
346 if (img.getHeight() < min_h || min_h == -1)
348 min_h = img.getHeight();
350 if (img.getHeight() > max_h || max_h == -1)
352 max_h = img.getHeight();
355 Assert.assertTrue(min_w > 0,
356 "Minimum width is not positive (" + min_w + ")");
357 Assert.assertTrue(max_w > 0,
358 "Maximum width is not positive (" + max_w + ")");
359 Assert.assertTrue(min_h > 0,
360 "Minimum height is not positive (" + min_h + ")");
361 Assert.assertTrue(max_h > 0,
362 "Maximum height is not positive (" + max_h + ")");
364 Assert.assertTrue(100 * (max_w - min_w) / min_w < w_tolerance_pc,
365 "Width variation (" + (max_w - min_w)
366 + " not within tolerance of minimum width (" + min_w
370 System.out.println("Widths within tolerance (" + w_tolerance_pc
371 + "%), min_w=" + min_w + " < max_w=" + max_w);
373 Assert.assertTrue(100 * (max_h - min_h) / min_h < w_tolerance_pc,
374 "Height variation (" + (max_h - min_h)
375 + " not within tolerance of minimum height (" + min_h
379 System.out.println("Heights within tolerance (" + h_tolerance_pc
380 + "%), min_h=" + min_h + " < max_h=" + max_h);
384 private static long waitForLastWrite(File file, int i) throws IOException
386 long lastSize, stableSize = Files.size(file.toPath());
387 // wait around until we are sure the file has been completely written.
390 lastSize = stableSize;
394 } catch (Exception x)
397 stableSize = Files.size(file.toPath());
398 } while (stableSize != lastSize);
403 groups = "Functional",
404 dataProvider = "argfileOutputFiles",
405 singleThreaded = true)
407 public void argFilesGlobAndSubstitutionsTest(String cmdLine,
408 String[] filenames) throws IOException
410 cleanupFiles(filenames);
411 String[] args = (cmdLine + " --gui").split("\\s+");
414 callJalviewMain(args);
415 Commands cmds = Jalview.getInstance().getCommands();
416 Assert.assertNotNull(cmds);
417 File lastFile = null;
418 for (String filename : filenames)
420 File file = new File(filename);
421 Assert.assertTrue(file.exists(), "File '" + filename
422 + "' was not created by '" + cmdLine + "'");
423 Assert.assertTrue(file.isFile(), "File '" + filename
424 + "' is not a file from '" + cmdLine + "'");
425 Assert.assertTrue(Files.size(file.toPath()) > 0, "File '" + filename
426 + "' has no content from '" + cmdLine + "'");
427 // make sure the successive output files get bigger!
428 if (lastFile != null)
430 Assert.assertTrue(Files.size(file.toPath()) > Files
431 .size(lastFile.toPath()));
432 System.out.println("this file: " + file + " +"
433 + Files.size(file.toPath()) + " greater than "
434 + Files.size(lastFile.toPath()));
436 // remember it for next file
439 } catch (Exception x)
442 "Unexpected exception during argFilesGlobAndSubstitutions",
446 cleanupFiles(filenames);
451 @DataProvider(name = "structureImageOutputFiles")
452 public Object[][] structureImageOutputFiles()
454 return new Object[][] {
457 { "--gui --nonews --nosplash --open=./examples/test_fab41.result/sample.a2m "
458 + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
459 + "--structureimage=" + testfiles + "/structureimage1.png "
460 + "--open=./examples/test_fab41.result/sample.a2m "
461 + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
462 + "--structureimage=" + testfiles
463 + "/structureimage2.png --scale=1.5 "
464 + "--open=./examples/test_fab41.result/sample.a2m "
465 + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
466 + "--structureimage=" + testfiles
467 + "/structureimage3.png --scale=2.0 ",
469 { testfiles + "/structureimage1.png",
470 testfiles + "/structureimage2.png",
471 testfiles + "/structureimage3.png" } },
472 { "--headless --noquit --open=./examples/test_fab41.result/sample.a2m "
473 + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
474 + "--structureimage=" + testfiles + "/structureimage1.png "
475 + "--open=./examples/test_fab41.result/sample.a2m "
476 + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
477 + "--structureimage=" + testfiles
478 + "/structureimage2.png --scale=1.5 "
479 + "--open=./examples/test_fab41.result/sample.a2m "
480 + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
481 + "--structureimage=" + testfiles
482 + "/structureimage3.png --scale=2.0 ",
484 { testfiles + "/structureimage1.png",
485 testfiles + "/structureimage2.png",
486 testfiles + "/structureimage3.png" } },
488 { "--gui --nonews --nosplash --open examples/1gaq.txt --append ./examples/3W5V.pdb "
489 + "--structure examples/1gaq.txt --seqid \"1GAQ|A\" "
490 + "--structureimage " + testfiles
491 + "/1gaq.png --structure examples/3W5V.pdb "
492 + "--seqid \"3W5V|A\" --structureimage " + testfiles
493 + "/3w5v.png --overwrite",
496 { testfiles + "/1gaq.png", testfiles + "/3w5v.png" } },
498 { "--headless --noquit --open ./examples/1gaq.txt --append ./examples/3W5V.pdb "
499 + "--structure examples/1gaq.txt --seqid \"1GAQ|A\" "
500 + "--structureimage " + testfiles
501 + "/1gaq.png --structure examples/3W5V.pdb "
502 + "--seqid \"3W5V|A\" --structureimage " + testfiles
503 + "/3w5v.png --overwrite",
506 { testfiles + "/1gaq.png", testfiles + "/3w5v.png" } }
513 @DataProvider(name = "argfileOutputFiles")
514 public Object[][] argfileOutputFiles()
516 return new Object[][] {
518 { "--gui --argfile=" + testfiles + "/**/*.txt", new String[]
519 { testfiles + "/dir1/test1.png", testfiles + "/dir2/test1.png",
520 testfiles + "/dir3/subdir/test0.png" } },
521 { "--gui --argfile=" + testfiles + "/**/argfile.txt", new String[]
522 { testfiles + "/dir1/test1.png", testfiles + "/dir2/test1.png" } },
523 { "--gui --argfile=" + testfiles + "/dir*/argfile.txt", new String[]
524 { testfiles + "/dir1/test1.png", testfiles + "/dir2/test1.png" } },
525 { "--gui --initsubstitutions --append examples/uniref50.fa --image "
526 + testfiles + "/{basename}.png",
528 { testfiles + "/uniref50.png" } },
529 { "--gui --append examples/uniref50.fa --nosubstitutions --image "
530 + testfiles + "/{basename}.png",
532 { testfiles + "/{basename}.png" } }
538 @DataProvider(name = "cmdLines")
539 public Object[][] cmdLines()
541 String[] someUniref50Seqs = new String[] { "FER_CAPAA", "FER_CAPAN",
542 "FER1_MAIZE", "FER1_SPIOL", "O80429_MAIZE" };
543 String[] t1 = new String[] { "TEST1" };
544 String[] t2 = new String[] { "TEST2" };
545 String[] t3 = new String[] { "TEST3" };
546 return new Object[][] {
549 { "--append=examples/uniref50.fa", true, 1, someUniref50Seqs },
550 { "--append examples/uniref50.fa", true, 1, someUniref50Seqs },
551 { "--append=examples/uniref50*.fa", true, 1, someUniref50Seqs },
552 // NOTE we cannot use shell expansion in tests, so list all files!
553 { "--append examples/uniref50.fa examples/uniref50_mz.fa", true, 1,
555 { "--append=[new]examples/uniref50*.fa", true, 2,
557 { "--open=examples/uniref50*.fa", true, 2, someUniref50Seqs },
558 { "examples/uniref50.fa", true, 1, someUniref50Seqs },
559 { "examples/uniref50.fa " + testfiles + "/test1.fa", true, 2,
560 ArrayUtils.concatArrays(someUniref50Seqs, t1) },
561 { "examples/uniref50.fa " + testfiles + "/test1.fa", true, 2, t1 },
562 { "--gui --argfile=" + testfiles + "/argfile0.txt", true, 1,
563 ArrayUtils.concatArrays(t1, t3) },
564 { "--gui --argfile=" + testfiles + "/argfile*.txt", true, 5,
565 ArrayUtils.concatArrays(t1, t2, t3) },
566 { "--gui --argfile=" + testfiles + "/argfile.autocounter", true, 3,
567 ArrayUtils.concatArrays(t1, t2) } };
571 public static boolean lookForSequenceName(String sequenceName)
573 AlignFrame[] afs = Desktop.getDesktopAlignFrames();
574 for (AlignFrame af : afs)
576 for (String name : af.getViewport().getAlignment().getSequenceNames())
578 if (sequenceName.equals(name))
587 public static void cleanupFiles(String[] filenames)
589 for (String filename : filenames)
591 File file = new File(filename);
599 private final String deleteDir = "test/deleteAfter";
602 groups = "Functional",
603 dataProvider = "allLinkedIdsData",
604 singleThreaded = true)
605 public void allLinkedIdsTest(String cmdLine, String[] filenames,
606 String[] nonfilenames)
608 String[] args = (cmdLine + " --gui").split("\\s+");
609 callJalviewMain(args);
610 Commands cmds = Jalview.getInstance().getCommands();
611 Assert.assertNotNull(cmds);
612 for (String filename : filenames)
614 Assert.assertTrue(new File(filename).exists(),
615 "File '" + filename + "' was not created");
617 cleanupFiles(filenames);
618 if (nonfilenames != null)
620 for (String nonfilename : nonfilenames)
622 File nonfile = new File(nonfilename);
623 Assert.assertFalse(nonfile.exists(),
624 "File " + nonfilename + " exists when it shouldn't!");
628 File deleteDirF = new File(deleteDir);
629 if (deleteDirF.exists())
635 @DataProvider(name = "allLinkedIdsData")
636 public Object[][] allLinkedIdsData()
638 return new Object[][] {
640 { "--gui --open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --output={dirname}/{basename}.stk --close",
642 { "test/jalview/bin/argparser/testfiles/test1.stk",
643 "test/jalview/bin/argparser/testfiles/test2.stk",
644 "test/jalview/bin/argparser/testfiles/test3.stk", },
646 { "--gui --open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --image={dirname}/{basename}.png --close",
648 { "test/jalview/bin/argparser/testfiles/test1.png",
649 "test/jalview/bin/argparser/testfiles/test2.png",
650 "test/jalview/bin/argparser/testfiles/test3.png", },
652 { "--gui --open=test/jalview/bin/argparser/testfiles/*.fa --all --output={dirname}/{basename}.stk --close",
654 { "test/jalview/bin/argparser/testfiles/test1.stk",
655 "test/jalview/bin/argparser/testfiles/test2.stk",
656 "test/jalview/bin/argparser/testfiles/test3.stk", },
658 { "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
659 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
660 "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
661 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
662 "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
663 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
664 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
665 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
666 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
667 { "--gui --open=test/jalview/bin/argparser/**/*.fa --all --output={dirname}/{basename}.stk --close",
669 { "test/jalview/bin/argparser/testfiles/test1.stk",
670 "test/jalview/bin/argparser/testfiles/test2.stk",
671 "test/jalview/bin/argparser/testfiles/test3.stk",
672 "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
673 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
674 "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
675 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
676 "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
677 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
678 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
679 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
680 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", },
682 { "--gui --open=test/jalview/bin/argparser/**/*.fa --output=*/*.stk --close",
684 { "test/jalview/bin/argparser/testfiles/test1.stk",
685 "test/jalview/bin/argparser/testfiles/test2.stk",
686 "test/jalview/bin/argparser/testfiles/test3.stk",
687 "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
688 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
689 "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
690 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
691 "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
692 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
693 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
694 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
695 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", },
697 { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --all --output=*/*.stk --close",
699 { "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
700 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
701 "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
702 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
703 "test/jalview/bin/argparser/testfiles/dir2/test3.stk", },
705 { "test/jalview/bin/argparser/testfiles/test1.stk",
706 "test/jalview/bin/argparser/testfiles/test2.stk",
707 "test/jalview/bin/argparser/testfiles/test3.stk",
708 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
709 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
710 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
711 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
712 { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=*/*.stk --close",
714 { "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
715 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
716 "test/jalview/bin/argparser/testfiles/dir2/test3.stk", },
718 { "test/jalview/bin/argparser/testfiles/test1.stk",
719 "test/jalview/bin/argparser/testfiles/test2.stk",
720 "test/jalview/bin/argparser/testfiles/test3.stk",
721 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
722 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
723 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
724 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
725 { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output={dirname}/{basename}.stk --close",
727 { "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
728 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
729 "test/jalview/bin/argparser/testfiles/dir2/test3.stk", },
731 { "test/jalview/bin/argparser/testfiles/test1.stk",
732 "test/jalview/bin/argparser/testfiles/test2.stk",
733 "test/jalview/bin/argparser/testfiles/test3.stk",
734 "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
735 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
736 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
737 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
738 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
739 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
740 { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output={dirname}/{basename}.stk --close",
742 { "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
743 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
744 "test/jalview/bin/argparser/testfiles/dir2/test3.stk", },
746 { "test/jalview/bin/argparser/testfiles/test1.stk",
747 "test/jalview/bin/argparser/testfiles/test2.stk",
748 "test/jalview/bin/argparser/testfiles/test3.stk",
749 "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
750 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
751 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
752 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
753 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
754 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
755 { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --output {dirname}/{basename}.stk --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output={dirname}/{basename}.aln --close",
757 { "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
758 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
759 "test/jalview/bin/argparser/testfiles/dir2/test1.aln",
760 "test/jalview/bin/argparser/testfiles/dir2/test2.aln",
761 "test/jalview/bin/argparser/testfiles/dir2/test3.aln", },
763 { "test/jalview/bin/argparser/testfiles/test1.stk",
764 "test/jalview/bin/argparser/testfiles/test2.stk",
765 "test/jalview/bin/argparser/testfiles/test3.stk",
766 "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
767 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
768 "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
769 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
770 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
771 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
772 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk",
773 "test/jalview/bin/argparser/testfiles/test1.aln",
774 "test/jalview/bin/argparser/testfiles/test2.aln",
775 "test/jalview/bin/argparser/testfiles/test3.aln",
776 "test/jalview/bin/argparser/testfiles/dir1/test1.aln",
777 "test/jalview/bin/argparser/testfiles/dir1/test2.aln",
778 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.aln",
779 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.aln",
780 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.aln",
781 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.aln", }, },
783 { "--headless --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --output "
785 + "/{dirname}/{basename}.stk --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output="
787 + "/{dirname}/{basename}.aln --close --all --mkdirs",
790 + "/test/jalview/bin/argparser/testfiles/dir1/test1.stk",
792 + "/test/jalview/bin/argparser/testfiles/dir1/test2.stk",
794 + "/test/jalview/bin/argparser/testfiles/dir2/test1.aln",
796 + "/test/jalview/bin/argparser/testfiles/dir2/test2.aln",
798 + "/test/jalview/bin/argparser/testfiles/dir2/test3.aln", },
800 { "test/jalview/bin/argparser/testfiles/test1.stk",
801 "test/jalview/bin/argparser/testfiles/test2.stk",
802 "test/jalview/bin/argparser/testfiles/test3.stk",
803 "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
804 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
805 "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
806 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
807 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
808 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
809 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk",
810 "test/jalview/bin/argparser/testfiles/test1.aln",
811 "test/jalview/bin/argparser/testfiles/test2.aln",
812 "test/jalview/bin/argparser/testfiles/test3.aln",
813 "test/jalview/bin/argparser/testfiles/dir1/test1.aln",
814 "test/jalview/bin/argparser/testfiles/dir1/test2.aln",
815 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.aln",
816 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.aln",
817 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.aln",
818 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.aln",
820 + "test/jalview/bin/argparser/testfiles/test1.stk",
822 + "test/jalview/bin/argparser/testfiles/test2.stk",
824 + "test/jalview/bin/argparser/testfiles/test3.stk",
826 + "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
828 + "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
830 + "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
832 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
834 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
836 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
838 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk",
840 + "test/jalview/bin/argparser/testfiles/test1.aln",
842 + "test/jalview/bin/argparser/testfiles/test2.aln",
844 + "test/jalview/bin/argparser/testfiles/test3.aln",
846 + "test/jalview/bin/argparser/testfiles/dir1/test1.aln",
848 + "test/jalview/bin/argparser/testfiles/dir1/test2.aln",
850 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.aln",
852 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.aln",
854 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.aln",
856 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.aln", }, },
863 { "Functional", "testTask3" },
864 dataProvider = "structureImageAnnotationsOutputFiles",
865 singleThreaded = true)
866 public void structureImageAnnotationsOutputTest(String cmdLine,
867 String filename, int height) throws IOException
869 cleanupFiles(new String[] { filename });
870 String[] args = (cmdLine).split("\\s+");
871 callJalviewMain(args, true); // Create new instance of Jalview each time for
873 BufferedImage img = ImageIO.read(new File(filename));
874 Assert.assertEquals(height, img.getHeight(), "Output image '" + filename
875 + "' is not in the expected height range, possibly because of the wrong number of annotations");
877 cleanupFiles(new String[] { filename });
881 @DataProvider(name = "structureImageAnnotationsOutputFiles")
882 public Object[][] structureImageAnnotationsOutputFiles()
884 String filename = "test/jalview/bin/argparser/testfiles/test_annotations.png";
885 return new Object[][] {
886 // MUST use --noquit with --headless to avoid a System.exit()
887 { "--noquit --headless --nonews --nosplash --open=./examples/uniref50.fa "
888 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
889 + "--seqid=FER1_SPIOL --structureviewer=jmol "
890 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
891 + "--image=" + filename + " " + "--tempfac=plddt "
893 + "--noshowssannotations " + "--noshowannotations", //
896 { "--noquit --headless --nonews --nosplash --open=./examples/uniref50.fa "
897 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
898 + "--seqid=FER1_SPIOL --structureviewer=jmol "
899 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
900 + "--image=" + filename + " " + "--tempfac=plddt "
902 + "--showssannotations " + "--noshowannotations", //
905 { "--noquit --headless --nonews --nosplash --open=./examples/uniref50.fa "
906 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
907 + "--seqid=FER1_SPIOL --structureviewer=jmol "
908 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
909 + "--image=" + filename + " " + "--tempfac=plddt "
911 + "--noshowssannotations " + "--showannotations", //
914 { "--noquit --headless --nonews --nosplash --open=./examples/uniref50.fa "
915 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
916 + "--seqid=FER1_SPIOL --structureviewer=jmol "
917 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
918 + "--image=" + filename + " " + "--tempfac=plddt "
920 + "--showssannotations " + "--showannotations", //
923 { "--gui --nonews --nosplash --open=./examples/uniref50.fa "
924 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
925 + "--seqid=FER1_SPIOL --structureviewer=jmol "
926 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
927 + "--image=" + filename + " " + "--tempfac=plddt "
929 + "--noshowssannotations " + "--noshowannotations", //
932 { "--gui --nonews --nosplash --open=./examples/uniref50.fa "
933 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
934 + "--seqid=FER1_SPIOL --structureviewer=jmol "
935 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
936 + "--image=" + filename + " " + "--tempfac=plddt "
938 + "--showssannotations " + "--noshowannotations", //
941 { "--gui --nonews --nosplash --open=./examples/uniref50.fa "
942 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
943 + "--seqid=FER1_SPIOL --structureviewer=jmol "
944 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
945 + "--image=" + filename + " " + "--tempfac=plddt "
947 + "--noshowssannotations " + "--showannotations", //
950 { "--gui --nonews --nosplash --open=./examples/uniref50.fa "
951 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
952 + "--seqid=FER1_SPIOL --structureviewer=jmol "
953 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
954 + "--image=" + filename + " " + "--tempfac=plddt "
956 + "--showssannotations " + "--showannotations", //