JAL-1705 (new preference option to) hide introns when fetching genomic
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 11 Apr 2016 14:51:46 +0000 (15:51 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 11 Apr 2016 14:51:46 +0000 (15:51 +0100)
sequences

resources/lang/Messages.properties
src/jalview/gui/Preferences.java
src/jalview/gui/SequenceFetcher.java
src/jalview/jbgui/GPreferences.java

index 05505a4..9a064b1 100644 (file)
@@ -608,6 +608,7 @@ label.automatically_set_id_width = Automatically set ID width
 label.figure_id_column_width = Figure ID column width
 label.use_modeller_output = Use Modeller Output
 label.wrap_alignment = Wrap Alignment
+label.hide_introns = Hide Introns
 label.right_align_ids = Right Align Ids
 label.sequence_name_italics = Italic Sequence Ids
 label.open_overview = Open Overview
@@ -1258,6 +1259,7 @@ label.biojs_html_export = BioJS
 label.scale_as_cdna = Scale protein residues to codons
 label.scale_protein_to_cdna = Scale Protein to cDNA
 label.scale_protein_to_cdna_tip = Make protein residues same width as codons in split frame views
+label.hide_introns_tip = Hide intron columns after fetching genomic sequences
 info.select_annotation_row = Select Annotation Row
 info.enter_search_text_here = Enter Search Text Here
 info.enter_search_text_to_enable = Enter Search Text to Enable
index c7e1332..8b33deb 100755 (executable)
@@ -88,6 +88,8 @@ public class Preferences extends GPreferences
 
   public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
 
+  public static final String HIDE_INTRONS = "HIDE_INTRONS";
+
   private static final int MIN_FONT_SIZE = 1;
 
   private static final int MAX_FONT_SIZE = 30;
@@ -175,11 +177,11 @@ public class Preferences extends GPreferences
     dasTab.add(dasSource, BorderLayout.CENTER);
     wsPrefs = new WsPreferences();
     wsTab.add(wsPrefs, BorderLayout.CENTER);
-    int width = 500, height = 450;
+    int width = 500, height = 470;
     if (new jalview.util.Platform().isAMac())
     {
       width = 570;
-      height = 480;
+      height = 500;
     }
 
     Desktop.addInternalFrame(frame,
@@ -241,6 +243,7 @@ public class Preferences extends GPreferences
     idItalics.setSelected(Cache.getDefault("ID_ITALICS", true));
 
     wrap.setSelected(Cache.getDefault("WRAP_ALIGNMENT", false));
+    hideIntrons.setSelected(Cache.getDefault(HIDE_INTRONS, true));
 
     gapSymbolCB.addItem("-");
     gapSymbolCB.addItem(".");
@@ -458,6 +461,8 @@ public class Preferences extends GPreferences
 
     Cache.applicationProperties.setProperty("WRAP_ALIGNMENT",
             Boolean.toString(wrap.isSelected()));
+    Cache.applicationProperties.setProperty(HIDE_INTRONS,
+            Boolean.toString(hideIntrons.isSelected()));
 
     Cache.applicationProperties.setProperty("STARTUP_FILE",
             startupFileTextfield.getText());
index 784474e..b6ee041 100755 (executable)
 package jalview.gui;
 
 import jalview.api.FeatureSettingsModelI;
+import jalview.bin.Cache;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
+import jalview.io.gff.SequenceOntologyI;
 import jalview.util.DBRefUtils;
 import jalview.util.MessageManager;
 import jalview.ws.dbsources.das.api.DasSourceRegistryI;
@@ -156,9 +158,9 @@ public class SequenceFetcher extends JPanel implements Runnable
       }
     }
     if (sfetch == null
-            || dasRegistry != jalview.bin.Cache.getDasSourceRegistry()
-            || lastDasSourceRegistry != (jalview.bin.Cache
-                    .getDasSourceRegistry().getDasRegistryURL() + jalview.bin.Cache
+            || dasRegistry != Cache.getDasSourceRegistry()
+            || lastDasSourceRegistry != (Cache.getDasSourceRegistry()
+                    .getDasRegistryURL() + Cache
                     .getDasSourceRegistry().getLocalSourceString())
                     .hashCode())
     {
@@ -173,7 +175,7 @@ public class SequenceFetcher extends JPanel implements Runnable
                 .getString("status.init_sequence_database_fetchers"),
                 Thread.currentThread().hashCode());
       }
-      dasRegistry = jalview.bin.Cache.getDasSourceRegistry();
+      dasRegistry = Cache.getDasSourceRegistry();
       dasRegistry.refreshSources();
 
       jalview.ws.SequenceFetcher sf = new jalview.ws.SequenceFetcher();
@@ -592,7 +594,8 @@ public class SequenceFetcher extends JPanel implements Runnable
               }
             } catch (Exception e)
             {
-              jalview.bin.Cache.log.info("Error retrieving " + item
+              Cache.log.info(
+                      "Error retrieving " + item
                       + " from " + proxy.getDbName(), e);
               nextfetch.add(item);
             }
@@ -833,8 +836,15 @@ public class SequenceFetcher extends JPanel implements Runnable
 
         if (preferredFeatureColours != null)
         {
-          af.viewport.applyFeaturesStyle(preferredFeatureColours);
+          af.getViewport().applyFeaturesStyle(preferredFeatureColours);
         }
+        if (Cache.getDefault("HIDE_INTRONS", true))
+        {
+          af.avc.markColumnsContainingFeatures(true, false, false,
+                  SequenceOntologyI.EXON);
+          af.getViewport().hideSelectedColumns();
+        }
+
         Desktop.addInternalFrame(af, title, AlignFrame.DEFAULT_WIDTH,
                 AlignFrame.DEFAULT_HEIGHT);
 
@@ -843,7 +853,7 @@ public class SequenceFetcher extends JPanel implements Runnable
 
         try
         {
-          af.setMaximum(jalview.bin.Cache.getDefault("SHOW_FULLSCREEN",
+          af.setMaximum(Cache.getDefault("SHOW_FULLSCREEN",
                   false));
         } catch (Exception ex)
         {
index b5c1804..0aafe50 100755 (executable)
@@ -110,6 +110,8 @@ public class GPreferences extends JPanel
 
   protected JCheckBox wrap = new JCheckBox();
 
+  protected JCheckBox hideIntrons = new JCheckBox();
+
   protected JComboBox<String> sortby = new JComboBox<String>();
 
   protected JComboBox<String> sortAnnBy = new JComboBox<String>();
@@ -1149,7 +1151,7 @@ public class GPreferences extends JPanel
     startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);
     startupCheckbox.setSelected(true);
     startupFileTextfield.setFont(LABEL_FONT);
-    startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20));
+    startupFileTextfield.setBounds(new Rectangle(173, 328, 330, 20));
     startupFileTextfield.addMouseListener(new MouseAdapter()
     {
       @Override
@@ -1163,19 +1165,19 @@ public class GPreferences extends JPanel
     });
 
     sortby.setFont(LABEL_FONT);
-    sortby.setBounds(new Rectangle(172, 260, 155, 21));
+    sortby.setBounds(new Rectangle(172, 280, 155, 20));
     JLabel sortLabel = new JLabel();
     sortLabel.setFont(LABEL_FONT);
     sortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
     sortLabel.setText(MessageManager.getString("label.sort_by"));
     sortAnnBy.setFont(LABEL_FONT);
-    sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21));
+    sortAnnBy.setBounds(new Rectangle(172, 305, 110, 20));
     JLabel sortAnnLabel = new JLabel();
     sortAnnLabel.setFont(LABEL_FONT);
     sortAnnLabel.setHorizontalAlignment(SwingConstants.RIGHT);
     sortAnnLabel.setText(MessageManager.getString("label.sort_ann_by"));
     sortAutocalc.setFont(LABEL_FONT);
-    sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21));
+    sortAutocalc.setBounds(new Rectangle(290, 305, 165, 20));
 
     JPanel annsettingsPanel = new JPanel();
     annsettingsPanel.setBounds(new Rectangle(173, 34, 320, 75));
@@ -1219,6 +1221,12 @@ public class GPreferences extends JPanel
     wrap.setHorizontalAlignment(SwingConstants.TRAILING);
     wrap.setHorizontalTextPosition(SwingConstants.LEADING);
     wrap.setText(MessageManager.getString("label.wrap_alignment"));
+    hideIntrons.setFont(LABEL_FONT);
+    hideIntrons.setHorizontalAlignment(SwingConstants.TRAILING);
+    hideIntrons.setHorizontalTextPosition(SwingConstants.LEADING);
+    hideIntrons.setText(MessageManager.getString("label.hide_introns"));
+    hideIntrons.setToolTipText(MessageManager
+            .getString("label.hide_introns_tip"));
     rightAlign.setFont(LABEL_FONT);
     rightAlign.setForeground(Color.black);
     rightAlign.setHorizontalAlignment(SwingConstants.RIGHT);
@@ -1236,8 +1244,8 @@ public class GPreferences extends JPanel
     openoverv.setHorizontalTextPosition(SwingConstants.LEFT);
     openoverv.setText(MessageManager.getString(("label.open_overview")));
     JPanel jPanel2 = new JPanel();
-    jPanel2.setBounds(new Rectangle(7, 17, 158, 310));
-    jPanel2.setLayout(new GridLayout(14, 1));
+    jPanel2.setBounds(new Rectangle(7, 17, 158, 330));
+    jPanel2.setLayout(new GridLayout(15, 1));
     jPanel2.add(fullScreen);
     jPanel2.add(openoverv);
     jPanel2.add(seqLimit);
@@ -1249,6 +1257,7 @@ public class GPreferences extends JPanel
     jPanel2.add(scaleProteinToCdna);
     jPanel2.add(gapLabel);
     jPanel2.add(wrap);
+    jPanel2.add(hideIntrons);
     jPanel2.add(sortLabel);
     jPanel2.add(sortAnnLabel);
     jPanel2.add(startupCheckbox);