3 import jalview.datamodel.AlignmentI;
4 import jalview.datamodel.HiddenMarkovModel;
5 import jalview.datamodel.SequenceI;
6 import jalview.gui.AlignFrame;
7 import jalview.io.DataSourceType;
8 import jalview.io.FileFormat;
9 import jalview.io.FileLoader;
10 import jalview.util.MessageManager;
12 import java.io.FileNotFoundException;
13 import java.io.IOException;
16 public class HMMAlignThread implements Runnable
23 HiddenMarkovModel hmm;
29 Map<Integer, SequenceI> hmmSeqs;
31 public HMMAlignThread(AlignFrame af, boolean createNewFrame)
34 alignment = af.getViewport().getAlignment();
35 hmm = alignment.getSequenceAt(0).getHMM();
36 newFrame = createNewFrame;
42 barID = System.currentTimeMillis();
43 af.setProgressBar(MessageManager.getString("status.running_hmmbuild"),
50 hmmSeqs = alignment.getHMMConsensusSequences(true);
51 HMMERCommands.exportData(alignment, true, true, hmm);
52 } catch (FileNotFoundException e)
54 // TODO Auto-generated catch block
61 } catch (IOException | InterruptedException e)
63 // TODO Auto-generated catch block
69 } catch (IOException | InterruptedException e)
71 // TODO Auto-generated catch block
79 af.setProgressBar(MessageManager.getString("status.running_hmmalign"),
84 private void runCommand() throws IOException, InterruptedException
86 String command = HMMERCommands.HMMALIGN;
87 if (!hmm.getFileHeader().contains("HMMER3/f"))
89 command += HMMERCommands.ALLCOL;
91 command += HMMERCommands.TRIM + HMMERCommands.OUTPUTALIGNMENT
92 + HMMERCommands.JALVIEWDIRECTORY + HMMERCommands.HMMBUFFER
93 + HMMERCommands.JALVIEWDIRECTORY
94 + HMMERCommands.ALIGNMENTBUFFER;
95 HMMERCommands.runCommand(command);
98 private void importData() throws IOException, InterruptedException
102 FileLoader loader = new FileLoader();
103 AlignFrame newAFrame = loader.LoadFileWaitTillLoaded(
104 HMMERCommands.ALIGNMENTINPUT, DataSourceType.FILE);
109 af.getViewport().getAlignment().getSequences().clear();
110 af.loadJalviewDataFile(HMMERCommands.ALIGNMENTBUFFER,
111 DataSourceType.FILE, FileFormat.Stockholm, null);
116 private void addSeqs(AlignFrame alignFrame)
118 for (Map.Entry<Integer, SequenceI> entry : hmmSeqs.entrySet())
120 SequenceI seq = entry.getValue();
121 Integer pos = entry.getKey();
122 HMMERCommands.addHMMConsensusSequence(alignFrame, seq, pos);