JAL-2050 only hide introns if exons are present! Removed 'hide introns'
[jalview.git] / src / jalview / gui / SequenceFetcher.java
index a5f218e..eb33ce7 100755 (executable)
@@ -840,9 +840,7 @@ public class SequenceFetcher extends JPanel implements Runnable
         }
         if (Cache.getDefault("HIDE_INTRONS", true))
         {
-          af.avc.markColumnsContainingFeatures(true, false, false,
-                  SequenceOntologyI.EXON);
-          af.getViewport().hideSelectedColumns();
+          hideIntronsIfPresent(af);
         }
 
         Desktop.addInternalFrame(af, title, AlignFrame.DEFAULT_WIDTH,
@@ -867,6 +865,25 @@ public class SequenceFetcher extends JPanel implements Runnable
     return al;
   }
 
+  /**
+   * Hide columns not containing 'exon' features, provided there are exon
+   * features on the alignment
+   * 
+   * @param af
+   */
+  public void hideIntronsIfPresent(AlignFrame af)
+  {
+    boolean hasExons = af.avc.markColumnsContainingFeatures(false, false,
+            false,
+            SequenceOntologyI.EXON);
+    if (hasExons)
+    {
+      af.avc.markColumnsContainingFeatures(true, false, true,
+              SequenceOntologyI.EXON);
+      af.getViewport().hideSelectedColumns();
+    }
+  }
+
   void showErrorMessage(final String error)
   {
     resetDialog();