Add exception handling

This commit is contained in:
eugenefischer
2022-09-26 14:28:35 -05:00
parent e795b4cdd0
commit 1ddac63b0a

View File

@@ -275,10 +275,16 @@ public class InteractiveInterface {
readDepth = sc.nextInt();
System.out.print("\nPlease enter probability of a sequence read error (0.0 to 1.0): ");
readErrorRate = sc.nextDouble();
if(readErrorRate < 0.0 || readErrorRate > 1.0) {
throw new InputMismatchException("The read error rate must be in the range [0.0, 1.0]");
}
System.out.println("\nPlease enter the probability of read error collision");
System.out.println("(the likelihood that two read errors produce the same spurious sequence)");
System.out.print("(0.0 to 1.0): ");
errorCollisionRate = sc.nextDouble();
if(errorCollisionRate < 0.0 || errorCollisionRate > 1.0) {
throw new InputMismatchException("The error collision rate must be in the range [0.0, 1.0]");
}
}
System.out.println("\nThe graph and occupancy data will be written to a file.");
System.out.print("Please enter a name for the output file: ");