From: gmungoc Date: Mon, 11 Apr 2016 14:51:46 +0000 (+0100) Subject: JAL-1705 (new preference option to) hide introns when fetching genomic X-Git-Tag: Release_2_10_0~266^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=20ee237bee8261a2e14299a90d97a88701d47733;p=jalview.git JAL-1705 (new preference option to) hide introns when fetching genomic sequences --- diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 05505a4..9a064b1 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -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 diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index c7e1332..8b33deb 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -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()); diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index 784474e..b6ee041 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -21,10 +21,12 @@ 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) { diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index b5c1804..0aafe50 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -110,6 +110,8 @@ 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(); @@ -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);