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 static org.testng.AssertJUnit.assertEquals;
24 import static org.testng.AssertJUnit.assertFalse;
25 import static org.testng.AssertJUnit.assertNotNull;
26 import static org.testng.AssertJUnit.assertSame;
27 import static org.testng.AssertJUnit.assertTrue;
29 import jalview.api.AlignViewportI;
30 import jalview.api.AlignmentViewPanel;
31 import jalview.api.ViewStyleI;
32 import jalview.bin.Cache;
33 import jalview.datamodel.AlignmentAnnotation;
34 import jalview.datamodel.AlignmentI;
35 import jalview.datamodel.HiddenSequences;
36 import jalview.datamodel.SequenceCollectionI;
37 import jalview.datamodel.SequenceGroup;
38 import jalview.datamodel.SequenceI;
39 import jalview.gui.AlignFrame;
40 import jalview.gui.Desktop;
41 import jalview.gui.Jalview2XML;
42 import jalview.schemes.AnnotationColourGradient;
43 import jalview.schemes.ColourSchemeI;
44 import jalview.viewmodel.AlignmentViewport;
47 import java.util.ArrayList;
48 import java.util.HashMap;
49 import java.util.List;
52 import org.testng.Assert;
53 import org.testng.AssertJUnit;
54 import org.testng.annotations.AfterClass;
55 import org.testng.annotations.BeforeClass;
56 import org.testng.annotations.Test;
58 @Test(singleThreaded = true)
59 public class Jalview2xmlTests
63 * @throws java.lang.Exception
65 @BeforeClass(alwaysRun = true)
66 public static void setUpBeforeClass() throws Exception
68 jalview.bin.Jalview.main(new String[] { "-props",
69 "test/jalview/io/testProps.jvprops" });
73 * @throws java.lang.Exception
75 @AfterClass(alwaysRun = true)
76 public static void tearDownAfterClass() throws Exception
78 jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
81 int countDsAnn(jalview.viewmodel.AlignmentViewport avp)
84 for (SequenceI sq : avp.getAlignment().getDataset().getSequences())
86 if (sq.getAnnotation() != null)
88 for (AlignmentAnnotation dssa : sq.getAnnotation())
90 if (dssa.isValidStruc())
100 @Test(groups = { "Functional" })
101 public void testRNAStructureRecovery() throws Exception
103 String inFile = "examples/RF00031_folded.stk";
104 String tfile = File.createTempFile("JalviewTest", ".jvp")
106 AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
107 inFile, FormatAdapter.FILE);
108 assertTrue("Didn't read input file " + inFile, af != null);
109 int olddsann = countDsAnn(af.getViewport());
110 assertTrue("Didn't find any dataset annotations", olddsann > 0);
111 af.rnahelicesColour_actionPerformed(null);
113 "Couldn't apply RNA helices colourscheme",
114 af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
115 assertTrue("Failed to store as a project.",
116 af.saveAlignment(tfile, "Jalview"));
117 af.closeMenuItem_actionPerformed(true);
119 af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(tfile,
121 assertTrue("Failed to import new project", af != null);
122 int newdsann = countDsAnn(af.getViewport());
124 "Differing numbers of dataset sequence annotation\nOriginally "
125 + olddsann + " and now " + newdsann,
126 olddsann == newdsann);
128 .println("Read in same number of annotations as originally present ("
131 "RNA helices colourscheme was not applied on import.",
132 af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
135 @Test(groups = { "Functional" })
136 public void testTCoffeeScores() throws Exception
138 String inFile = "examples/uniref50.fa", inAnnot = "examples/uniref50.score_ascii";
139 String tfile = File.createTempFile("JalviewTest", ".jvp")
141 AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
142 inFile, FormatAdapter.FILE);
143 assertTrue("Didn't read input file " + inFile, af != null);
144 af.loadJalviewDataFile(inAnnot, FormatAdapter.FILE, null, null);
146 "Didn't set T-coffee colourscheme",
147 af.getViewport().getGlobalColourScheme().getClass()
148 .equals(jalview.schemes.TCoffeeColourScheme.class));
150 "Recognise T-Coffee score from string",
151 jalview.schemes.ColourSchemeProperty.getColour(af.getViewport()
153 jalview.schemes.ColourSchemeProperty.getColourName(af
154 .getViewport().getGlobalColourScheme())) != null);
156 assertTrue("Failed to store as a project.",
157 af.saveAlignment(tfile, "Jalview"));
158 af.closeMenuItem_actionPerformed(true);
160 af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(tfile,
162 assertTrue("Failed to import new project", af != null);
164 "Didn't set T-coffee colourscheme for imported project.",
165 af.getViewport().getGlobalColourScheme().getClass()
166 .equals(jalview.schemes.TCoffeeColourScheme.class));
168 .println("T-Coffee score shading successfully recovered from project.");
171 @Test(groups = { "Functional" })
172 public void testColourByAnnotScores() throws Exception
174 String inFile = "examples/uniref50.fa", inAnnot = "examples/testdata/uniref50_iupred.jva";
175 String tfile = File.createTempFile("JalviewTest", ".jvp")
177 AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
178 inFile, FormatAdapter.FILE);
179 assertTrue("Didn't read input file " + inFile, af != null);
180 af.loadJalviewDataFile(inAnnot, FormatAdapter.FILE, null, null);
181 AlignmentAnnotation[] aa = af.getViewport().getAlignment()
182 .getSequenceAt(0).getAnnotation("IUPredWS (Short)");
184 "Didn't find any IUPred annotation to use to shade alignment.",
185 aa != null && aa.length > 0);
186 AnnotationColourGradient cs = new jalview.schemes.AnnotationColourGradient(
187 aa[0], null, AnnotationColourGradient.ABOVE_THRESHOLD);
188 AnnotationColourGradient gcs = new jalview.schemes.AnnotationColourGradient(
189 aa[0], null, AnnotationColourGradient.BELOW_THRESHOLD);
190 cs.setSeqAssociated(true);
191 gcs.setSeqAssociated(true);
193 SequenceGroup sg = new SequenceGroup();
197 af.getViewport().getAlignment().addGroup(sg);
198 sg.addSequence(af.getViewport().getAlignment().getSequenceAt(1), false);
199 sg.addSequence(af.getViewport().getAlignment().getSequenceAt(2), true);
200 af.alignPanel.alignmentChanged();
201 assertTrue("Failed to store as a project.",
202 af.saveAlignment(tfile, "Jalview"));
203 af.closeMenuItem_actionPerformed(true);
205 af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(tfile,
207 assertTrue("Failed to import new project", af != null);
209 // check for group and alignment colourschemes
211 ColourSchemeI _rcs = af.getViewport().getGlobalColourScheme();
212 ColourSchemeI _rgcs = af.getViewport().getAlignment().getGroups()
214 assertTrue("Didn't recover global colourscheme", _rcs != null);
215 assertTrue("Didn't recover annotation colour global scheme",
216 _rcs instanceof AnnotationColourGradient);
217 AnnotationColourGradient __rcs = (AnnotationColourGradient) _rcs;
218 assertTrue("Annotation colourscheme wasn't sequence associated",
219 __rcs.isSeqAssociated());
221 boolean diffseqcols = false, diffgseqcols = false;
222 SequenceI[] sqs = af.getViewport().getAlignment().getSequencesArray();
223 for (int p = 0, pSize = af.getViewport().getAlignment().getWidth(); p < pSize
224 && (!diffseqcols || !diffgseqcols); p++)
226 if (_rcs.findColour(sqs[0].getCharAt(p), p, sqs[0]) != _rcs
227 .findColour(sqs[5].getCharAt(p), p, sqs[5]))
232 assertTrue("Got Different sequence colours", diffseqcols);
234 .println("Per sequence colourscheme (Background) successfully applied and recovered.");
236 assertTrue("Didn't recover group colourscheme", _rgcs != null);
237 assertTrue("Didn't recover annotation colour group colourscheme",
238 _rgcs instanceof AnnotationColourGradient);
239 __rcs = (AnnotationColourGradient) _rgcs;
240 assertTrue("Group Annotation colourscheme wasn't sequence associated",
241 __rcs.isSeqAssociated());
243 for (int p = 0, pSize = af.getViewport().getAlignment().getWidth(); p < pSize
244 && (!diffseqcols || !diffgseqcols); p++)
246 if (_rgcs.findColour(sqs[1].getCharAt(p), p, sqs[1]) != _rgcs
247 .findColour(sqs[2].getCharAt(p), p, sqs[2]))
252 assertTrue("Got Different group sequence colours", diffgseqcols);
254 .println("Per sequence (Group) colourscheme successfully applied and recovered.");
257 @Test(groups = { "Functional" })
258 public void gatherViewsHere() throws Exception
260 int origCount = Desktop.getAlignFrames() == null ? 0 : Desktop
261 .getAlignFrames().length;
262 AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
263 "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
264 assertTrue("Didn't read in the example file correctly.", af != null);
265 assertTrue("Didn't gather the views in the example file.",
266 Desktop.getAlignFrames().length == 1 + origCount);
270 @Test(groups = { "Functional" })
271 public void viewRefPdbAnnotation() throws Exception
273 Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
274 Boolean.TRUE.toString());
275 Cache.applicationProperties.setProperty("ADD_SS_ANN",
276 Boolean.TRUE.toString());
277 AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
278 "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
279 assertTrue("Didn't read in the example file correctly.", af != null);
280 AlignmentViewPanel sps = null;
281 for (AlignmentViewPanel ap : af.alignPanel.alignFrame.getAlignPanels())
283 if ("Spinach Feredoxin Structure".equals(ap.getViewName()))
289 assertTrue("Couldn't find the structure view", sps != null);
290 SequenceI sq = sps.getAlignment().findName("1A70|");
291 AlignmentAnnotation refan = null;
292 for (AlignmentAnnotation ra : sps.getAlignment()
293 .getAlignmentAnnotation())
301 assertTrue("Annotation secondary structure not found.", refan != null);
302 assertTrue("Couldn't find 1a70 null chain", sq != null);
303 // compare the manually added temperature factor annotation
304 // to the track automatically transferred from the pdb structure on load
305 for (AlignmentAnnotation ala : sq.getDatasetSequence().getAnnotation())
307 AlignmentAnnotation alaa;
308 sq.addAlignmentAnnotation(alaa = new AlignmentAnnotation(ala));
309 alaa.adjustForAlignment();
310 if (ala.graph == refan.graph)
312 for (int p = 0; p < ala.annotations.length; p++)
318 "Mismatch at alignment position " + p,
319 (alaa.annotations[p] == null && refan.annotations[p] == null)
320 || alaa.annotations[p].value == refan.annotations[p].value);
321 } catch (NullPointerException q)
323 Assert.fail("Mismatch of alignment annotations at position "
324 + p + " Ref seq ann: " + refan.annotations[p]
325 + " alignment " + alaa.annotations[p]);
333 @Test(groups = { "Functional" })
334 public void testCopyViewSettings() throws Exception
336 AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
337 "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
338 assertTrue("Didn't read in the example file correctly.", af != null);
339 AlignmentViewPanel sps = null, groups = null;
340 for (AlignmentViewPanel ap : af.alignPanel.alignFrame.getAlignPanels())
342 if ("Spinach Feredoxin Structure".equals(ap.getViewName()))
346 if (ap.getViewName().contains("MAFFT"))
351 assertTrue("Couldn't find the structure view", sps != null);
352 assertTrue("Couldn't find the MAFFT view", groups != null);
354 ViewStyleI structureStyle = sps.getAlignViewport().getViewStyle();
355 ViewStyleI groupStyle = groups.getAlignViewport().getViewStyle();
356 AssertJUnit.assertFalse(structureStyle.sameStyle(groupStyle));
358 groups.getAlignViewport().setViewStyle(structureStyle);
359 AssertJUnit.assertFalse(groupStyle.sameStyle(groups.getAlignViewport()
361 Assert.assertTrue(structureStyle.sameStyle(groups.getAlignViewport()
367 * test store and recovery of expanded views
371 @Test(groups = { "Functional" }, enabled = true)
372 public void testStoreAndRecoverExpandedviews() throws Exception
375 AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
376 "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
377 assertTrue("Didn't read in the example file correctly.", af != null);
378 String afid = af.getViewport().getSequenceSetId();
380 // check FileLoader returned a reference to the one alignFrame that is
381 // actually on the Desktop
383 "Jalview2XML.loadAlignFrame() didn't return correct AlignFrame reference for multiple view window",
384 af == Desktop.getAlignFrameFor(af.getViewport()));
386 Desktop.explodeViews(af);
388 int oldviews = Desktop.getAlignFrames().length;
389 Assert.assertEquals(Desktop.getAlignFrames().length,
390 Desktop.getAlignmentPanels(afid).length);
391 File tfile = File.createTempFile("testStoreAndRecoverExpanded", ".jvp");
394 new Jalview2XML(false).saveState(tfile);
397 Assert.fail("Didn't save the expanded view state", e);
398 } catch (Exception e)
400 Assert.fail("Didn't save the expanded view state", e);
402 Desktop.instance.closeAll_actionPerformed(null);
403 if (Desktop.getAlignFrames() != null)
405 Assert.assertEquals(Desktop.getAlignFrames().length, 0);
407 af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
408 tfile.getAbsolutePath(), FormatAdapter.FILE);
409 Assert.assertNotNull(af);
411 Desktop.getAlignFrames().length,
412 Desktop.getAlignmentPanels(af.getViewport().getSequenceSetId()).length);
415 Desktop.getAlignmentPanels(af.getViewport().getSequenceSetId()).length);
419 * Test save and reload of a project with a different representative sequence
424 @Test(groups = { "Functional" })
425 public void testStoreAndRecoverReferenceSeqSettings() throws Exception
427 Desktop.instance.closeAll_actionPerformed(null);
428 AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
429 "examples/exampleFile_2_7.jar", FormatAdapter.FILE);
430 assertTrue("Didn't read in the example file correctly.", af != null);
431 String afid = af.getViewport().getSequenceSetId();
433 // remember reference sequence for each panel
434 Map<String, SequenceI> refseqs = new HashMap<String, SequenceI>();
437 * mark sequence 2, 3, 4.. in panels 1, 2, 3...
438 * as reference sequence for itself and the preceding sequence
441 for (AlignmentViewPanel ap : Desktop.getAlignmentPanels(afid))
443 AlignViewportI av = ap.getAlignViewport();
444 AlignmentI alignment = ap.getAlignment();
445 int repIndex = n % alignment.getHeight();
446 SequenceI rep = alignment.getSequenceAt(repIndex);
447 refseqs.put(ap.getViewName(), rep);
449 // code from mark/unmark sequence as reference in jalview.gui.PopupMenu
450 // todo refactor this to an alignment view controller
451 av.setDisplayReferenceSeq(true);
452 av.setColourByReferenceSeq(true);
453 av.getAlignment().setSeqrep(rep);
457 File tfile = File.createTempFile("testStoreAndRecoverReferenceSeq",
461 new Jalview2XML(false).saveState(tfile);
462 } catch (Throwable e)
464 Assert.fail("Didn't save the expanded view state", e);
466 Desktop.instance.closeAll_actionPerformed(null);
467 if (Desktop.getAlignFrames() != null)
469 Assert.assertEquals(Desktop.getAlignFrames().length, 0);
472 af = new FileLoader().LoadFileWaitTillLoaded(
473 tfile.getAbsolutePath(), FormatAdapter.FILE);
474 afid = af.getViewport().getSequenceSetId();
476 for (AlignmentViewPanel ap : Desktop.getAlignmentPanels(afid))
478 // check representative
479 AlignmentI alignment = ap.getAlignment();
480 SequenceI rep = alignment.getSeqrep();
481 Assert.assertNotNull(rep,
482 "Couldn't restore sequence representative from project");
483 // can't use a strong equals here, because by definition, the sequence IDs
484 // will be different.
485 // could set vamsas session save/restore flag to preserve IDs across
487 Assert.assertEquals(refseqs.get(ap.getViewName()).toString(),
489 "Representative wasn't the same when recovered.");
490 Assert.assertTrue(ap.getAlignViewport().isDisplayReferenceSeq(),
491 "Display reference sequence view setting not set.");
492 Assert.assertTrue(ap.getAlignViewport().isColourByReferenceSeq(),
493 "Colour By Reference Seq view setting not set.");
497 @Test(groups = { "Functional" })
498 public void testIsVersionStringLaterThan()
501 * No version / development / test / autobuild is leniently assumed to be
504 assertTrue(Jalview2XML.isVersionStringLaterThan(null, null));
505 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3", null));
506 assertTrue(Jalview2XML.isVersionStringLaterThan(null, "2.8.3"));
507 assertTrue(Jalview2XML.isVersionStringLaterThan(null,
508 "Development Build"));
509 assertTrue(Jalview2XML.isVersionStringLaterThan(null,
510 "DEVELOPMENT BUILD"));
511 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3",
512 "Development Build"));
513 assertTrue(Jalview2XML.isVersionStringLaterThan(null, "Test"));
514 assertTrue(Jalview2XML.isVersionStringLaterThan(null, "TEST"));
515 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3", "Test"));
516 assertTrue(Jalview2XML
517 .isVersionStringLaterThan(null, "Automated Build"));
518 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3",
520 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3",
524 * same version returns true i.e. compatible
526 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8", "2.8"));
527 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3", "2.8.3"));
528 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3b1", "2.8.3b1"));
529 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3B1", "2.8.3b1"));
530 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3b1", "2.8.3B1"));
533 * later version returns true
535 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3", "2.8.4"));
536 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3", "2.9"));
537 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3", "2.9.2"));
538 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8", "2.8.3"));
539 assertTrue(Jalview2XML.isVersionStringLaterThan("2.8.3", "2.8.3b1"));
542 * earlier version returns false
544 assertFalse(Jalview2XML.isVersionStringLaterThan("2.8.3", "2.8"));
545 assertFalse(Jalview2XML.isVersionStringLaterThan("2.8.4", "2.8.3"));
546 assertFalse(Jalview2XML.isVersionStringLaterThan("2.8.3b1", "2.8.3"));
547 assertFalse(Jalview2XML.isVersionStringLaterThan("2.8.3", "2.8.2b1"));
548 assertFalse(Jalview2XML.isVersionStringLaterThan("2.8.0b2", "2.8.0b1"));
552 * Test save and reload of a project with a different sequence group (and
553 * representative sequence) in each view.
557 @Test(groups = { "Functional" })
558 public void testStoreAndRecoverGroupRepSeqs() throws Exception
560 Desktop.instance.closeAll_actionPerformed(null);
561 AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
562 "examples/uniref50.fa", FormatAdapter.FILE);
563 assertTrue("Didn't read in the example file correctly.", af != null);
564 String afid = af.getViewport().getSequenceSetId();
565 // make a second view of the alignment
566 af.newView_actionPerformed(null);
569 * remember representative and hidden sequences marked
572 Map<String, SequenceI> repSeqs = new HashMap<String, SequenceI>();
573 Map<String, List<String>> hiddenSeqNames = new HashMap<String, List<String>>();
576 * mark sequence 2, 3, 4.. in panels 1, 2, 3...
577 * as reference sequence for itself and the preceding sequence
580 for (AlignmentViewPanel ap : Desktop.getAlignmentPanels(afid))
582 AlignViewportI av = ap.getAlignViewport();
583 AlignmentI alignment = ap.getAlignment();
584 int repIndex = n % alignment.getHeight();
585 // ensure at least one preceding sequence i.e. index >= 1
586 repIndex = Math.max(repIndex, 1);
587 SequenceI repSeq = alignment.getSequenceAt(repIndex);
588 repSeqs.put(ap.getViewName(), repSeq);
589 List<String> hiddenNames = new ArrayList<String>();
590 hiddenSeqNames.put(ap.getViewName(), hiddenNames);
593 * have rep sequence represent itself and the one before it
594 * this hides the group (except for the rep seq)
596 SequenceGroup sg = new SequenceGroup();
597 sg.addSequence(repSeq, false);
598 SequenceI precedingSeq = alignment.getSequenceAt(repIndex - 1);
599 sg.addSequence(precedingSeq, false);
600 sg.setSeqrep(repSeq);
601 assertTrue(sg.getSequences().contains(repSeq));
602 assertTrue(sg.getSequences().contains(precedingSeq));
603 av.setSelectionGroup(sg);
604 assertSame(repSeq, sg.getSeqrep());
607 * represent group with sequence adds to a map of hidden rep sequences
608 * (it does not create a group on the alignment)
610 ((AlignmentViewport) av).hideSequences(repSeq, true);
611 assertSame(repSeq, sg.getSeqrep());
612 assertTrue(sg.getSequences().contains(repSeq));
613 assertTrue(sg.getSequences().contains(precedingSeq));
614 assertTrue("alignment has groups", alignment.getGroups().isEmpty());
615 Map<SequenceI, SequenceCollectionI> hiddenRepSeqsMap = av.getHiddenRepSequences();
616 assertNotNull(hiddenRepSeqsMap);
617 assertEquals(1, hiddenRepSeqsMap.size());
618 assertSame(sg, hiddenRepSeqsMap.get(repSeq));
619 assertTrue(alignment.getHiddenSequences().isHidden(precedingSeq));
620 assertFalse(alignment.getHiddenSequences().isHidden(repSeq));
621 hiddenNames.add(precedingSeq.getName());
626 .createTempFile("testStoreAndRecoverGroupReps",
630 new Jalview2XML(false).saveState(tfile);
631 } catch (Throwable e)
633 Assert.fail("Didn't save the expanded view state", e);
635 Desktop.instance.closeAll_actionPerformed(null);
636 if (Desktop.getAlignFrames() != null)
638 Assert.assertEquals(Desktop.getAlignFrames().length, 0);
641 af = new FileLoader().LoadFileWaitTillLoaded(
642 tfile.getAbsolutePath(), FormatAdapter.FILE);
643 afid = af.getViewport().getSequenceSetId();
645 for (AlignmentViewPanel ap : Desktop.getAlignmentPanels(afid))
647 String viewName = ap.getViewName();
648 AlignViewportI av = ap.getAlignViewport();
649 AlignmentI alignment = ap.getAlignment();
650 List<SequenceGroup> groups = alignment.getGroups();
651 assertNotNull(groups);
652 assertTrue("Alignment has groups", groups.isEmpty());
653 Map<SequenceI, SequenceCollectionI> hiddenRepSeqsMap = av
654 .getHiddenRepSequences();
655 assertNotNull("No hidden represented sequences", hiddenRepSeqsMap);
656 assertEquals(1, hiddenRepSeqsMap.size());
657 assertEquals(repSeqs.get(viewName).getDisplayId(true),
658 hiddenRepSeqsMap.keySet().iterator().next()
659 .getDisplayId(true));
662 * verify hidden sequences in restored panel
664 List<String> hidden = hiddenSeqNames.get(ap.getViewName());
665 HiddenSequences hs = alignment.getHiddenSequences();
667 "wrong number of restored hidden sequences in "
669 hidden.size(), hs.getSize());