3 import java.io.IOException;
4 import java.util.Scanner;
7 * This class contains the brain of the analyser program, and contains a number
8 * of commands for the processing of data.
14 public class ProbabilityAnalyserKickstarter
17 public static void main(String[] args)
18 throws IOException, InterruptedException
21 // this does all of the processing
22 HMMProbabilityDistributionAnalyser analyser = new HMMProbabilityDistributionAnalyser();
24 boolean running = true;
25 System.out.println("ACTIVATED");
28 Scanner keyboard = new Scanner(System.in);
29 String command = keyboard.nextLine();
31 Scanner inputScanner = new Scanner(command);
32 // prints family to console. Syntax is printFam <index>
33 if (command.indexOf("printFam") > -1)
36 int index = inputScanner.nextInt();
37 analyser.printFam(index);
40 // prints HMM to console. Syntax is printHMM <index>
41 if (command.indexOf("printHMM") > -1)
45 int index = inputScanner.nextInt();
46 analyser.printHMM(index);
49 // prints family to file in current folder. Syntax is exportFam <index>.
50 if (command.indexOf("exportFam") > -1)
54 int index = inputScanner.nextInt();
55 String location = inputScanner.next();
56 analyser.printFamToFile(index);
59 // prints HMM to file in current folder. Syntax is exportHMM <index>.
60 if (command.indexOf("exportHMM") > -1)
64 int index = inputScanner.nextInt();
65 String location = inputScanner.next();
66 analyser.printHMMToFile(index);
69 // Processes data. Syntax is run <number of loops> <increments>. The
70 // number loops specifies the number of increments the program will run.
71 // After each increment, the data stored currently in the program is
72 // exported and re-read back into the program. This is to ensure that the
73 // program can be terminated without losing a large quantity of data. The
74 // increment is the number of families read per 'save'.
75 if (command.indexOf("run") > -1)
79 int loops = inputScanner.nextInt();
80 int increments = inputScanner.nextInt();
82 for (int i = 0; i < loops; i++)
84 analyser.run(increments);
88 // terminates program. Syntax is terminate.
89 if (command.indexOf("terminate") > -1)
94 // clears files in current directory (Only a specific set of files).
96 if (command.indexOf("clear") > -1)
101 // changes current directory. Syntax is cd <directory>
102 if (command.indexOf("cd") > -1)
105 analyser.setFolder(inputScanner.next());
107 inputScanner.close();