From cfc781c004615161a1292a36e5d807116ea23692 Mon Sep 17 00:00:00 2001 From: TZVanaalten Date: Tue, 15 Aug 2017 12:14:13 +0100 Subject: [PATCH] JAL-2629 exported HMMs are now named correctly --- src/jalview/hmmer/HMMBuildThread.java | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/jalview/hmmer/HMMBuildThread.java b/src/jalview/hmmer/HMMBuildThread.java index 63236ea..853b5f1 100644 --- a/src/jalview/hmmer/HMMBuildThread.java +++ b/src/jalview/hmmer/HMMBuildThread.java @@ -24,9 +24,9 @@ public class HMMBuildThread implements Runnable HMMERCommands cmds = new HMMERCommands(); AlignFrame af; AlignmentI alignment; - SequenceGroup group; + boolean forGroup = false; boolean canRun = true; File hmmTemp = null; @@ -41,6 +41,7 @@ public class HMMBuildThread implements Runnable if (af.getViewport().getSelectionGroup() != null) { group = af.getViewport().getSelectionGroup(); + forGroup = true; } alignment = af.getViewport().getAlignment(); @@ -78,7 +79,7 @@ public class HMMBuildThread implements Runnable List seqs = alignment .getHMMConsensusSequences(true); cmds.setHmmSeqs(seqs); - if (group != null) + if (forGroup) { array = group.getSelectionAsNewSequences(alignment); } @@ -90,6 +91,7 @@ public class HMMBuildThread implements Runnable } array = alignment.getSequencesArray(); } + SequenceI[] newArr = new SequenceI[array.length]; int index = 0; for (SequenceI seq : array) @@ -97,6 +99,7 @@ public class HMMBuildThread implements Runnable newArr[index] = new Sequence(seq); index++; } + cmds.uniquifySequences(newArr); cmds.exportData(newArr, stoTemp, null, null); jalview.analysis.SeqsetUtils.deuniquify(cmds.hash, array); @@ -150,8 +153,21 @@ public class HMMBuildThread implements Runnable { return false; } - String command = cmds.HMMERFOLDER + cmds.HMMBUILD + cmds.NAME - + af.getName() + cmds.SPACE; + String command = cmds.HMMERFOLDER + cmds.HMMBUILD + cmds.NAME; + if (forGroup) + { + command += group.getName(); + } + else + { + String name = af.getName(); + if (name == null) + { + name = "Alignment"; + } + command += name; + } + command += cmds.SPACE; if (!alignment.isNucleotide()) { command += cmds.FORCEAMINO; // TODO check for rna -- 1.7.10.2