From: amwaterhouse Date: Fri, 15 Apr 2005 14:56:12 +0000 (+0000) Subject: conservation & consensus recalc if group changed X-Git-Tag: Release_2_0~415 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=29b7ff78d36ab33ab298001107b232d9a10c2fe5;p=jalview.git conservation & consensus recalc if group changed --- diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index 0cf954b..7aae434 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -14,7 +14,6 @@ public class SequenceGroup boolean displayBoxes; boolean displayText; boolean colourText; - boolean aaFrequencyValid = false; public Vector sequences = new Vector(); int width = -1; public ColourSchemeI cs; @@ -79,7 +78,6 @@ public class SequenceGroup if(endRes>=col) endRes = col; - return true; } @@ -108,6 +106,24 @@ public class SequenceGroup { if(!sequences.contains(s)) sequences.addElement(s); + + + if(cs!=null) + cs.setConsensus( AAFrequency.calculate(sequences, 0, getWidth()) ); + + if(cs instanceof ConservationColourScheme) + recalcConservation(); + } + + void recalcConservation() + { + Conservation c = new Conservation(groupName, + ResidueProperties.propHash, 3, + sequences, 0, getWidth()); + c.calculate(); + c.verdict(false, 25); + ConservationColourScheme ccs = (ConservationColourScheme)cs; + ccs.conserve = c; } public void addOrRemove(SequenceI s) @@ -121,6 +137,12 @@ public class SequenceGroup public void deleteSequence(SequenceI s) { sequences.removeElement(s); + + if(cs!=null) + cs.setConsensus( AAFrequency.calculate(sequences, 0, getWidth()) ); + + if(cs instanceof ConservationColourScheme) + recalcConservation(); } @@ -184,19 +206,8 @@ public class SequenceGroup return displayBoxes; } - public Vector getAAFrequency() - { - if (aaFrequency == null || aaFrequencyValid == false) - { - aaFrequency = AAFrequency.calculate(sequences, 0, getWidth()); - aaFrequencyValid = true; - } - return aaFrequency; - } - public int getWidth() { - System.out.println("it is called"); // MC This needs to get reset when characters are inserted and deleted for (int i = 0; i < sequences.size(); i++) {