JAL-4418 JAL-4392 show/hide group associated secondary structure consensus and docume...
authorJim Procter <jprocter@dundee.ac.uk>
Tue, 17 Sep 2024 15:24:53 +0000 (16:24 +0100)
committerJim Procter <jprocter@dundee.ac.uk>
Tue, 17 Sep 2024 15:24:53 +0000 (16:24 +0100)
JAL-4464 also knowndefect for not storing/restoring group associated secondary structure consensus

help/help/html/calculations/protssconsensus.html
help/help/html/menus/alwannotation.html
resources/lang/Messages.properties
src/jalview/gui/AlignFrame.java
src/jalview/jbgui/GAlignFrame.java
src/jalview/viewmodel/AlignmentViewport.java
src/jalview/workers/SecondaryStructureConsensusThread.java

index e98fb48..b98fb14 100755 (executable)
@@ -31,6 +31,9 @@
   secondary structure for an alignment of protein sequences where one or 
   more sequences have secondary structure annotation, in the same way
   as is done with the <a href="consensus.html">sequence consensus</a>.</p>
+  <p>Secondary structure consensus rows will only be shown if 
+  there are secondary structure data available for two or more 
+  sequences in the alignment.</p>
   <p>
   <em>Sources of secondary structure data</em></p>
   <p>Sequences can have several different secondary structure 
index 7e10457..9f014ea 100755 (executable)
         </strong><em> Enable or disable the display of the Consensus Logo
             above the consensus sequence.</em></li>
         <li><strong>Show SS Consensus Histogram<br>
-        </strong><em> Enable or disable the display of histogram for Secondary Structure Consensus.</em></li>
+        </strong><em> Enable or disable the display of histogram for 
+        Secondary Structure Consensus.</em><br/><br/><em>Note: 
+        consensus secondary structure rows are not shown when no secondary 
+        structure annotations are present for sequences in the alignment. 
+        Use <strong><a href="popupmenu.html#addrefannot">Add Reference Annotation</a></strong>
+         from the sequence or selection popup menu to add annotations from 
+         structures or secondary structure predictions associated with 
+         the sequences in the alignment.</em></li>
         <li><strong>Normalise Consensus Logo<br>
         </strong><em>When enabled, scales all logo stacks to the same
             height, making it easier to compare symbol diversity in
@@ -88,6 +95,8 @@
             (only available for protein alignments).</em></li>
         <li><strong>Group Consensus<br>
         </strong><em> When ticked, display a consensus row for all groups.</em></li>
+        <li><strong>Group Secondary Structure Consensus<br>
+        </strong><em> When ticked, display a consensus secondary structure row for all groups.</em></li>
       </ul></li>
   </ul>
   <p>&nbsp;</p>
index d5fb845..9df42b9 100644 (file)
@@ -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 
index e2ddefc..1cb0cab 100644 (file)
@@ -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)
index 687c22b..8c71384 100755 (executable)
@@ -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
index a48616c..529475b 100644 (file)
@@ -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
index 1263133..5b046b6 100644 (file)
@@ -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