3 import jalview.datamodel.Alignment;
4 import jalview.datamodel.AlignmentI;
5 import jalview.datamodel.HiddenMarkovModel;
6 import jalview.datamodel.SequenceI;
7 import jalview.gui.AlignFrame;
8 import jalview.io.HMMFile;
9 import jalview.io.StockholmFile;
11 import java.io.BufferedReader;
12 import java.io.IOException;
13 import java.io.InputStreamReader;
14 import java.io.PrintWriter;
15 import java.util.List;
17 public class HMMERCommands
19 // Path of hmmer binaries directory
20 static final String HMMERFOLDER = "H:/Documents/";
22 static final String HMMALIGN = HMMERFOLDER + "hmmalign ";
24 static final String HMMBUILD = HMMERFOLDER + "hmmbuild ";
26 static final String HMMSEARCH = HMMERFOLDER + "hmmsearch ";
28 static final String JALVIEWDIRECTORY = "C:/Users/TZVanaalten/git/jalview/";
30 static final String HMMBUFFER = "src/jalview/hmmer/hmm_buffer.hmm ";
32 static final String ALIGNMENTBUFFER = "src/jalview/hmmer/alignment_buffer.sto ";
34 static final String ALIGNMENTINPUT = "src/jalview/hmmer/alignment_input.sto ";
36 static final String OUTPUTALIGNMENT = "-o " + JALVIEWDIRECTORY
39 static final String NAME = "-n ";
41 static final String SPACE = " ";
43 static final String ALLCOL = "--allcol ";
45 static final String TRIM = "--trim ";
49 * Runs a command in the terminal.
53 * @throws InterruptedException
55 public static void runCommand(String command)
56 throws IOException, InterruptedException
58 final Process p = Runtime.getRuntime().exec(command);
60 new Thread(new Runnable()
65 BufferedReader input = new BufferedReader(
66 new InputStreamReader(p.getInputStream()));
71 while ((line = input.readLine()) != null)
73 System.out.println(line);
75 } catch (IOException e)
86 * Exports an alignment to the buffer location in Jalview.
91 public static void exportData(AlignmentI alignment,
92 boolean exportAlignment, boolean exportHMM, HiddenMarkovModel hmm)
97 List<SequenceI> list = alignment.getSequences();
98 SequenceI[] array = new SequenceI[list.size()];
100 StockholmFile file = new StockholmFile(new Alignment(array));
102 String output = file.print();
103 PrintWriter writer = new PrintWriter(ALIGNMENTBUFFER);
104 writer.println(output);
110 HMMFile file = new HMMFile(hmm);
111 file.exportFile(HMMBUFFER);
115 public static void addHMMConsensusSequence(AlignFrame af, SequenceI seq,
118 seq.getHMM().initHMMSequence(af, position);
119 AlignmentI al = af.getViewport().getAlignment();
120 af.getViewport().setAlignment(al);
121 af.alignPanel.adjustAnnotationHeight();
122 af.getViewport().updateSequenceIdColours();
123 af.buildSortByAnnotationScoresMenu();