X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequenceGroup.java;h=da47a8981783b8a68c62eeb1c31b14cbdd49cb44;hb=7d6bf4ac01167499c0f4e07de63edcdd72a6d595;hp=ee4d7c23722c2660524c9ce16bca8ab3e9c207ac;hpb=88d5ff9b60bc7c99a427c2d6fc9d04823e185d68;p=jalview.git diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index ee4d7c2..da47a89 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -23,14 +23,11 @@ package jalview.datamodel; import jalview.analysis.AAFrequency; import jalview.analysis.Conservation; import jalview.schemes.ColourSchemeI; -import jalview.schemes.ResidueProperties; import java.awt.Color; import java.util.ArrayList; -import java.util.Hashtable; import java.util.List; import java.util.Map; -import java.util.Vector; /** * Collects a set contiguous ranges on a set of sequences @@ -46,8 +43,6 @@ public class SequenceGroup implements AnnotatedCollectionI Conservation conserve; - Vector aaFrequency; - boolean displayBoxes = true; boolean displayText = true; @@ -529,24 +524,26 @@ public class SequenceGroup implements AnnotatedCollectionI } // TODO: try harder to detect changes in state in order to minimise // recalculation effort + boolean upd = false; try { - Hashtable cnsns[] = AAFrequency.calculate(sequences, startRes, + ProfilesI cnsns = AAFrequency.calculate(sequences, startRes, endRes + 1, showSequenceLogo); if (consensus != null) { _updateConsensusRow(cnsns, sequences.size()); + upd = true; } if (cs != null) { cs.setConsensus(cnsns); + upd = true; } if ((conservation != null) || (cs != null && cs.conservationApplied())) { - Conservation c = new Conservation(groupName, - ResidueProperties.propHash, 3, sequences, startRes, + Conservation c = new Conservation(groupName, sequences, startRes, endRes + 1); c.calculate(); c.verdict(false, consPercGaps); @@ -561,6 +558,8 @@ public class SequenceGroup implements AnnotatedCollectionI cs.setConservation(c); } } + // eager update - will cause a refresh of overview regardless + upd = true; } if (cs != null && !defer) { @@ -570,14 +569,14 @@ public class SequenceGroup implements AnnotatedCollectionI } else { - return false; + return upd; } } catch (java.lang.OutOfMemoryError err) { // TODO: catch OOM System.out.println("Out of memory loading groups: " + err); } - return false; + return upd; } private void _updateConservationRow(Conservation c) @@ -600,9 +599,9 @@ public class SequenceGroup implements AnnotatedCollectionI c.completeAnnotations(conservation, null, startRes, endRes + 1); } - public Hashtable[] consensusData = null; + public ProfilesI consensusData = null; - private void _updateConsensusRow(Hashtable[] cnsns, long nseq) + private void _updateConsensusRow(ProfilesI cnsns, long nseq) { if (consensus == null) { @@ -1062,7 +1061,8 @@ public class SequenceGroup implements AnnotatedCollectionI /** * - * @return automatically calculated consensus row + * @return automatically calculated consensus row note: the row is a stub if a + * consensus calculation has not yet been performed on the group */ public AlignmentAnnotation getConsensus() { @@ -1269,10 +1269,14 @@ public class SequenceGroup implements AnnotatedCollectionI @Override public Iterable findAnnotation(String calcId) { - ArrayList aa = new ArrayList(); + List aa = new ArrayList(); + if (calcId == null) + { + return aa; + } for (AlignmentAnnotation a : getAlignmentAnnotation()) { - if (a.getCalcId() == calcId) + if (calcId.equals(a.getCalcId())) { aa.add(a); }