JAL-4426 Add feature to show number of sequences
authorRenia Correya <rcorreya001@dundee.ac.uk>
Thu, 6 Jun 2024 09:22:01 +0000 (10:22 +0100)
committerRenia Correya <rcorreya001@dundee.ac.uk>
Thu, 6 Jun 2024 09:22:01 +0000 (10:22 +0100)
Add feature to show number of sequences contributing to the consensus
secondary structure in the status bar/tool tip.

resources/lang/Messages.properties
src/jalview/datamodel/AlignmentAnnotation.java
src/jalview/gui/AnnotationLabels.java
src/jalview/workers/SecondaryStructureConsensusThread.java

index eb267d7..10dbe35 100644 (file)
@@ -201,6 +201,7 @@ label.score_model_sequencefeaturesimilarity = Distance measure of average number
 label.score_model_conservation = Physicochemical property conservation
 label.score_model_enhconservation = Physicochemical property conservation
 label.status_bar = Status bar
+label.sequence_count = Sequences
 label.out_to_textbox = Output to Textbox
 label.occupancy = Occupancy
 # delete Clustal - use FileFormat name instead
index d85c3d8..d660f8f 100755 (executable)
@@ -57,6 +57,8 @@ public class AlignmentAnnotation
   public static final int CDNA_PROFILE = 2;
 
   private static long counter = 0;
+  
+  private long noOfSequencesIncluded = -1;
 
   /**
    * If true, this annotations is calculated every edit, eg consensus, quality
@@ -1779,4 +1781,14 @@ public class AlignmentAnnotation
             showGroups ? "" : "nogroups");
   }
 
+  public long getNoOfSequencesIncluded()
+  {
+    return noOfSequencesIncluded;
+  }
+
+  public void setNoOfSequencesIncluded(long noOfSequencesIncluded)
+  {
+    this.noOfSequencesIncluded = noOfSequencesIncluded;
+  }
+
 }
index 79446e2..9d6dc6c 100755 (executable)
@@ -882,11 +882,19 @@ public class AnnotationLabels extends JPanel
     {
       msg.append(aa.sequenceRef.getName()).append(" : ");
     }
-
+    
     if (aa.graphGroup == -1)
     {
       msg.append(aa.label);
     }
+    
+    if(aa.getNoOfSequencesIncluded()>=0) 
+    {
+      msg.append(", ");
+      msg.append(MessageManager.getString("label.sequence_count")).append(" : ");
+      msg.append(aa.getNoOfSequencesIncluded());
+    }
+    
     else if (anns != null)
     {
       boolean first = true;
@@ -929,6 +937,9 @@ public class AnnotationLabels extends JPanel
       // jalview.gui.SeqPanel.mouseMoved(..) that formats sequence feature
       // tooltips
       String desc = aa.getDescription(true).trim();
+      if(aa.getNoOfSequencesIncluded()>=0) {
+        desc+=", " + MessageManager.getString("label.sequence_count")+" : "+aa.getNoOfSequencesIncluded();
+      }
       if (!desc.toLowerCase(Locale.ROOT).startsWith(HTML_START_TAG))
       {
         tooltip.append(HTML_START_TAG);
index 282b337..62d29f0 100644 (file)
@@ -249,6 +249,8 @@ public class SecondaryStructureConsensusThread extends AlignCalcWorker
     if (immediate || !calcMan.isWorking(this) && ssConsensus != null
             && ssConsensusProfile != null)
     {
+      if(ssConsensusProfile.get(0)!=null)
+      ssConsensus.setNoOfSequencesIncluded(ssConsensusProfile.get(0).getHeight());
       deriveSSConsensus(ssConsensus, ssConsensusProfile);
       AlignmentAnnotation gap = getGapAnnotation();
       if (gap != null)