From bda5c08954f09de8129b4d8498c484d5f3a6b032 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 15 Apr 2005 14:58:13 +0000 Subject: [PATCH] public vconsensus available for PID and Blosum --- src/jalview/gui/AlignViewport.java | 45 ++++++++++++++---------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index b661b87..7fd7461 100755 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -75,6 +75,7 @@ public class AlignViewport showSequenceFeatures = b; } + public Vector vconsensus; AlignmentAnnotation consensus; AlignmentAnnotation conservation; AlignmentAnnotation quality; @@ -157,11 +158,25 @@ public class AlignViewport { Annotation [] annotations = new Annotation[alignment.getWidth()]; - Vector cons = alignment.getAAFrequency(); + // this routine prevents vconsensus becoming a new object each time + // consenus is calculated. Important for speed of Blosum62 + // and PID colouring of alignment + if(vconsensus == null) + vconsensus = alignment.getAAFrequency(); + else + { + Vector temp = alignment.getAAFrequency(); + vconsensus.clear(); + Enumeration e = temp.elements(); + while(e.hasMoreElements()) + { + vconsensus.add(e.nextElement()); + } + } Hashtable hash = null; for (int i = 0; i