3 import static org.junit.Assert.assertNotEquals;
4 import static org.junit.Assert.assertNotNull;
5 import static org.junit.Assert.assertTrue;
6 import jalview.datamodel.AlignmentAnnotation;
7 import jalview.datamodel.AlignmentI;
8 import jalview.gui.AlignFrame;
10 import org.junit.Before;
11 import org.junit.Test;
13 public class AnnotatedPDBFileInputTest
19 public void setup() throws Exception
21 FileLoader loader = new FileLoader(false);
22 AlignFrame af = loader.LoadFileWaitTillLoaded("examples/1gaq.txt",
24 al = af.getViewport().getAlignment();
28 public void checkNoDuplicates()
30 // not strictly a requirement, but strange things may happen if multiple
31 // instances of the same annotation are placed in the alignment annotation
33 assertNotNull(al.getAlignmentAnnotation());
34 // verify that all sequence annotation is doubly referenced
35 AlignmentAnnotation[] avec = al.getAlignmentAnnotation();
36 for (int p = 0; p < avec.length; p++)
38 for (int q = p + 1; q < avec.length; q++)
41 "Found a duplicate annotation row " + avec[p].label,
48 public void checkAnnotationWiring()
50 assertTrue(al.getAlignmentAnnotation() != null);
51 // verify that all sequence annotation is doubly referenced
52 for (AlignmentAnnotation aa : al.getAlignmentAnnotation())
54 if (aa.sequenceRef != null)
56 assertTrue(al.getSequences().contains(aa.sequenceRef));
57 assertNotNull(aa.sequenceRef.getAnnotation());
58 boolean found = false;
59 for (AlignmentAnnotation sqan : aa.sequenceRef.getAnnotation())
68 "Couldn't find sequence associated annotation "
70 + " on the sequence it is associated with.\nSequence associated editing will fail.",