X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fworkers%2FInformationThread.java;h=c8084b92914453b61371ca22c1259ecd853a0fe4;hb=747167089ecf8d6afc70d417f5a20352e029bd95;hp=d42598c032b6ab237119bebaacdd196e9d410691;hpb=344e33b5217c85d7f237974224b0db367bcca667;p=jalview.git diff --git a/src/jalview/workers/InformationThread.java b/src/jalview/workers/InformationThread.java index d42598c..c8084b9 100644 --- a/src/jalview/workers/InformationThread.java +++ b/src/jalview/workers/InformationThread.java @@ -44,73 +44,38 @@ public class InformationThread extends AlignCalcWorker @Override public void run() { - if (calcMan.isPending(this)) + if (alignViewport.getAlignment().getHmmSequences().isEmpty()) { return; } - calcMan.notifyStart(this); - // long started = System.currentTimeMillis(); - - try + if (alignViewport.isClosed()) { - if (calcMan.isPending(this)) - { - // another instance of this is waiting to run - calcMan.workerComplete(this); - return; - } - while (!calcMan.notifyWorking(this)) - { - // another thread in progress, wait my turn - try - { - if (ap != null) - { - ap.paintAlignment(false, false); - } - Thread.sleep(200); - } catch (Exception ex) - { - ex.printStackTrace(); - } - } - if (alignViewport.isClosed()) - { - abortAndDestroy(); - return; - } + abortAndDestroy(); + return; + } - AlignmentI alignment = alignViewport.getAlignment(); - int aWidth = alignment == null ? -1 : alignment.getWidth(); - if (aWidth < 0) - { - calcMan.workerComplete(this); - return; - } + AlignmentI alignment = alignViewport.getAlignment(); + int aWidth = alignment == null ? -1 : alignment.getWidth(); + if (aWidth < 0) + { + return; + } - /* - * compute information profiles for any HMM consensus sequences - * for the alignment or sub-groups - */ - computeProfiles(alignment); + /* + * compute information profiles for any HMM consensus sequences + * for the alignment or sub-groups + */ + computeProfiles(alignment); - /* - * construct the corresponding annotations - */ - updateAnnotation(); + /* + * construct the corresponding annotations + */ + updateAnnotation(); - if (ap != null) - { - ap.adjustAnnotationHeight(); - ap.paintAlignment(true, true); - } - } catch (OutOfMemoryError error) + if (ap != null) { - calcMan.disableWorker(this); - ap.raiseOOMWarning("calculating information", error); - } finally - { - calcMan.workerComplete(this); + ap.adjustAnnotationHeight(); + ap.paintAlignment(true, true); } } @@ -129,10 +94,10 @@ public class InformationThread extends AlignCalcWorker /* * alignment HMM profile */ - SequenceI seq = alignment.getHmmConsensus(); - if (seq != null) + List seqs = alignment.getHmmSequences(); + if (!seqs.isEmpty()) { - HiddenMarkovModel hmm = seq.getHMM(); + HiddenMarkovModel hmm = seqs.get(0).getHMM(); ProfilesI hmmProfiles = AAFrequency.calculateHMMProfiles(hmm, width, 0, width, alignViewport.isIgnoreBelowBackground(), alignViewport.isInfoLetterHeight()); @@ -145,10 +110,10 @@ public class InformationThread extends AlignCalcWorker List groups = alignment.getGroups(); for (SequenceGroup group : groups) { - seq = group.getHmmConsensus(); - if (seq != null) + seqs = group.getHmmSequences(); + if (!seqs.isEmpty()) { - HiddenMarkovModel hmm = seq.getHMM(); + HiddenMarkovModel hmm = seqs.get(0).getHMM(); ProfilesI hmmProfiles = AAFrequency.calculateHMMProfiles(hmm, width, 0, width, group.isIgnoreBelowBackground(), group.isUseInfoLetterHeight()); @@ -174,7 +139,7 @@ public class InformationThread extends AlignCalcWorker */ protected AlignmentAnnotation getGapAnnotation() { - return alignViewport.getOccupancyAnnotation(); + return alignViewport.getAlignmentGapAnnotation(); } /** @@ -193,20 +158,28 @@ public class InformationThread extends AlignCalcWorker /* * annotation for alignment HMM consensus if present */ - SequenceI hmmSeq = alignment.getHmmConsensus(); - ProfilesI profile = alignViewport.getHmmProfiles(); - float m = updateInformationAnnotation(hmmSeq, profile, null, infos); - maxInformation = Math.max(maxInformation, m); + List hmmSeqs = alignment.getHmmSequences(); + if (!hmmSeqs.isEmpty()) + { + ProfilesI profile = alignViewport.getHmmProfiles(); + float m = updateInformationAnnotation(hmmSeqs.get(0), profile, null, + infos); + maxInformation = Math.max(maxInformation, m); + } /* * annotation for group HMM consensus if present */ for (SequenceGroup group : alignment.getGroups()) { - hmmSeq = group.getHmmConsensus(); - ProfilesI profiles = group.getHmmProfiles(); - m = updateInformationAnnotation(hmmSeq, profiles, group, infos); - maxInformation = Math.max(maxInformation, m); + hmmSeqs = group.getHmmSequences(); + if (!hmmSeqs.isEmpty()) + { + ProfilesI profiles = group.getHmmProfiles(); + float m = updateInformationAnnotation(hmmSeqs.get(0), profiles, + group, infos); + maxInformation = Math.max(maxInformation, m); + } } /*