JAL-2490 add non-positional feature case to test prior to refactoring
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 22 May 2017 12:02:47 +0000 (13:02 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 22 May 2017 12:02:47 +0000 (13:02 +0100)
test/jalview/io/FeaturesFileTest.java

index d6f1e8b..be5e68d 100644 (file)
@@ -406,6 +406,7 @@ public class FeaturesFileTest
             + "GAMMA-TURN\tred|0,255,255|20.0|95.0|below|66.0\n"
             + "Pfam\tred\n"
             + "STARTGROUP\tuniprot\n"
+            + "Cath\tFER_CAPAA\t-1\t0\t0\tDomain\n" // non-positional feature
             + "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\n"
             + "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\n"
             + "<html>Pfam domain<a href=\"http://pfam.xfam.org/family/PF00111\">Pfam_3_4</a></html>\tFER_CAPAA\t-1\t20\t20\tPfam\n"
@@ -415,23 +416,33 @@ public class FeaturesFileTest
     featuresFile.parse(al.getDataset(), colours, false);
 
     /*
-     * first with no features displayed
+     * first with no features displayed, exclude non-positional features
      */
     FeatureRenderer fr = af.alignPanel.getFeatureRenderer();
     Map<String, FeatureColourI> visible = fr.getDisplayedFeatureCols();
     String exported = featuresFile.printJalviewFormat(
-            al.getSequencesArray(), visible);
+            al.getSequencesArray(), visible, true, false);
     String expected = "No Features Visible";
     assertEquals(expected, exported);
 
     /*
+     * include non-positional features
+     */
+    af.getViewport().setShowNPFeats(true);
+    exported = featuresFile.printJalviewFormat(al.getSequencesArray(),
+            visible, true, true);
+    expected = "\nSTARTGROUP\tuniprot\nCath\tFER_CAPAA\t-1\t0\t0\tDomain\t0.0\nENDGROUP\tuniprot\n";
+    assertEquals(expected, exported);
+
+    /*
      * set METAL (in uniprot group) and GAMMA-TURN visible, but not Pfam
      */
+    af.getViewport().setShowNPFeats(false);
     fr.setVisible("METAL");
     fr.setVisible("GAMMA-TURN");
     visible = fr.getDisplayedFeatureCols();
     exported = featuresFile.printJalviewFormat(al.getSequencesArray(),
-            visible);
+            visible, true, false);
     expected = "METAL\tcc9900\n"
             + "GAMMA-TURN\tff0000|00ffff|20.0|95.0|below|66.0\n"
             + "\nSTARTGROUP\tuniprot\n"
@@ -446,7 +457,7 @@ public class FeaturesFileTest
     fr.setVisible("Pfam");
     visible = fr.getDisplayedFeatureCols();
     exported = featuresFile.printJalviewFormat(al.getSequencesArray(),
-            visible);
+            visible, true, false);
     /*
      * note the order of feature types is uncontrolled - derives from
      * FeaturesDisplayed.featuresDisplayed which is a HashSet