X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequenceGroup.java;h=b4cb3b17024087dd717c678610991f0f2648a3fb;hb=a94284081155efc1183fac5d8254826db542a933;hp=5d0841e72afd4cfc60b6e62336094e354cc10fc5;hpb=2f4f1d8fb6878271b64f327bc58c895f458137af;p=jalview.git diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index 5d0841e..b4cb3b1 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -1,19 +1,21 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1) + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * 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 . + * 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; @@ -470,12 +472,29 @@ 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() @@ -484,10 +503,6 @@ public class SequenceGroup implements AnnotatedCollectionI { return; } - if (cs != null) - { - cs.alignmentChanged(this, null); - } try { Hashtable cnsns[] = AAFrequency.calculate(sequences, startRes, @@ -499,7 +514,6 @@ public class SequenceGroup implements AnnotatedCollectionI if (cs != null) { cs.setConsensus(cnsns); - cs.alignmentChanged(this, null); } if ((conservation != null) @@ -519,10 +533,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 @@ -570,9 +587,10 @@ public class SequenceGroup implements AnnotatedCollectionI consensus.annotations = new Annotation[aWidth]; // should be alignment width AAFrequency.completeConsensus(consensus, cnsns, startRes, endRes + 1, - ignoreGapsInConsensus, showSequenceLogo, nseq); // TODO: setting container - // for - // ignoreGapsInConsensusCalculation); + ignoreGapsInConsensus, showSequenceLogo, nseq); // TODO: setting + // container + // for + // ignoreGapsInConsensusCalculation); } /** @@ -1195,11 +1213,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); + } } } } @@ -1232,4 +1254,27 @@ 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; + } }