From bba03888565b5277a487f3186b6f6444477466e6 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 12 Apr 2016 14:01:42 +0100 Subject: [PATCH] JAL-2050 only hide introns if exons are present! Removed 'hide introns' checkbox from Preferences gui --- resources/lang/Messages.properties | 2 -- src/jalview/gui/Preferences.java | 9 ++------- src/jalview/gui/SequenceFetcher.java | 23 ++++++++++++++++++++--- src/jalview/jbgui/GPreferences.java | 21 ++++++--------------- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 9a064b1..05505a4 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -608,7 +608,6 @@ 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 @@ -1259,7 +1258,6 @@ 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 diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 8b33deb..c7e1332 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -88,8 +88,6 @@ 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; @@ -177,11 +175,11 @@ public class Preferences extends GPreferences dasTab.add(dasSource, BorderLayout.CENTER); wsPrefs = new WsPreferences(); wsTab.add(wsPrefs, BorderLayout.CENTER); - int width = 500, height = 470; + int width = 500, height = 450; if (new jalview.util.Platform().isAMac()) { width = 570; - height = 500; + height = 480; } Desktop.addInternalFrame(frame, @@ -243,7 +241,6 @@ 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("."); @@ -461,8 +458,6 @@ 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()); diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index a5f218e..eb33ce7 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -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(); diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 0aafe50..b5c1804 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -110,8 +110,6 @@ public class GPreferences extends JPanel protected JCheckBox wrap = new JCheckBox(); - protected JCheckBox hideIntrons = new JCheckBox(); - protected JComboBox sortby = new JComboBox(); protected JComboBox sortAnnBy = new JComboBox(); @@ -1151,7 +1149,7 @@ public class GPreferences extends JPanel startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT); startupCheckbox.setSelected(true); startupFileTextfield.setFont(LABEL_FONT); - startupFileTextfield.setBounds(new Rectangle(173, 328, 330, 20)); + startupFileTextfield.setBounds(new Rectangle(172, 310, 330, 20)); startupFileTextfield.addMouseListener(new MouseAdapter() { @Override @@ -1165,19 +1163,19 @@ public class GPreferences extends JPanel }); sortby.setFont(LABEL_FONT); - sortby.setBounds(new Rectangle(172, 280, 155, 20)); + sortby.setBounds(new Rectangle(172, 260, 155, 21)); 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, 305, 110, 20)); + sortAnnBy.setBounds(new Rectangle(172, 285, 110, 21)); 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, 305, 165, 20)); + sortAutocalc.setBounds(new Rectangle(290, 285, 165, 21)); JPanel annsettingsPanel = new JPanel(); annsettingsPanel.setBounds(new Rectangle(173, 34, 320, 75)); @@ -1221,12 +1219,6 @@ 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); @@ -1244,8 +1236,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, 330)); - jPanel2.setLayout(new GridLayout(15, 1)); + jPanel2.setBounds(new Rectangle(7, 17, 158, 310)); + jPanel2.setLayout(new GridLayout(14, 1)); jPanel2.add(fullScreen); jPanel2.add(openoverv); jPanel2.add(seqLimit); @@ -1257,7 +1249,6 @@ 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); -- 1.7.10.2