From 8f22d20c5011a7df6279c2ba4fbc2c2b0d9c6aeb Mon Sep 17 00:00:00 2001 From: Renia Correya Date: Thu, 6 Jun 2024 10:22:01 +0100 Subject: [PATCH] JAL-4426 Add feature to show number of sequences Add feature to show number of sequences contributing to the consensus secondary structure in the status bar/tool tip. --- resources/lang/Messages.properties | 1 + src/jalview/datamodel/AlignmentAnnotation.java | 12 ++++++++++++ src/jalview/gui/AnnotationLabels.java | 13 ++++++++++++- .../workers/SecondaryStructureConsensusThread.java | 2 ++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index eb267d7..10dbe35 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -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 diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index d85c3d8..d660f8f 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -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; + } + } diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 79446e2..9d6dc6c 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -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); diff --git a/src/jalview/workers/SecondaryStructureConsensusThread.java b/src/jalview/workers/SecondaryStructureConsensusThread.java index 282b337..62d29f0 100644 --- a/src/jalview/workers/SecondaryStructureConsensusThread.java +++ b/src/jalview/workers/SecondaryStructureConsensusThread.java @@ -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) -- 1.7.10.2