JAL-1737 updated JUnit so it creates positional annotations
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 18 May 2015 08:51:10 +0000 (09:51 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 18 May 2015 08:51:10 +0000 (09:51 +0100)
test/jalview/analysis/AlignmentAnnotationUtilsTest.java
test/jalview/gui/PopupMenuTest.java

index 19a5163..c34bb68 100644 (file)
@@ -3,10 +3,6 @@ package jalview.analysis;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.SequenceI;
-import jalview.io.AppletFormatAdapter;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -19,6 +15,12 @@ import java.util.Map;
 import org.junit.Before;
 import org.junit.Test;
 
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SequenceI;
+import jalview.io.AppletFormatAdapter;
+
 public class AlignmentAnnotationUtilsTest
 {
   // 4 sequences x 13 positions
@@ -111,6 +113,11 @@ public class AlignmentAnnotationUtilsTest
     return result;
   }
 
+  /**
+   * Load the test alignment and generate annotations on it
+   * 
+   * @throws IOException
+   */
   @Before
   public void setUp() throws IOException
   {
@@ -120,7 +127,13 @@ public class AlignmentAnnotationUtilsTest
     AlignmentAnnotation[] anns = new AlignmentAnnotation[SEQ_ANN_COUNT];
     for (int i = 0; i < anns.length; i++)
     {
-      anns[i] = new AlignmentAnnotation("Label" + i, null, 0d);
+      /*
+       * Use the constructor for a positional annotation (with an Annotation
+       * array)
+       */
+      anns[i] = new AlignmentAnnotation("Label" + i, "Desc " + i,
+              new Annotation[]
+              {});
       anns[i].setCalcId("CalcId" + i);
       anns[i].visible = true;
       alignment.addAnnotation(anns[i]);
@@ -304,6 +317,11 @@ public class AlignmentAnnotationUtilsTest
     anns[9].graph = AlignmentAnnotation.LINE_GRAPH;
     anns[9].graphGroup = GROUP_4;
   
+    /*
+     * Generate annotations[] arrays to match aligned columns
+     */
+    // adjustForAlignment(anns);
+
     List<SequenceI> selected = selectSequences(0, 3);
     AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes,
             AlignmentAnnotationUtils.asList(anns),
index f2248a8..e1f0708 100644 (file)
@@ -19,6 +19,7 @@ import org.junit.Test;
 
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
 import jalview.datamodel.SequenceI;
 import jalview.io.AppletFormatAdapter;
 import jalview.io.FormatAdapter;
@@ -238,28 +239,32 @@ public class PopupMenuTest
 
     // PDB.secondary structure on Sequence0
     AlignmentAnnotation annotation = new AlignmentAnnotation(
-            "secondary structure", "", 0);
+            "secondary structure", "", new Annotation[]
+                    {});
     annotation.setCalcId("PDB");
     annotation.visible = true;
     seqs.get(0).addAlignmentAnnotation(annotation);
     parentPanel.getAlignment().addAnnotation(annotation);
 
     // JMOL.secondary structure on Sequence0 - hidden
-    annotation = new AlignmentAnnotation("secondary structure", "", 0);
+    annotation = new AlignmentAnnotation("secondary structure", "", new Annotation[]
+            {});
     annotation.setCalcId("JMOL");
     annotation.visible = false;
     seqs.get(0).addAlignmentAnnotation(annotation);
     parentPanel.getAlignment().addAnnotation(annotation);
 
     // Jpred.SSP on Sequence0 - hidden
-    annotation = new AlignmentAnnotation("SSP", "", 0);
+    annotation = new AlignmentAnnotation("SSP", "", new Annotation[]
+            {});
     annotation.setCalcId("JPred");
     annotation.visible = false;
     seqs.get(0).addAlignmentAnnotation(annotation);
     parentPanel.getAlignment().addAnnotation(annotation);
 
     // PDB.Temp on Sequence1
-    annotation = new AlignmentAnnotation("Temp", "", 0);
+    annotation = new AlignmentAnnotation("Temp", "", new Annotation[]
+            {});
     annotation.setCalcId("PDB");
     annotation.visible = true;
     seqs.get(1).addAlignmentAnnotation(annotation);
@@ -316,14 +321,16 @@ public class PopupMenuTest
 
     // PDB.secondary structure on Sequence0
     AlignmentAnnotation annotation = new AlignmentAnnotation(
-            "secondary structure", "", 0);
+            "secondary structure", "", new Annotation[]
+            {});
     annotation.setCalcId("PDB");
     annotation.visible = true;
     seqs.get(0).addAlignmentAnnotation(annotation);
     parentPanel.getAlignment().addAnnotation(annotation);
 
     // PDB.Temp on Sequence1
-    annotation = new AlignmentAnnotation("Temp", "", 0);
+    annotation = new AlignmentAnnotation("Temp", "", new Annotation[]
+    {});
     annotation.setCalcId("PDB");
     annotation.visible = true;
     seqs.get(1).addAlignmentAnnotation(annotation);
@@ -373,14 +380,16 @@ public class PopupMenuTest
 
     // PDB.secondary structure on Sequence0
     AlignmentAnnotation annotation = new AlignmentAnnotation(
-            "secondary structure", "", 0);
+            "secondary structure", "", new Annotation[]
+            {});
     annotation.setCalcId("PDB");
     annotation.visible = false;
     seqs.get(0).addAlignmentAnnotation(annotation);
     parentPanel.getAlignment().addAnnotation(annotation);
 
     // PDB.Temp on Sequence1
-    annotation = new AlignmentAnnotation("Temp", "", 0);
+    annotation = new AlignmentAnnotation("Temp", "", new Annotation[]
+    {});
     annotation.setCalcId("PDB2");
     annotation.visible = false;
     seqs.get(1).addAlignmentAnnotation(annotation);