From: gmungoc Date: Mon, 4 Jun 2018 07:44:48 +0000 (+0100) Subject: JAL-3010 select/hide columns includes subtypes in Summary View X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d7b76647ea9f7bd2d54fddf686d120b2c1f43506;p=jalview.git JAL-3010 select/hide columns includes subtypes in Summary View --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 9de9e3b..82f9018 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -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; diff --git a/src/jalview/gui/CrossRefAction.java b/src/jalview/gui/CrossRefAction.java index 85f2498..7045481 100644 --- a/src/jalview/gui/CrossRefAction.java +++ b/src/jalview/gui/CrossRefAction.java @@ -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") diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 48b623f..debf63c 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -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); diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index f545e70..53ce80c 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -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) { diff --git a/test/jalview/gui/AlignFrameTest.java b/test/jalview/gui/AlignFrameTest.java index b0aaab9..8fe2cbd 100644 --- a/test/jalview/gui/AlignFrameTest.java +++ b/test/jalview/gui/AlignFrameTest.java @@ -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 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()