| 1 |
|
package jalview.util; |
| 2 |
|
|
| 3 |
|
import java.io.IOException; |
| 4 |
|
import java.util.Scanner; |
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
@author |
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| |
|
| 0% |
Uncovered Elements: 131 (131) |
Complexity: 26 |
Complexity Density: 0.27 |
|
| 14 |
|
public class ProbabilityAnalyserKickstarter |
| 15 |
|
{ |
| 16 |
|
|
| |
|
| 0% |
Uncovered Elements: 130 (130) |
Complexity: 26 |
Complexity Density: 0.27 |
|
| 17 |
0 |
public static void main(String[] args)... |
| 18 |
|
throws IOException, InterruptedException |
| 19 |
|
{ |
| 20 |
|
|
| 21 |
|
|
| 22 |
0 |
HMMProbabilityDistributionAnalyser analyser = new HMMProbabilityDistributionAnalyser(); |
| 23 |
|
|
| 24 |
0 |
boolean running = true; |
| 25 |
0 |
System.out.println("ACTIVATED"); |
| 26 |
0 |
while (running) |
| 27 |
|
{ |
| 28 |
0 |
Scanner keyboard = new Scanner(System.in); |
| 29 |
0 |
String command = keyboard.nextLine(); |
| 30 |
|
|
| 31 |
0 |
Scanner inputScanner = new Scanner(command); |
| 32 |
|
|
| 33 |
0 |
if (command.indexOf("printFam") > -1) |
| 34 |
|
{ |
| 35 |
0 |
try |
| 36 |
|
{ |
| 37 |
0 |
inputScanner.next(); |
| 38 |
0 |
int index = inputScanner.nextInt(); |
| 39 |
0 |
analyser.printFam(index); |
| 40 |
0 |
continue; |
| 41 |
|
} catch (Exception e) |
| 42 |
|
{ |
| 43 |
0 |
System.out.println("Command failed"); |
| 44 |
|
} |
| 45 |
|
|
| 46 |
|
} |
| 47 |
|
|
| 48 |
0 |
if (command.indexOf("printHMM") > -1) |
| 49 |
|
{ |
| 50 |
0 |
try |
| 51 |
|
{ |
| 52 |
0 |
inputScanner.next(); |
| 53 |
0 |
int index = inputScanner.nextInt(); |
| 54 |
0 |
analyser.printHMM(index); |
| 55 |
0 |
continue; |
| 56 |
|
} catch (Exception e) |
| 57 |
|
{ |
| 58 |
0 |
System.out.println("Command failed"); |
| 59 |
|
} |
| 60 |
|
} |
| 61 |
|
|
| 62 |
0 |
if (command.indexOf("exportFam") > -1) |
| 63 |
|
{ |
| 64 |
0 |
try |
| 65 |
|
{ |
| 66 |
0 |
inputScanner.next(); |
| 67 |
0 |
int index = inputScanner.nextInt(); |
| 68 |
0 |
String location = inputScanner.next(); |
| 69 |
0 |
analyser.exportFam(index, location); |
| 70 |
0 |
continue; |
| 71 |
|
} catch (Exception e) |
| 72 |
|
{ |
| 73 |
0 |
System.out.println("Command failed"); |
| 74 |
|
} |
| 75 |
|
} |
| 76 |
|
|
| 77 |
0 |
if (command.indexOf("exportHMM") > -1) |
| 78 |
|
{ |
| 79 |
0 |
try |
| 80 |
|
{ |
| 81 |
0 |
inputScanner.next(); |
| 82 |
0 |
int index = inputScanner.nextInt(); |
| 83 |
0 |
String location = inputScanner.next(); |
| 84 |
0 |
analyser.exportHMM(index, location); |
| 85 |
0 |
continue; |
| 86 |
|
} catch (Exception e) |
| 87 |
|
{ |
| 88 |
0 |
System.out.println("Command failed"); |
| 89 |
|
} |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
|
| 93 |
|
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
|
| 97 |
0 |
if (command.indexOf("run") > -1 && !(command.indexOf("ToEnd") > -1)) |
| 98 |
|
{ |
| 99 |
0 |
try |
| 100 |
|
{ |
| 101 |
|
|
| 102 |
0 |
inputScanner.next(); |
| 103 |
|
|
| 104 |
0 |
int loops = inputScanner.nextInt(); |
| 105 |
0 |
int increments = inputScanner.nextInt(); |
| 106 |
0 |
boolean keepRaw = inputScanner.nextBoolean(); |
| 107 |
|
|
| 108 |
0 |
for (int i = 0; i < loops; i++) |
| 109 |
|
{ |
| 110 |
0 |
analyser.run(increments, keepRaw); |
| 111 |
0 |
System.out.println("Saved"); |
| 112 |
|
} |
| 113 |
0 |
System.out.println("Task completed"); |
| 114 |
0 |
continue; |
| 115 |
|
} catch (Exception e) |
| 116 |
|
{ |
| 117 |
0 |
System.out.println("Command failed"); |
| 118 |
|
} |
| 119 |
0 |
continue; |
| 120 |
|
} |
| 121 |
0 |
if ((command.indexOf("runToEnd") > -1)) |
| 122 |
|
{ |
| 123 |
0 |
try |
| 124 |
|
{ |
| 125 |
|
|
| 126 |
0 |
inputScanner.next(); |
| 127 |
0 |
int minCount = inputScanner.nextInt(); |
| 128 |
0 |
int maxCount = inputScanner.nextInt(); |
| 129 |
0 |
boolean keepRaw = inputScanner.nextBoolean(); |
| 130 |
0 |
boolean forClans = inputScanner.nextBoolean(); |
| 131 |
0 |
analyser.runToEnd(minCount, maxCount, keepRaw, forClans); |
| 132 |
0 |
System.out.println("Task completed"); |
| 133 |
|
} catch (Exception e) |
| 134 |
|
{ |
| 135 |
0 |
System.out.println("Command failed"); |
| 136 |
|
} |
| 137 |
0 |
continue; |
| 138 |
|
} |
| 139 |
|
|
| 140 |
0 |
if (command.indexOf("terminate") > -1) |
| 141 |
|
{ |
| 142 |
0 |
running = false; |
| 143 |
0 |
continue; |
| 144 |
|
} |
| 145 |
|
|
| 146 |
|
|
| 147 |
0 |
if (command.indexOf("clear") > -1) |
| 148 |
|
{ |
| 149 |
0 |
analyser.clear(); |
| 150 |
0 |
continue; |
| 151 |
|
} |
| 152 |
|
|
| 153 |
0 |
if (command.indexOf("cd") > -1) |
| 154 |
|
{ |
| 155 |
0 |
try |
| 156 |
|
{ |
| 157 |
0 |
inputScanner.next(); |
| 158 |
0 |
analyser.setFolder(inputScanner.next()); |
| 159 |
|
} catch (Exception e) |
| 160 |
|
{ |
| 161 |
0 |
System.out.println("Command failed"); |
| 162 |
|
|
| 163 |
|
} |
| 164 |
0 |
continue; |
| 165 |
|
} |
| 166 |
|
|
| 167 |
0 |
if (command.indexOf("getFamName") > -1) |
| 168 |
|
{ |
| 169 |
0 |
try |
| 170 |
|
{ |
| 171 |
0 |
inputScanner.next(); |
| 172 |
0 |
System.out.println(analyser.getFamilyName(inputScanner.nextInt())); |
| 173 |
|
|
| 174 |
|
} catch (Exception e) |
| 175 |
|
{ |
| 176 |
0 |
System.out.println("Command failed"); |
| 177 |
|
} |
| 178 |
0 |
continue; |
| 179 |
|
} |
| 180 |
0 |
if (command.indexOf("sortIntoClans") > -1) |
| 181 |
|
{ |
| 182 |
0 |
inputScanner.next(); |
| 183 |
0 |
analyser.sortIntoClans(inputScanner.next()); |
| 184 |
0 |
continue; |
| 185 |
|
|
| 186 |
|
} |
| 187 |
0 |
if (command.indexOf("setFamilies") > -1) |
| 188 |
|
{ |
| 189 |
0 |
inputScanner.next(); |
| 190 |
0 |
analyser.setFamilies(inputScanner.next()); |
| 191 |
0 |
continue; |
| 192 |
|
|
| 193 |
|
} |
| 194 |
|
|
| 195 |
0 |
if (command.indexOf("setHMMs") > -1) |
| 196 |
|
{ |
| 197 |
0 |
inputScanner.next(); |
| 198 |
0 |
analyser.setHmms(inputScanner.next()); |
| 199 |
0 |
continue; |
| 200 |
|
|
| 201 |
|
} |
| 202 |
|
|
| 203 |
0 |
if (command.indexOf("alignWithinClans") > -1) |
| 204 |
|
{ |
| 205 |
0 |
inputScanner.next(); |
| 206 |
0 |
String export = inputScanner.next(); |
| 207 |
0 |
String clans = inputScanner.next(); |
| 208 |
0 |
analyser.alignWithinClan(export, clans); |
| 209 |
0 |
continue; |
| 210 |
|
|
| 211 |
|
} |
| 212 |
|
|
| 213 |
0 |
System.out.println("Unrecognised command"); |
| 214 |
|
} |
| 215 |
|
|
| 216 |
|
|
| 217 |
|
|
| 218 |
|
|
| 219 |
|
} |
| 220 |
|
|
| 221 |
|
} |