X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FSequenceGroup.java;h=1df45a2b2ce02af19d24f98b363cbbbcae28f42a;hb=fb27f86492eb06fc39b0578e1c31de8b4c26491a;hp=d4069104c632bed90c27051a67c38c2cb8e2ab89;hpb=865a855a4ca87eadb3e5ff284ed32ed307d9c34b;p=jalview.git diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index d406910..1df45a2 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -470,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() @@ -484,22 +500,17 @@ public class SequenceGroup implements AnnotatedCollectionI { return; } - if (cs != null) - { - cs.alignmentChanged(this, null); - } try { Hashtable cnsns[] = AAFrequency.calculate(sequences, startRes, endRes + 1, showSequenceLogo); if (consensus != null) { - _updateConsensusRow(cnsns); + _updateConsensusRow(cnsns, sequences.size()); } if (cs != null) { cs.setConsensus(cnsns); - cs.alignmentChanged(this, null); } if ((conservation != null) @@ -519,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 @@ -553,7 +567,7 @@ public class SequenceGroup implements AnnotatedCollectionI public Hashtable[] consensusData = null; - private void _updateConsensusRow(Hashtable[] cnsns) + private void _updateConsensusRow(Hashtable[] cnsns, long nseq) { if (consensus == null) { @@ -570,7 +584,7 @@ public class SequenceGroup implements AnnotatedCollectionI consensus.annotations = new Annotation[aWidth]; // should be alignment width AAFrequency.completeConsensus(consensus, cnsns, startRes, endRes + 1, - ignoreGapsInConsensus, showSequenceLogo); // TODO: setting container + ignoreGapsInConsensus, showSequenceLogo, nseq); // TODO: setting container // for // ignoreGapsInConsensusCalculation); } @@ -1232,4 +1246,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; + } }