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 (!newJalview || Jalview.getInstance() != null)
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 + " --gui").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)
232 verifyOrderedFileSet(cmdLines[0] + " vs " + cmdLines[1], filenames,
234 } catch (Exception x)
236 Assert.fail("Unexpected exception during structureImageOutputTest",
240 cleanupFiles(filenames);
245 @DataProvider(name = "compareHeadlessAndGUIOps")
246 public Object[][] compareHeadlessAndGUIOps()
248 return new Object[][] {
250 { new String[] { "--open examples/uniref50.fa "
251 + "--structure [seqid=FER1_SPIOL,tempfac=plddt,showssannotations,structureviewer=jmol]"
252 + "examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
253 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json --image="
255 + "test-al-pae-ss-gui.png --overwrite --gui --quit",
256 "--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-nogui.png --overwrite --nogui"
263 }, new String[] { testfiles + "test-al-pae-ss-gui.png",
264 testfiles + "test-al-pae-ss-nogui.png", } } };
267 private static void verifyIncreasingSize(String cmdLine,
268 String[] filenames) throws Exception
270 verifyOrderedFileSet(cmdLine, filenames, true);
273 private static void verifyOrderedFileSet(String cmdLine,
274 String[] filenames, boolean increasingSize) throws Exception
276 File lastFile = null;
277 for (String filename : filenames)
279 File file = new File(filename);
280 Assert.assertTrue(file.exists(), "File '" + filename
281 + "' was not created by '" + cmdLine + "'");
282 Assert.assertTrue(file.isFile(), "File '" + filename
283 + "' is not a file from '" + cmdLine + "'");
284 Assert.assertTrue(Files.size(file.toPath()) > 0, "File '" + filename
285 + "' has no content from '" + cmdLine + "'");
286 // make sure the successive output files get bigger!
287 if (lastFile != null)
289 waitForLastWrite(file, 25);
294 Files.size(file.toPath()) > Files.size(lastFile.toPath()),
295 "Expected " + file.toPath() + " to be larger than "
296 + lastFile.toPath());
300 Assert.assertEquals(Files.size(file.toPath()),
301 Files.size(lastFile.toPath()),
302 "New file " + file.toPath()
303 + " (actual size) not same as last file's size "
304 + lastFile.toString());
307 // remember it for next file
313 private static long waitForLastWrite(File file, int i) throws IOException
315 long lastSize, stableSize = Files.size(file.toPath());
316 // wait around until we are sure the file has been completely written.
319 lastSize = stableSize;
323 } catch (Exception x)
326 stableSize = Files.size(file.toPath());
327 } while (stableSize != lastSize);
332 groups = "Functional",
333 dataProvider = "argfileOutputFiles",
334 singleThreaded = true)
336 public void argFilesGlobAndSubstitutionsTest(String cmdLine,
337 String[] filenames) throws IOException
339 cleanupFiles(filenames);
340 String[] args = (cmdLine + " --gui").split("\\s+");
343 callJalviewMain(args);
344 Commands cmds = Jalview.getInstance().getCommands();
345 Assert.assertNotNull(cmds);
346 File lastFile = null;
347 for (String filename : filenames)
349 File file = new File(filename);
350 Assert.assertTrue(file.exists(), "File '" + filename
351 + "' was not created by '" + cmdLine + "'");
352 Assert.assertTrue(file.isFile(), "File '" + filename
353 + "' is not a file from '" + cmdLine + "'");
354 Assert.assertTrue(Files.size(file.toPath()) > 0, "File '" + filename
355 + "' has no content from '" + cmdLine + "'");
356 // make sure the successive output files get bigger!
357 if (lastFile != null)
359 Assert.assertTrue(Files.size(file.toPath()) > Files
360 .size(lastFile.toPath()));
361 System.out.println("this file: " + file + " +"
362 + Files.size(file.toPath()) + " greater than "
363 + Files.size(lastFile.toPath()));
365 // remember it for next file
368 } catch (Exception x)
371 "Unexpected exception during argFilesGlobAndSubstitutions",
375 cleanupFiles(filenames);
380 @DataProvider(name = "structureImageOutputFiles")
381 public Object[][] structureImageOutputFiles()
383 return new Object[][] {
385 { "--gui --nonews --nosplash --open=./examples/test_fab41.result/sample.a2m "
386 + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
387 + "--structureimage=" + testfiles + "/structureimage1.png "
388 + "--open=./examples/test_fab41.result/sample.a2m "
389 + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
390 + "--structureimage=" + testfiles
391 + "/structureimage2.png --scale=1.5 "
392 + "--open=./examples/test_fab41.result/sample.a2m "
393 + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
394 + "--structureimage=" + testfiles
395 + "/structureimage3.png --scale=2.0 ",
397 { testfiles + "/structureimage1.png",
398 testfiles + "/structureimage2.png",
399 testfiles + "/structureimage3.png" } },
400 { "--headless --noquit --open=./examples/test_fab41.result/sample.a2m "
401 + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
402 + "--structureimage=" + testfiles + "/structureimage1.png "
403 + "--open=./examples/test_fab41.result/sample.a2m "
404 + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
405 + "--structureimage=" + testfiles
406 + "/structureimage2.png --scale=1.5 "
407 + "--open=./examples/test_fab41.result/sample.a2m "
408 + "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
409 + "--structureimage=" + testfiles
410 + "/structureimage3.png --scale=2.0 ",
412 { testfiles + "/structureimage1.png",
413 testfiles + "/structureimage2.png",
414 testfiles + "/structureimage3.png" } },
415 { "--gui --nonews --nosplash --open examples/1gaq.txt --append ./examples/3W5V.pdb "
416 + "--structure examples/1gaq.txt --seqid \"1GAQ|A\" "
417 + "--structureimage " + testfiles
418 + "/1gaq.png --structure examples/3W5V.pdb "
419 + "--seqid \"3W5V|A\" --structureimage " + testfiles
420 + "/3w5v.png --overwrite",
423 { testfiles + "/1gaq.png",
424 testfiles + "/3w5v.png" } },
425 { "--headless --noquit --open ./examples/1gaq.txt --append ./examples/3W5V.pdb "
426 + "--structure examples/1gaq.txt --seqid \"1GAQ|A\" "
427 + "--structureimage " + testfiles
428 + "/1gaq.png --structure examples/3W5V.pdb "
429 + "--seqid \"3W5V|A\" --structureimage " + testfiles
430 + "/3w5v.png --overwrite",
433 { testfiles + "/1gaq.png", testfiles + "/3w5v.png" } }
442 @DataProvider(name = "argfileOutputFiles")
443 public Object[][] argfileOutputFiles()
445 return new Object[][] {
447 { "--gui --argfile=" + testfiles + "/**/*.txt", new String[]
448 { testfiles + "/dir1/test1.png", testfiles + "/dir2/test1.png",
449 testfiles + "/dir3/subdir/test0.png" } },
450 { "--gui --argfile=" + testfiles + "/**/argfile.txt", new String[]
451 { testfiles + "/dir1/test1.png", testfiles + "/dir2/test1.png" } },
452 { "--gui --argfile=" + testfiles + "/dir*/argfile.txt", new String[]
453 { testfiles + "/dir1/test1.png", testfiles + "/dir2/test1.png" } },
454 { "--gui --initsubstitutions --append examples/uniref50.fa --image "
455 + testfiles + "/{basename}.png",
457 { testfiles + "/uniref50.png" } },
458 { "--gui --append examples/uniref50.fa --nosubstitutions --image "
459 + testfiles + "/{basename}.png",
461 { testfiles + "/{basename}.png" } }
467 @DataProvider(name = "cmdLines")
468 public Object[][] cmdLines()
470 String[] someUniref50Seqs = new String[] { "FER_CAPAA", "FER_CAPAN",
471 "FER1_MAIZE", "FER1_SPIOL", "O80429_MAIZE" };
472 String[] t1 = new String[] { "TEST1" };
473 String[] t2 = new String[] { "TEST2" };
474 String[] t3 = new String[] { "TEST3" };
475 return new Object[][] {
478 { "--append=examples/uniref50.fa", true, 1, someUniref50Seqs },
479 { "--append examples/uniref50.fa", true, 1, someUniref50Seqs },
480 { "--append=examples/uniref50*.fa", true, 1, someUniref50Seqs },
481 // NOTE we cannot use shell expansion in tests, so list all files!
482 { "--append examples/uniref50.fa examples/uniref50_mz.fa", true, 1,
484 { "--append=[new]examples/uniref50*.fa", true, 2,
486 { "--open=examples/uniref50*.fa", true, 2, someUniref50Seqs },
487 { "examples/uniref50.fa", true, 1, someUniref50Seqs },
488 { "examples/uniref50.fa " + testfiles + "/test1.fa", true, 2,
489 ArrayUtils.concatArrays(someUniref50Seqs, t1) },
490 { "examples/uniref50.fa " + testfiles + "/test1.fa", true, 2, t1 },
491 { "--gui --argfile=" + testfiles + "/argfile0.txt", true, 1,
492 ArrayUtils.concatArrays(t1, t3) },
493 { "--gui --argfile=" + testfiles + "/argfile*.txt", true, 5,
494 ArrayUtils.concatArrays(t1, t2, t3) },
495 { "--gui --argfile=" + testfiles + "/argfile.autocounter", true, 3,
496 ArrayUtils.concatArrays(t1, t2) } };
500 public static boolean lookForSequenceName(String sequenceName)
502 AlignFrame[] afs = Desktop.getDesktopAlignFrames();
503 for (AlignFrame af : afs)
505 for (String name : af.getViewport().getAlignment().getSequenceNames())
507 if (sequenceName.equals(name))
516 public static void cleanupFiles(String[] filenames)
518 for (String filename : filenames)
520 File file = new File(filename);
528 private final String deleteDir = "test/deleteAfter";
531 groups = "Functional",
532 dataProvider = "allLinkedIdsData",
533 singleThreaded = true)
534 public void allLinkedIdsTest(String cmdLine, String[] filenames,
535 String[] nonfilenames)
537 String[] args = (cmdLine + " --gui").split("\\s+");
538 callJalviewMain(args);
539 Commands cmds = Jalview.getInstance().getCommands();
540 Assert.assertNotNull(cmds);
541 for (String filename : filenames)
543 Assert.assertTrue(new File(filename).exists(),
544 "File '" + filename + "' was not created");
546 cleanupFiles(filenames);
547 if (nonfilenames != null)
549 for (String nonfilename : nonfilenames)
551 File nonfile = new File(nonfilename);
552 Assert.assertFalse(nonfile.exists(),
553 "File " + nonfilename + " exists when it shouldn't!");
557 File deleteDirF = new File(deleteDir);
558 if (deleteDirF.exists())
564 @DataProvider(name = "allLinkedIdsData")
565 public Object[][] allLinkedIdsData()
567 return new Object[][] {
569 { "--gui --open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --output={dirname}/{basename}.stk --close",
571 { "test/jalview/bin/argparser/testfiles/test1.stk",
572 "test/jalview/bin/argparser/testfiles/test2.stk",
573 "test/jalview/bin/argparser/testfiles/test3.stk", },
575 { "--gui --open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --image={dirname}/{basename}.png --close",
577 { "test/jalview/bin/argparser/testfiles/test1.png",
578 "test/jalview/bin/argparser/testfiles/test2.png",
579 "test/jalview/bin/argparser/testfiles/test3.png", },
581 { "--gui --open=test/jalview/bin/argparser/testfiles/*.fa --all --output={dirname}/{basename}.stk --close",
583 { "test/jalview/bin/argparser/testfiles/test1.stk",
584 "test/jalview/bin/argparser/testfiles/test2.stk",
585 "test/jalview/bin/argparser/testfiles/test3.stk", },
587 { "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
588 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
589 "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
590 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
591 "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
592 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
593 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
594 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
595 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
596 { "--gui --open=test/jalview/bin/argparser/**/*.fa --all --output={dirname}/{basename}.stk --close",
598 { "test/jalview/bin/argparser/testfiles/test1.stk",
599 "test/jalview/bin/argparser/testfiles/test2.stk",
600 "test/jalview/bin/argparser/testfiles/test3.stk",
601 "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
602 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
603 "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
604 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
605 "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
606 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
607 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
608 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
609 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", },
611 { "--gui --open=test/jalview/bin/argparser/**/*.fa --output=*/*.stk --close",
613 { "test/jalview/bin/argparser/testfiles/test1.stk",
614 "test/jalview/bin/argparser/testfiles/test2.stk",
615 "test/jalview/bin/argparser/testfiles/test3.stk",
616 "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
617 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
618 "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
619 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
620 "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
621 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
622 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
623 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
624 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", },
626 { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --all --output=*/*.stk --close",
628 { "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
629 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
630 "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
631 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
632 "test/jalview/bin/argparser/testfiles/dir2/test3.stk", },
634 { "test/jalview/bin/argparser/testfiles/test1.stk",
635 "test/jalview/bin/argparser/testfiles/test2.stk",
636 "test/jalview/bin/argparser/testfiles/test3.stk",
637 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
638 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
639 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
640 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
641 { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=*/*.stk --close",
643 { "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
644 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
645 "test/jalview/bin/argparser/testfiles/dir2/test3.stk", },
647 { "test/jalview/bin/argparser/testfiles/test1.stk",
648 "test/jalview/bin/argparser/testfiles/test2.stk",
649 "test/jalview/bin/argparser/testfiles/test3.stk",
650 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
651 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
652 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
653 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
654 { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output={dirname}/{basename}.stk --close",
656 { "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
657 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
658 "test/jalview/bin/argparser/testfiles/dir2/test3.stk", },
660 { "test/jalview/bin/argparser/testfiles/test1.stk",
661 "test/jalview/bin/argparser/testfiles/test2.stk",
662 "test/jalview/bin/argparser/testfiles/test3.stk",
663 "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
664 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
665 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
666 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
667 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
668 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
669 { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output={dirname}/{basename}.stk --close",
671 { "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
672 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
673 "test/jalview/bin/argparser/testfiles/dir2/test3.stk", },
675 { "test/jalview/bin/argparser/testfiles/test1.stk",
676 "test/jalview/bin/argparser/testfiles/test2.stk",
677 "test/jalview/bin/argparser/testfiles/test3.stk",
678 "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
679 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
680 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
681 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
682 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
683 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
684 { "--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",
686 { "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
687 "test/jalview/bin/argparser/testfiles/dir1/test2.stk",
688 "test/jalview/bin/argparser/testfiles/dir2/test1.aln",
689 "test/jalview/bin/argparser/testfiles/dir2/test2.aln",
690 "test/jalview/bin/argparser/testfiles/dir2/test3.aln", },
692 { "test/jalview/bin/argparser/testfiles/test1.stk",
693 "test/jalview/bin/argparser/testfiles/test2.stk",
694 "test/jalview/bin/argparser/testfiles/test3.stk",
695 "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
696 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
697 "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
698 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
699 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
700 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
701 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk",
702 "test/jalview/bin/argparser/testfiles/test1.aln",
703 "test/jalview/bin/argparser/testfiles/test2.aln",
704 "test/jalview/bin/argparser/testfiles/test3.aln",
705 "test/jalview/bin/argparser/testfiles/dir1/test1.aln",
706 "test/jalview/bin/argparser/testfiles/dir1/test2.aln",
707 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.aln",
708 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.aln",
709 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.aln",
710 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.aln", }, },
712 { "--headless --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --output "
714 + "/{dirname}/{basename}.stk --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output="
716 + "/{dirname}/{basename}.aln --close --all --mkdirs",
719 + "/test/jalview/bin/argparser/testfiles/dir1/test1.stk",
721 + "/test/jalview/bin/argparser/testfiles/dir1/test2.stk",
723 + "/test/jalview/bin/argparser/testfiles/dir2/test1.aln",
725 + "/test/jalview/bin/argparser/testfiles/dir2/test2.aln",
727 + "/test/jalview/bin/argparser/testfiles/dir2/test3.aln", },
729 { "test/jalview/bin/argparser/testfiles/test1.stk",
730 "test/jalview/bin/argparser/testfiles/test2.stk",
731 "test/jalview/bin/argparser/testfiles/test3.stk",
732 "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
733 "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
734 "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
735 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
736 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
737 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
738 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk",
739 "test/jalview/bin/argparser/testfiles/test1.aln",
740 "test/jalview/bin/argparser/testfiles/test2.aln",
741 "test/jalview/bin/argparser/testfiles/test3.aln",
742 "test/jalview/bin/argparser/testfiles/dir1/test1.aln",
743 "test/jalview/bin/argparser/testfiles/dir1/test2.aln",
744 "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.aln",
745 "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.aln",
746 "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.aln",
747 "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.aln",
749 + "test/jalview/bin/argparser/testfiles/test1.stk",
751 + "test/jalview/bin/argparser/testfiles/test2.stk",
753 + "test/jalview/bin/argparser/testfiles/test3.stk",
755 + "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
757 + "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
759 + "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
761 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
763 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
765 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
767 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk",
769 + "test/jalview/bin/argparser/testfiles/test1.aln",
771 + "test/jalview/bin/argparser/testfiles/test2.aln",
773 + "test/jalview/bin/argparser/testfiles/test3.aln",
775 + "test/jalview/bin/argparser/testfiles/dir1/test1.aln",
777 + "test/jalview/bin/argparser/testfiles/dir1/test2.aln",
779 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.aln",
781 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.aln",
783 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.aln",
785 + "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.aln", }, },
792 { "Functional", "testTask3" },
793 dataProvider = "structureImageAnnotationsOutputFiles",
794 singleThreaded = true)
795 public void structureImageAnnotationsOutputTest(String cmdLine,
796 String filename, int height) throws IOException
798 cleanupFiles(new String[] { filename });
799 String[] args = (cmdLine).split("\\s+");
800 callJalviewMain(args, true); // Create new instance of Jalview each time for
803 BufferedImage img = ImageIO.read(new File(filename));
804 Assert.assertEquals(height, img.getHeight(), "Output image '" + filename
805 + "' is not in the expected height range, possibly because of the wrong number of annotations");
807 cleanupFiles(new String[] { filename });
811 @DataProvider(name = "structureImageAnnotationsOutputFiles")
812 public Object[][] structureImageAnnotationsOutputFiles()
814 String filename = "test/jalview/bin/argparser/testfiles/test_annotations.png";
815 return new Object[][] {
817 { "--headless --nonews --nosplash --overwrite --open=./examples/uniref50.fa "
818 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
819 + "--seqid=FER1_SPIOL --structureviewer=jmol "
820 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
821 + "--image=" + filename + " " + "--tempfac=plddt "
822 + "--noshowssannotations " + "--noshowannotations", //
825 { "--headless --nonews --nosplash --overwrite --open=./examples/uniref50.fa "
826 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
827 + "--seqid=FER1_SPIOL --structureviewer=jmol "
828 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
829 + "--image=" + filename + " " + "--tempfac=plddt "
830 + "--showssannotations " + "--noshowannotations", //
833 { "--headless --nonews --nosplash --overwrite --open=./examples/uniref50.fa "
834 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
835 + "--seqid=FER1_SPIOL --structureviewer=jmol "
836 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
837 + "--image=" + filename + " " + "--tempfac=plddt "
838 + "--noshowssannotations " + "--showannotations", //
841 { "--headless --nonews --nosplash --overwrite --open=./examples/uniref50.fa "
842 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
843 + "--seqid=FER1_SPIOL --structureviewer=jmol "
844 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
845 + "--image=" + filename + " " + "--tempfac=plddt "
846 + "--showssannotations " + "--showannotations", //
849 { "--gui --nonews --nosplash --overwrite --open=./examples/uniref50.fa "
850 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
851 + "--seqid=FER1_SPIOL --structureviewer=jmol "
852 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
853 + "--image=" + filename + " " + "--tempfac=plddt "
854 + "--noshowssannotations " + "--noshowannotations", //
857 { "--gui --nonews --nosplash --overwrite --open=./examples/uniref50.fa "
858 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
859 + "--seqid=FER1_SPIOL --structureviewer=jmol "
860 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
861 + "--image=" + filename + " " + "--tempfac=plddt "
862 + "--showssannotations " + "--noshowannotations", //
865 { "--gui --nonews --nosplash --overwrite --open=./examples/uniref50.fa "
866 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
867 + "--seqid=FER1_SPIOL --structureviewer=jmol "
868 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
869 + "--image=" + filename + " " + "--tempfac=plddt "
870 + "--noshowssannotations " + "--showannotations", //
873 { "--gui --nonews --nosplash --overwrite --open=./examples/uniref50.fa "
874 + "--structure=examples/AlphaFold/AF-P00221-F1-model_v4.pdb "
875 + "--seqid=FER1_SPIOL --structureviewer=jmol "
876 + "--paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json "
877 + "--image=" + filename + " " + "--tempfac=plddt "
878 + "--showssannotations " + "--showannotations", //