From 20e70a8e299b3531d173285a2bd4de64e1ed9fc4 Mon Sep 17 00:00:00 2001
From: Jim Procter
Secondary structure consensus rows will only be shown if + there are secondary structure data available for two or more + sequences in the alignment.
Sources of secondary structure data
Sequences can have several different secondary structure diff --git a/help/help/html/menus/alwannotation.html b/help/help/html/menus/alwannotation.html index 7e10457..9f014ea 100755 --- a/help/help/html/menus/alwannotation.html +++ b/help/help/html/menus/alwannotation.html @@ -78,7 +78,14 @@ Enable or disable the display of the Consensus Logo above the consensus sequence.
diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index d5fb845..9df42b9 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -278,6 +278,7 @@ label.all_sequences_columns = All Sequences and Columns label.hide_selected_annotations = Hide selected annotations label.show_selected_annotations = Show selected annotations label.group_consensus = Group Consensus +label.group_ss_consensus = Group Secondary Structure Consensus label.group_conservation = Group Conservation label.show_consensus_histogram = Show Consensus Histogram label.show_ssconsensus_histogram = Show SS Consensus Histogram @@ -287,6 +288,7 @@ label.norm_consensus_logo = Normalise Consensus Logo label.apply_all_groups = Apply to all groups label.autocalculated_annotation = Autocalculated Annotation label.show_secondary_structure = Show Secondary Structure +label.show_secondary_structure_consensus = Show Secondary Structure Consensus label.show_first = Show first label.show_last = Show last label.struct_from_pdb = Process secondary structure from PDB @@ -1301,7 +1303,7 @@ label.quality_descr = Alignment Quality based on Blosum62 scores label.conservation_descr = Conservation of total alignment less than {0}% gaps label.consensus_descr = PID label.ssconsensus_label = Secondary Structure Consensus -label.ssconsensus_descr = SS Consensus +label.ssconsensus_descr = Secondary Structure Consensus label.complement_consensus_descr = PID for cDNA label.strucconsensus_descr = PID for base pairs label.occupancy_descr = Number of aligned positions diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index e2ddefc..1cb0cab 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -5894,6 +5894,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, return null; // No radio button is selected } + protected void showSSConsensus_actionPerformed(ActionEvent e) + { + viewport.setShowSSConsensus(showSSConsensus.getState()); + alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); + } + /* * (non-Javadoc) * @@ -5908,6 +5914,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); } + + + @Override + protected void showGroupSSConsensus_actionPerformed(ActionEvent e) + { + viewport.setShowGroupSSConsensus(showGroupSSConsensus.getState()); + alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); + + } /* * (non-Javadoc) diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 687c22b..8c71384 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -23,7 +23,6 @@ package jalview.jbgui; import java.awt.BorderLayout; import java.awt.Color; import java.awt.GridLayout; -import java.awt.Menu; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; @@ -56,13 +55,10 @@ import jalview.analysis.GeneticCodeI; import jalview.analysis.GeneticCodes; import jalview.api.SplitContainerI; import jalview.bin.Cache; -import jalview.bin.Console; import jalview.gui.JvSwingUtils; import jalview.gui.Preferences; import jalview.io.FileFormats; -import jalview.log.JLoggerLog4j; import jalview.schemes.ResidueColourScheme; -import jalview.util.Log4j; import jalview.util.MessageManager; import jalview.util.Platform; @@ -203,6 +199,10 @@ public class GAlignFrame extends JInternalFrame protected JCheckBoxMenuItem jPred = new JCheckBoxMenuItem(); + protected JCheckBoxMenuItem showSSConsensus = new JCheckBoxMenuItem(); + + protected JCheckBoxMenuItem showGroupSSConsensus = new JCheckBoxMenuItem(); + protected JCheckBoxMenuItem showGroupConsensus = new JCheckBoxMenuItem(); protected JCheckBoxMenuItem showGroupConservation = new JCheckBoxMenuItem(); @@ -866,6 +866,32 @@ public class GAlignFrame extends JInternalFrame }); + showSSConsensus.setText(MessageManager + .getString("label.show_secondary_structure_consensus")); + showSSConsensus.addActionListener(new ActionListener() + { + + @Override + public void actionPerformed(ActionEvent e) + { + showSSConsensus_actionPerformed(e); + } + + }); + + showGroupSSConsensus + .setText(MessageManager.getString("label.group_ss_consensus")); + showGroupSSConsensus.addActionListener(new ActionListener() + { + + @Override + public void actionPerformed(ActionEvent e) + { + showGroupSSConsensus_actionPerformed(e); + } + + }); + showGroupConsensus .setText(MessageManager.getString("label.group_consensus")); showGroupConsensus.addActionListener(new ActionListener() @@ -1974,9 +2000,11 @@ public class GAlignFrame extends JInternalFrame autoAnnMenu.add(showSSConsensusHistogram); autoAnnMenu.add(showSequenceLogo); autoAnnMenu.add(normaliseSequenceLogo); + // autoAnnMenu.add(showSSConsensus); autoAnnMenu.addSeparator(); autoAnnMenu.add(showGroupConservation); autoAnnMenu.add(showGroupConsensus); + autoAnnMenu.add(showGroupSSConsensus); annotationsMenu.add(autoAnnMenu); sort.add(sortIDMenuItem); @@ -2057,6 +2085,13 @@ public class GAlignFrame extends JInternalFrame // selectMenu.addSeparator(); // selectMenu.add(listenToViewSelections); } + + + protected void showSSConsensus_actionPerformed(ActionEvent e) + { + // TODO Auto-generated method stub + + } protected void createPNG_actionPerformed(ActionEvent object) { @@ -2324,13 +2359,18 @@ public class GAlignFrame extends JInternalFrame // TODO Auto-generated method stub } - protected void showGroupConsensus_actionPerformed(ActionEvent e) { // TODO Auto-generated method stub } + protected void showGroupSSConsensus_actionPerformed(ActionEvent e) + { + // TODO Auto-generated method stub + + } + protected void showGroupConservation_actionPerformed(ActionEvent e) { // TODO Auto-generated method stub diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index a48616c..529475b 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -33,7 +33,6 @@ import java.util.List; import java.util.Map; import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; -import jalview.analysis.Connectivity; import jalview.analysis.Conservation; import jalview.analysis.TreeModel; import jalview.api.AlignCalcManagerI; @@ -1046,6 +1045,8 @@ public abstract class AlignmentViewport */ protected boolean showGroupConsensus = false; + protected boolean showGroupSSConsensus = false; + /** * should consensus profile be rendered by default */ @@ -1150,6 +1151,11 @@ public abstract class AlignmentViewport return showGroupConsensus; } + public boolean isShowGroupSSConsensus() + { + return showGroupSSConsensus; + } + /** * @param showGroupConsensus * the showGroupConsensus to set @@ -1159,6 +1165,20 @@ public abstract class AlignmentViewport this.showGroupConsensus = showGroupConsensus; } + public void setShowGroupSSConsensus(boolean showGroupSSConsensus) + { + this.showGroupSSConsensus = showGroupSSConsensus; + } + + /** + * @param showSSConsensus + * the showSSConsensus to set + */ + public void setShowSSConsensus(boolean showSSConsensus) + { + this.showSSConsensus = showSSConsensus; + } + /** * * @return flag to indicate if the consensus histogram should be rendered by @@ -2268,6 +2288,7 @@ public abstract class AlignmentViewport boolean updateCalcs = false; boolean conv = isShowGroupConservation(); boolean cons = isShowGroupConsensus(); + boolean sscons = isShowGroupSSConsensus(); boolean showprf = isShowSequenceLogo(); boolean showSSprf = isShowSequenceSSLogo(); boolean showConsHist = isShowConsensusHistogram(); @@ -2322,6 +2343,10 @@ public abstract class AlignmentViewport { updateCalcs = true; alignment.addAnnotation(sg.getConsensus(), 0); + } + if (sscons) + { + updateCalcs = true; alignment.addAnnotation(sg.getSSConsensus(), 0); } // refresh the annotation rows diff --git a/src/jalview/workers/SecondaryStructureConsensusThread.java b/src/jalview/workers/SecondaryStructureConsensusThread.java index 1263133..5b046b6 100644 --- a/src/jalview/workers/SecondaryStructureConsensusThread.java +++ b/src/jalview/workers/SecondaryStructureConsensusThread.java @@ -50,8 +50,7 @@ public class SecondaryStructureConsensusThread extends AlignCalcWorker try { AlignmentAnnotation ssConsensus = getSSConsensusAnnotation(); - AlignmentAnnotation gap = getGapAnnotation(); - if ((ssConsensus == null && gap == null) || calcMan.isPending(this)) + if ((ssConsensus == null) || calcMan.isPending(this)) { calcMan.workerComplete(this); return; @@ -120,11 +119,6 @@ public class SecondaryStructureConsensusThread extends AlignCalcWorker { ssConsensus.annotations = new Annotation[aWidth]; } - AlignmentAnnotation gap = getGapAnnotation(); - if (gap != null) - { - gap.annotations = new Annotation[aWidth]; - } } /** @@ -174,16 +168,6 @@ public class SecondaryStructureConsensusThread extends AlignCalcWorker } /** - * Get the Gap annotation for the alignment - * - * @return - */ - protected AlignmentAnnotation getGapAnnotation() - { - return alignViewport.getAlignmentGapAnnotation(); - } - - /** * update the consensus annotation from the sequence profile data using * current visualization settings. */ @@ -201,11 +185,6 @@ public class SecondaryStructureConsensusThread extends AlignCalcWorker && hSSConsensus != null) { deriveSSConsensus(ssConsensus, hSSConsensus); - AlignmentAnnotation gap = getGapAnnotation(); - if (gap != null) - { - deriveGap(gap, hSSConsensus); - } ssConsensus.hasData=hSSConsensus.getCount()>0; } @@ -232,23 +211,6 @@ public class SecondaryStructureConsensusThread extends AlignCalcWorker } /** - * Convert the computed consensus data into a gap annotation row for display. - * - * @param gapAnnotation - * the annotation to be populated - * @param hconsensus - * the computed consensus data - */ - protected void deriveGap(AlignmentAnnotation gapAnnotation, - ProfilesI hconsensus) - { - long nseq = getSequences().length; - AAFrequency.completeGapAnnot(gapAnnotation, hconsensus, - hconsensus.getStartColumn(), hconsensus.getEndColumn() + 1, - nseq); - } - - /** * Get the consensus data stored on the viewport. * * @return -- 1.7.10.2