Clean up interactive text, bugfix

This commit is contained in:
2022-02-19 22:21:09 -06:00
parent 0026d8cdfe
commit 5b2ed165d0
3 changed files with 20 additions and 8 deletions

View File

@@ -72,9 +72,9 @@ public class Simulator {
Map<Integer, Integer> allAlphas = samplePlate.assayWellsPeptideP(alphaIndex);
Map<Integer, Integer> allBetas = samplePlate.assayWellsPeptideP(betaIndex);
int alphaCount = allAlphas.size();
if(verbose){System.out.println("all alphas count: " + alphaCount);}
if(verbose){System.out.println("All alphas count: " + alphaCount);}
int betaCount = allBetas.size();
if(verbose){System.out.println("all betas count: " + betaCount);}
if(verbose){System.out.println("All betas count: " + betaCount);}
if(verbose){System.out.println("Well maps made");}
@@ -87,9 +87,9 @@ public class Simulator {
filterByOccupancyThreshold(allBetas, lowThreshold, numWells - 1);
if(verbose){System.out.println("Peptides removed");}
int pairableAlphaCount = allAlphas.size();
if(verbose){System.out.println("Remaining alpha count: " + pairableAlphaCount);}
if(verbose){System.out.println("Remaining alphas count: " + pairableAlphaCount);}
int pairableBetaCount = allBetas.size();
if(verbose){System.out.println("Remaining beta count: " + pairableBetaCount);}
if(verbose){System.out.println("Remaining betas count: " + pairableBetaCount);}
if(verbose){System.out.println("Making vertex maps");}
//For the SimpleWeightedBipartiteGraphMatrixGenerator, all vertices must have
@@ -119,10 +119,10 @@ public class Simulator {
double[][] weights = new double[plateVtoAMap.size()][plateVtoBMap.size()];
countPeptidesAndFillMatrix(samplePlate, allAlphas, allBetas, plateAtoVMap,
plateBtoVMap, alphaIndex, betaIndex, alphaWellCounts, betaWellCounts, weights);
if(verbose){System.out.println("matrix created");}
if(verbose){System.out.println("Matrix created");}
//create bipartite graph
if(verbose){System.out.println("creating graph");}
if(verbose){System.out.println("Creating graph");}
//the graph object
SimpleWeightedGraph<Integer, DefaultWeightedEdge> graph =
new SimpleWeightedGraph<>(DefaultWeightedEdge.class);

View File

@@ -351,7 +351,7 @@ public class UserInterface {
// writer.writePlateFile();
// }
//method to output a CSV of sample plate
//Output a CSV of sample plate
private static void makePlate() {
String cellFile = null;
String filename = null;
@@ -454,6 +454,7 @@ public class UserInterface {
}
}
//Output serialized binary of GraphAndMapData object
private static void makeCDR3Graph() {
String filename = null;
String cellFile = null;
@@ -462,7 +463,7 @@ public class UserInterface {
Integer highThreshold = Integer.MAX_VALUE;
try {
String str = "\nGenerating bipartite weighted graph encoding occupancy data requires ";
str.concat("a cell sample file and a sample plate file.");
str = str.concat("a cell sample file and a sample plate file.");
System.out.println(str);
System.out.print("Please enter name of an existing cell sample file: ");
cellFile = sc.next();
@@ -500,10 +501,13 @@ public class UserInterface {
List<Integer[]> cells = cellReader.getCells();
GraphWithMapData data = Simulator.makeGraph(cells, plate, lowThreshold, highThreshold, true);
GraphDataObjectWriter dataWriter = new GraphDataObjectWriter(filename, data);
System.out.println("Writing graph and occupancy data to file. This may take some time.");
System.out.println("Time to write file is not included in simulation time data.");
dataWriter.writeDataToFile();
}
}
//Simulate matching and output CSV file of results
private static void matchCDR3s() throws IOException {
String filename = null;
String dataFile = null;
@@ -516,6 +520,13 @@ public class UserInterface {
System.out.println("The matching results will be written to a file.");
System.out.print("Please enter a name for the output file: ");
filename = sc.next();
System.out.println("What is the maximum difference in alpha/beta occupancy to attempt matching?");
maxOccupancyDiff = sc.nextInt();
System.out.println("What is the minimum overlap percentage to attempt matching? (0 - 100)");
minOverlapPercent = sc.nextInt();
if (minOverlapPercent < 0 || minOverlapPercent > 100) {
throw new InputMismatchException("Value outside range. Minimum percent set to 0");
}
} catch (InputMismatchException ex) {
System.out.println(ex);
sc.next();
@@ -529,6 +540,7 @@ public class UserInterface {
MatchingResult results = Simulator.matchCDR3s(data, maxOccupancyDiff, minOverlapPercent, true);
//write results to file
MatchingFileWriter writer = new MatchingFileWriter(filename, results);
System.out.println("Writing results to file");
writer.writeResultsToFile();
}