From: tva Date: Wed, 10 Jul 2019 13:41:40 +0000 (+0100) Subject: JAL-2629 fix incorrect hmmbuild on groups behaviour X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=0d519ae0c45b0b9962b4589e84c262a71bb2f346;p=jalview.git JAL-2629 fix incorrect hmmbuild on groups behaviour --- diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 18000bd..a429ece 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1198,13 +1198,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ public boolean alignmentIsSufficient(int required) { - if (getViewport().getAlignment().getSequences().size() < required) - { - JOptionPane.showMessageDialog(this, - MessageManager.getString("label.not_enough_sequences")); - return false; - } - return true; + if (getViewport().getSequenceSelection().length < required) + { + JOptionPane.showMessageDialog(this, + MessageManager.getString("label.not_enough_sequences")); + return false; + } + return true; } /** diff --git a/src/jalview/hmmer/HMMBuild.java b/src/jalview/hmmer/HMMBuild.java index 7c14858..0c47c1d 100644 --- a/src/jalview/hmmer/HMMBuild.java +++ b/src/jalview/hmmer/HMMBuild.java @@ -4,7 +4,6 @@ import jalview.api.AlignViewportI; import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; -import jalview.datamodel.AlignmentView; import jalview.datamodel.AnnotatedCollectionI; import jalview.datamodel.ResidueCount; import jalview.datamodel.SequenceGroup; @@ -116,20 +115,18 @@ public class HMMBuild extends HmmerCommand else if (MessageManager.getString("label.groups_and_alignment") .equals(value)) { - AlignmentView av = viewport.getAlignmentView(true); - runBuildFor.add(av.getVisibleAlignment('-')); - runBuildFor.addAll(av.getVisibleGroups('-')); + runBuildFor.add(viewport.getAlignmentView(false) + .getVisibleAlignment('-')); + runBuildFor.addAll(viewport.getAlignment().getGroups()); } else if (MessageManager.getString("label.groups").equals(value)) { - AlignmentView av = viewport.getAlignmentView(false); - runBuildFor.addAll(av.getVisibleGroups('-')); + runBuildFor.addAll(viewport.getAlignment().getGroups()); } else if (MessageManager.getString("label.selected_group") .equals(value)) { - AlignmentView av = viewport.getAlignmentView(true); - runBuildFor.add(av.getVisibleAlignment('-')); + runBuildFor.add(viewport.getSelectionGroup()); } } else if (MessageManager.getString("label.use_reference") @@ -193,7 +190,10 @@ public class HMMBuild extends HmmerCommand .getSelectionAsNewSequences((AlignmentI) ac.getContext()); for (SequenceI seq : sel) { - copy.add(seq); + if (seq != null) + { + copy.add(seq); + } } } // TODO rather than copy alignment data we should anonymize in situ - @@ -337,6 +337,9 @@ public class HMMBuild extends HmmerCommand HMMFile file = new HMMFile( new FileParse(hmmFile.getAbsolutePath(), DataSourceType.FILE)); SequenceI hmmSeq = file.getHMM().getConsensusSequence(); + + + ResidueCount counts = new ResidueCount(alignment.getSequences()); hmmSeq.getHMM().setBackgroundFrequencies(counts);