X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequenceGroup.java;h=a01c0a5ef67be699bbc0c6926397431aac31c7dc;hb=066a11f5ce0580b9d7bf0f855432c341aa279bd4;hp=9ed3a53d926b914b8158540794ede96a36f9d637;hpb=b1ec3caa00df9beb437ca31647268158a79748c5;p=jalview.git diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index 9ed3a53..a01c0a5 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) - * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1) + * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. * @@ -14,6 +14,7 @@ * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.datamodel; @@ -469,12 +470,28 @@ public class SequenceGroup implements AnnotatedCollectionI } /** - * Max Gaps Threshold for performing a conservation calculation TODO: make - * this a configurable property - or global to an alignment view + * Max Gaps Threshold (percent) for performing a conservation calculation */ private int consPercGaps = 25; /** + * @return Max Gaps Threshold for performing a conservation calculation + */ + public int getConsPercGaps() + { + return consPercGaps; + } + + /** + * set Max Gaps Threshold (percent) for performing a conservation calculation + * @param consPercGaps + */ + public void setConsPercGaps(int consPercGaps) + { + this.consPercGaps = consPercGaps; + } + + /** * calculate residue conservation for group - but only if necessary. */ public void recalcConservation() @@ -483,10 +500,6 @@ public class SequenceGroup implements AnnotatedCollectionI { return; } - if (cs != null) - { - cs.alignmentChanged(this, null); - } try { Hashtable cnsns[] = AAFrequency.calculate(sequences, startRes, @@ -498,7 +511,6 @@ public class SequenceGroup implements AnnotatedCollectionI if (cs != null) { cs.setConsensus(cnsns); - cs.alignmentChanged(this, null); } if ((conservation != null) @@ -518,10 +530,13 @@ public class SequenceGroup implements AnnotatedCollectionI if (cs.conservationApplied()) { cs.setConservation(c); - cs.alignmentChanged(this, null); } } } + if (cs != null) + { + cs.alignmentChanged(context!=null ? context : this, null); + } } catch (java.lang.OutOfMemoryError err) { // TODO: catch OOM @@ -1194,11 +1209,15 @@ public class SequenceGroup implements AnnotatedCollectionI ArrayList annot = new ArrayList(); for (SequenceI seq : (Vector) sequences) { - for (AlignmentAnnotation al : seq.getAnnotation()) + AlignmentAnnotation[] aa = seq.getAnnotation(); + if (aa != null) { - if (al.groupRef == this) + for (AlignmentAnnotation al : aa) { - annot.add(al); + if (al.groupRef == this) + { + annot.add(al); + } } } } @@ -1231,4 +1250,21 @@ public class SequenceGroup implements AnnotatedCollectionI { sequences.clear(); } + private AnnotatedCollectionI context; + /** + * set the alignment or group context for this group + * @param context + */ + public void setContext(AnnotatedCollectionI context) + { + this.context = context; + } + /* (non-Javadoc) + * @see jalview.datamodel.AnnotatedCollectionI#getContext() + */ + @Override + public AnnotatedCollectionI getContext() + { + return context; + } }