import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
+import jalview.gui.JvOptionPane;
import jalview.gui.Preferences;
import jalview.io.DataSourceType;
import jalview.io.FileFormat;
HMMERCommands cmds = new HMMERCommands();
AlignFrame af;
AlignmentI alignment;
-
SequenceGroup group;
+ boolean forGroup = false;
boolean canRun = true;
File hmmTemp = null;
if (af.getViewport().getSelectionGroup() != null)
{
group = af.getViewport().getSelectionGroup();
+ forGroup = true;
}
alignment = af.getViewport().getAlignment();
{
try
{
+ SequenceI[] array;
List<SequenceI> seqs = alignment
.getHMMConsensusSequences(true);
cmds.setHmmSeqs(seqs);
- if (group != null)
+ if (forGroup)
{
- SequenceI[] array = group.getSelectionAsNewSequences(alignment);
-
- cmds.exportData(array, stoTemp, null, null);
+ array = group.getSelectionAsNewSequences(alignment);
}
else
{
{
alignment.padGaps();
}
- cmds.exportData(alignment.getSequencesArray(), stoTemp, null,
- null);
+ array = alignment.getSequencesArray();
+ }
+
+ SequenceI[] newArr = new SequenceI[array.length];
+ int index = 0;
+ for (SequenceI seq : array)
+ {
+ newArr[index] = new Sequence(seq);
+ index++;
}
+
+ cmds.uniquifySequences(newArr);
+ cmds.exportData(newArr, stoTemp, null, null);
+ jalview.analysis.SeqsetUtils.deuniquify(cmds.hash, array);
+
} catch (FileNotFoundException e)
{
// TODO Auto-generated catch block
}
try
{
- runCommand();
+ boolean ran = runCommand();
+ if (!ran)
+ {
+ JvOptionPane.showInternalMessageDialog(af,
+ MessageManager.getString("warn.hmmbuild_failed"));
+ return;
+ }
} catch (IOException | InterruptedException e)
{
// TODO Auto-generated catch block
- private void runCommand() throws IOException, InterruptedException
+ private boolean runCommand() throws IOException, InterruptedException
{
- final String command = cmds.HMMERFOLDER + cmds.HMMBUILD + cmds.NAME
- + af.getName() + cmds.SPACE + hmmTemp.getAbsolutePath()
+ File file = new File(cmds.HMMERFOLDER + "/binaries/hmmbuild.exe");
+ if (!file.canExecute())
+ {
+ return false;
+ }
+ 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
+ }
+ else
+ {
+ command += cmds.FORCEDNA;
+ }
+
+ command += hmmTemp.getAbsolutePath()
+ cmds.SPACE + stoTemp.getAbsolutePath() + cmds.SPACE;
- cmds.runCommand(command);
+ return cmds.runCommand(command);
}
private void importData() throws IOException, InterruptedException