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.datamodel.SequenceI;
9 import jalview.gui.AlignFrame;
11 import org.junit.Before;
12 import org.junit.Test;
14 public class AnnotatedPDBFileInputTest
19 String pdbStr = "examples/2GIS.pdb";
21 public void setup() throws Exception
23 FileLoader loader = new FileLoader(false);
24 AlignFrame af = loader.LoadFileWaitTillLoaded(pdbStr,
26 al = af.getViewport().getAlignment();
30 public void checkNoDuplicates()
32 // not strictly a requirement, but strange things may happen if multiple
33 // instances of the same annotation are placed in the alignment annotation
35 assertNotNull(al.getAlignmentAnnotation());
36 // verify that all sequence annotation is doubly referenced
37 AlignmentAnnotation[] avec = al.getAlignmentAnnotation();
38 for (int p = 0; p < avec.length; p++)
40 for (int q = p + 1; q < avec.length; q++)
43 "Found a duplicate annotation row " + avec[p].label,
50 public void checkPDBannotationSource()
53 for (SequenceI asq : al.getSequences())
55 for (AlignmentAnnotation aa : asq.getAnnotation())
58 System.out.println("CalcId: " + aa.getCalcId());
59 assertTrue(MCview.PDBfile.isCalcIdForFile(aa.getCalcId(), pdbStr));
65 public void checkAnnotationWiring()
67 assertTrue(al.getAlignmentAnnotation() != null);
68 // verify that all sequence annotation is doubly referenced
69 for (AlignmentAnnotation aa : al.getAlignmentAnnotation())
71 if (aa.sequenceRef != null)
73 assertTrue(al.getSequences().contains(aa.sequenceRef));
74 assertNotNull(aa.sequenceRef.getAnnotation());
75 boolean found = false;
76 for (AlignmentAnnotation sqan : aa.sequenceRef.getAnnotation())
85 "Couldn't find sequence associated annotation "
87 + " on the sequence it is associated with.\nSequence associated editing will fail.",