JAL-3010 select/hide columns includes subtypes in Summary View
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 4 Jun 2018 07:44:48 +0000 (08:44 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 4 Jun 2018 07:44:48 +0000 (08:44 +0100)
src/jalview/gui/AlignFrame.java
src/jalview/gui/CrossRefAction.java
src/jalview/gui/FeatureSettings.java
src/jalview/gui/SequenceFetcher.java
test/jalview/gui/AlignFrameTest.java

index 9de9e3b..82f9018 100644 (file)
@@ -5517,22 +5517,23 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   }
 
   /**
-   * Hides columns containing (or not containing) a specified feature, provided
-   * that would not leave all columns hidden
+   * Hides columns containing (or not containing) the specified feature(s),
+   * provided that would not leave all columns hidden
    * 
-   * @param featureType
    * @param columnsContaining
+   * @param featureTypes
+   * 
    * @return
    */
-  public boolean hideFeatureColumns(String featureType,
-          boolean columnsContaining)
+  public boolean hideFeatureColumns(boolean columnsContaining,
+          String... featureTypes)
   {
     boolean notForHiding = avc.markColumnsContainingFeatures(
-            columnsContaining, false, false, featureType);
+            columnsContaining, false, false, featureTypes);
     if (notForHiding)
     {
       if (avc.markColumnsContainingFeatures(!columnsContaining, false,
-              false, featureType))
+              false, featureTypes))
       {
         getViewport().hideSelectedColumns();
         return true;
index 85f2498..7045481 100644 (file)
@@ -143,7 +143,7 @@ public class CrossRefAction implements Runnable
               AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
       if (Cache.getDefault("HIDE_INTRONS", true))
       {
-        newFrame.hideFeatureColumns(SequenceOntologyI.EXON, false);
+        newFrame.hideFeatureColumns(false, SequenceOntologyI.EXON);
       }
       String newtitle = String.format("%s %s %s",
               dna ? MessageManager.getString("label.proteins")
index 48b623f..debf63c 100644 (file)
@@ -533,8 +533,9 @@ public class FeatureSettings extends JPanel
       @Override
       public void actionPerformed(ActionEvent arg0)
       {
+        String[] types = getTermsInScope(type);
         fr.ap.alignFrame.avc.markColumnsContainingFeatures(false, false,
-                false, type);
+                false, types);
       }
     });
     JMenuItem clearCols = new JMenuItem(MessageManager
@@ -544,8 +545,9 @@ public class FeatureSettings extends JPanel
       @Override
       public void actionPerformed(ActionEvent arg0)
       {
+        String[] types = getTermsInScope(type);
         fr.ap.alignFrame.avc.markColumnsContainingFeatures(true, false,
-                false, type);
+                false, types);
       }
     });
     JMenuItem hideCols = new JMenuItem(
@@ -555,7 +557,8 @@ public class FeatureSettings extends JPanel
       @Override
       public void actionPerformed(ActionEvent arg0)
       {
-        fr.ap.alignFrame.hideFeatureColumns(type, true);
+        String[] types = getTermsInScope(type);
+        fr.ap.alignFrame.hideFeatureColumns(true, types);
       }
     });
     JMenuItem hideOtherCols = new JMenuItem(
@@ -565,7 +568,8 @@ public class FeatureSettings extends JPanel
       @Override
       public void actionPerformed(ActionEvent arg0)
       {
-        fr.ap.alignFrame.hideFeatureColumns(type, false);
+        String[] types = getTermsInScope(type);
+        fr.ap.alignFrame.hideFeatureColumns(false, types);
       }
     });
     men.add(selCols);
index f545e70..53ce80c 100755 (executable)
@@ -1047,7 +1047,7 @@ public class SequenceFetcher extends JPanel implements Runnable
         }
         if (Cache.getDefault("HIDE_INTRONS", true))
         {
-          af.hideFeatureColumns(SequenceOntologyI.EXON, false);
+          af.hideFeatureColumns(false, SequenceOntologyI.EXON);
         }
         if (newAlframes != null)
         {
index b0aaab9..8fe2cbd 100644 (file)
@@ -91,13 +91,13 @@ public class AlignFrameTest
     /*
      * hiding a feature not present does nothing
      */
-    assertFalse(alignFrame.hideFeatureColumns("exon", true));
+    assertFalse(alignFrame.hideFeatureColumns(true, "exon"));
     assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty());
 
     assertEquals(alignFrame.getViewport().getAlignment().getHiddenColumns()
             .getNumberOfRegions(), 0);
 
-    assertFalse(alignFrame.hideFeatureColumns("exon", false));
+    assertFalse(alignFrame.hideFeatureColumns(false, "exon"));
     assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty());
 
     assertEquals(alignFrame.getViewport().getAlignment().getHiddenColumns()
@@ -106,7 +106,7 @@ public class AlignFrameTest
     /*
      * hiding a feature in all columns does nothing
      */
-    assertFalse(alignFrame.hideFeatureColumns("Metal", true));
+    assertFalse(alignFrame.hideFeatureColumns(true, "Metal"));
     assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty());
 
     assertEquals(alignFrame.getViewport().getAlignment().getHiddenColumns()
@@ -122,7 +122,7 @@ public class AlignFrameTest
     fc.setAboveThreshold(true);
     fc.setThreshold(5f);
     alignFrame.getFeatureRenderer().setColour("Metal", fc);
-    assertTrue(alignFrame.hideFeatureColumns("Metal", true));
+    assertTrue(alignFrame.hideFeatureColumns(true, "Metal"));
     HiddenColumns hidden = alignFrame.getViewport().getAlignment().getHiddenColumns();
     assertEquals(hidden.getNumberOfRegions(), 1);
     Iterator<int[]> regions = hidden.iterator();
@@ -136,7 +136,7 @@ public class AlignFrameTest
      * [1-3], [6-8] base zero
      */
     alignFrame.getViewport().showAllHiddenColumns();
-    assertTrue(alignFrame.hideFeatureColumns("Turn", true));
+    assertTrue(alignFrame.hideFeatureColumns(true, "Turn"));
     regions = alignFrame.getViewport().getAlignment()
             .getHiddenColumns().iterator();
     assertEquals(alignFrame.getViewport().getAlignment().getHiddenColumns()