Merge branch 'develop' into trialMerge
[jalview.git] / test / jalview / io / FeaturesFileTest.java
index ab07289..6f7bebe 100644 (file)
@@ -481,13 +481,15 @@ public class FeaturesFileTest
     assertEquals(expected, exported);
 
     /*
-     * include non-positional features
+     * include non-positional features, but still no positional features
      */
     fr.setGroupVisibility("uniprot", true);
     exported = featuresFile.printJalviewFormat(al.getSequencesArray(), fr,
             true);
-    expected = "Cath\tFER_CAPAA\t-1\t0\t0\tDomain\t0.0\n"
-            + "desc1\tFER_CAPAN\t-1\t0\t0\tPfam\t1.3\n"
+    expected = "\nSTARTGROUP\tuniprot\n"
+            + "Cath\tFER_CAPAA\t-1\t0\t0\tDomain\t0.0\n"
+            + "ENDGROUP\tuniprot\n\n"
+            + "desc1\tFER_CAPAN\t-1\t0\t0\tPfam\t1.3\n\n"
             + "desc3\tFER1_SOLLC\t-1\t0\t0\tPfam\n"; // NaN is not output
     assertEquals(expected, exported);
 
@@ -501,8 +503,8 @@ public class FeaturesFileTest
     expected = "METAL\tcc9900\n"
             + "GAMMA-TURN\tscore|ff0000|00ffff|noValueMin|20.0|95.0|below|66.0\n"
             + "\nSTARTGROUP\tuniprot\n"
-            + "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n"
             + "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\t0.0\n"
+            + "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n"
             + "ENDGROUP\tuniprot\n";
     assertEquals(expected, exported);
 
@@ -513,19 +515,46 @@ public class FeaturesFileTest
     exported = featuresFile.printJalviewFormat(al.getSequencesArray(), fr,
             false);
     /*
-     * features are output within group, ordered by sequence and by type
+     * features are output within group, ordered by sequence and type
      */
     expected = "METAL\tcc9900\n"
             + "Pfam\tff0000\n"
             + "GAMMA-TURN\tscore|ff0000|00ffff|noValueMin|20.0|95.0|below|66.0\n"
             + "\nSTARTGROUP\tuniprot\n"
-            + "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n"
             + "Iron\tFER_CAPAA\t-1\t39\t39\tMETAL\t0.0\n"
             + "<html>Pfam domain<a href=\"http://pfam.xfam.org/family/PF00111\">Pfam_3_4</a></html>\tFER_CAPAA\t-1\t20\t20\tPfam\t0.0\n"
+            + "Turn\tFER_CAPAA\t-1\t36\t38\tGAMMA-TURN\t0.0\n"
+            + "ENDGROUP\tuniprot\n"
+            // null / empty group features are output after named groups
+            + "\ndesc2\tFER_CAPAN\t-1\t4\t9\tPfam\n"
+            + "\ndesc4\tFER1_SOLLC\t-1\t5\t8\tPfam\t-2.6\n";
+    assertEquals(expected, exported);
+
+    /*
+     * hide uniprot group
+     */
+    fr.setGroupVisibility("uniprot", false);
+    expected = "METAL\tcc9900\n" + "Pfam\tff0000\n"
+            + "GAMMA-TURN\tscore|ff0000|00ffff|noValueMin|20.0|95.0|below|66.0\n"
+            + "\ndesc2\tFER_CAPAN\t-1\t4\t9\tPfam\n"
+            + "\ndesc4\tFER1_SOLLC\t-1\t5\t8\tPfam\t-2.6\n";
+    exported = featuresFile.printJalviewFormat(al.getSequencesArray(), fr,
+            false);
+    assertEquals(expected, exported);
+
+    /*
+     * include non-positional (overrides group not shown)
+     */
+    exported = featuresFile.printJalviewFormat(al.getSequencesArray(), fr,
+            true);
+    expected = "METAL\tcc9900\n" + "Pfam\tff0000\n"
+            + "GAMMA-TURN\tscore|ff0000|00ffff|noValueMin|20.0|95.0|below|66.0\n"
+            + "\nSTARTGROUP\tuniprot\n"
+            + "Cath\tFER_CAPAA\t-1\t0\t0\tDomain\t0.0\n"
             + "ENDGROUP\tuniprot\n"
-            // null / empty group features output after features in named
-            // groups:
+            + "\ndesc1\tFER_CAPAN\t-1\t0\t0\tPfam\t1.3\n"
             + "desc2\tFER_CAPAN\t-1\t4\t9\tPfam\n"
+            + "\ndesc3\tFER1_SOLLC\t-1\t0\t0\tPfam\n"
             + "desc4\tFER1_SOLLC\t-1\t5\t8\tPfam\t-2.6\n";
     assertEquals(expected, exported);
   }
@@ -631,8 +660,8 @@ public class FeaturesFileTest
     // Pfam feature columns include strand(+), phase(2), attributes
     expected = gffHeader
             + "FER_CAPAA\tCath\tMETAL\t39\t39\t1.2\t.\t.\n"
-            + "FER_CAPAN\ts3dm\tGAMMA-TURN\t36\t38\t2.1\t.\t.\n"
-            + "FER_CAPAN\tUniprot\tPfam\t20\t20\t0.0\t+\t2\tx=y;black=white\n";
+            + "FER_CAPAN\tUniprot\tPfam\t20\t20\t0.0\t+\t2\tx=y;black=white\n"
+            + "FER_CAPAN\ts3dm\tGAMMA-TURN\t36\t38\t2.1\t.\t.\n";
     assertEquals(expected, exported);
   }
 
@@ -750,7 +779,7 @@ public class FeaturesFileTest
     /*
      * now threshold to Score > 1.1 - should exclude sf2
      */
-    FeatureColourI fc = new FeatureColour(Color.white, Color.BLACK,
+    FeatureColourI fc = new FeatureColour(null, Color.white, Color.BLACK,
             Color.white, 0f, 2f);
     fc.setAboveThreshold(true);
     fc.setThreshold(1.1f);
@@ -826,7 +855,7 @@ public class FeaturesFileTest
      * now threshold to Score > 1.1 - should exclude sf2
      * (and there should be no empty STARTGROUP/ENDGROUP output)
      */
-    FeatureColourI fc = new FeatureColour(Color.white, Color.BLACK,
+    FeatureColourI fc = new FeatureColour(null, Color.white, Color.BLACK,
             Color.white, 0f, 2f);
     fc.setAboveThreshold(true);
     fc.setThreshold(1.1f);