diff --git a/src/main/java/BiGpairSEQ.java b/src/main/java/BiGpairSEQ.java index 7e5c0bc..f42bde6 100644 --- a/src/main/java/BiGpairSEQ.java +++ b/src/main/java/BiGpairSEQ.java @@ -10,6 +10,9 @@ public class BiGpairSEQ { private static String plateFilename = null; private static GraphWithMapData graphInMemory = null; private static String graphFilename = null; + private static boolean cacheCells = false; + private static boolean cachePlate = false; + private static boolean cacheGraph = true; public static void main(String[] args) { if (args.length == 0) { @@ -92,4 +95,27 @@ public class BiGpairSEQ { graphFilename = filename; } + public static boolean cacheCells() { + return cacheCells; + } + + public static void setCacheCells(boolean cacheCells) { + BiGpairSEQ.cacheCells = cacheCells; + } + + public static boolean cachePlate() { + return cachePlate; + } + + public static void setCachePlate(boolean cachePlate) { + BiGpairSEQ.cachePlate = cachePlate; + } + + public static boolean cacheGraph() { + return cacheGraph; + } + + public static void setCacheGraph(boolean cacheGraph) { + BiGpairSEQ.cacheGraph = cacheGraph; + } } diff --git a/src/main/java/InteractiveInterface.java b/src/main/java/InteractiveInterface.java index 8c4fa6e..15b4983 100644 --- a/src/main/java/InteractiveInterface.java +++ b/src/main/java/InteractiveInterface.java @@ -27,6 +27,7 @@ public class InteractiveInterface { //Need to re-do the CDR3/CDR1 matching to correspond to new pattern //System.out.println("5) Generate CDR3/CDR1 occupancy graph"); //System.out.println("6) Simulate CDR3/CDR1 T cell matching"); + System.out.println("8) Options"); System.out.println("9) About/Acknowledgments"); System.out.println("0) Exit"); try { @@ -37,6 +38,7 @@ public class InteractiveInterface { case 3 -> makeCDR3Graph(); case 4 -> matchCDR3s(); //case 6 -> matchCellsCDR1(); + case 8 -> options(); case 9 -> acknowledge(); case 0 -> quit = true; default -> throw new InputMismatchException("Invalid input."); @@ -493,6 +495,39 @@ public class InteractiveInterface { // } // } + private static void options(){ + boolean backToMain = false; + while(!backToMain) { + System.out.println("-------------OPTIONS----------------"); + System.out.println("1) Turn cell sample file caching " + getOnOff(!BiGpairSEQ.cacheCells())); + System.out.println("2) Turn sample plate file caching " + getOnOff(!BiGpairSEQ.cachePlate())); + System.out.println("3) Turn graph/data file caching " + getOnOff(!BiGpairSEQ.cacheGraph())); + System.out.println("0) Return to main menu"); + try { + input = sc.nextInt(); + switch (input) { + case 1 -> BiGpairSEQ.setCacheCells(!BiGpairSEQ.cacheCells()); + case 2 -> BiGpairSEQ.setCachePlate(!BiGpairSEQ.cachePlate()); + case 3 -> BiGpairSEQ.setCacheGraph(!BiGpairSEQ.cacheGraph()); + case 0 -> backToMain = true; + default -> throw new InputMismatchException("Invalid input."); + } + } catch (InputMismatchException ex) { + System.out.println(ex); + sc.next(); + } + } + } + + private static String getOnOff(boolean b) { + if (b) { + return "on"; + } + else { + return "off"; + } + } + private static void acknowledge(){ System.out.println("This program simulates BiGpairSEQ, a graph theory based adaptation"); System.out.println("of the pairSEQ algorithm for pairing T cell receptor sequences.");