Relocate overlap threshold filters

This commit is contained in:
2022-02-20 03:05:56 -06:00
parent cb2c5a6024
commit d1c37b5ccd
4 changed files with 42 additions and 57 deletions

View File

@@ -303,10 +303,10 @@ public class UserInterface {
System.out.println("\nThe cells will be written to a CSV file.");
System.out.print("Please enter a file name: ");
filename = sc.next();
System.out.println("CDR3 sequences are more diverse than CDR1 sequences.");
System.out.println("\nCDR3 sequences are more diverse than CDR1 sequences.");
System.out.println("Please enter the factor by which distinct CDR3s outnumber CDR1s: ");
cdr1Freq = sc.nextInt();
System.out.print("Please enter the number of T-cells to generate: ");
System.out.print("\nPlease enter the number of T-cells to generate: ");
numCells = sc.nextInt();
if(numCells <= 0){
throw new InputMismatchException("Number of cells must be a positive integer.");
@@ -380,7 +380,7 @@ public class UserInterface {
System.out.println("\nThe sample plate will be written to a CSV file");
System.out.print("Please enter a name for the output file: ");
filename = sc.next();
System.out.println("Select T-cell frequency distribution function");
System.out.println("\nSelect T-cell frequency distribution function");
System.out.println("1) Poisson");
System.out.println("2) Gaussian");
System.out.println("3) Exponential");
@@ -413,12 +413,12 @@ public class UserInterface {
System.out.println("Invalid input. Defaulting to exponential.");
exponential = true;
}
System.out.print("Number of wells on plate: ");
System.out.print("\nNumber of wells on plate: ");
numWells = sc.nextInt();
if(numWells < 1){
throw new InputMismatchException("No wells on plate");
}
System.out.println("The plate can be evenly sectioned to allow multiple concentrations of T-cells/well");
System.out.println("\nThe plate can be evenly sectioned to allow multiple concentrations of T-cells/well");
System.out.println("How many sections would you like to make (minimum 1)?");
numSections = sc.nextInt();
if(numSections < 1) {
@@ -435,7 +435,7 @@ public class UserInterface {
i++;
numSections--;
}
System.out.println("Errors in amplification can induce a well dropout rate for sequences");
System.out.println("\nErrors in amplification can induce a well dropout rate for sequences");
System.out.print("Enter well dropout rate (0.0 to 1.0): ");
dropOutRate = sc.nextDouble();
if(dropOutRate < 0.0 || dropOutRate > 1.0) {
@@ -468,26 +468,18 @@ public class UserInterface {
String filename = null;
String cellFile = null;
String plateFile = null;
Integer lowThreshold = 0;
Integer highThreshold = Integer.MAX_VALUE;
try {
String str = "\nGenerating bipartite weighted graph encoding occupancy overlap data ";
str = str.concat("\nrequires 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: ");
System.out.print("\nPlease enter name of an existing cell sample file: ");
cellFile = sc.next();
System.out.print("Please enter name of an existing sample plate file: ");
System.out.print("\nPlease enter name of an existing sample plate file: ");
plateFile = sc.next();
System.out.println("The graph and occupancy data will be written to a serialized binary file.");
System.out.println("\nThe graph and occupancy data will be written to a serialized binary file.");
System.out.print("Please enter a name for the output file: ");
filename = sc.next();
System.out.println("What is the minimum number of CDR3 alpha/beta overlap wells to include in graph?");
lowThreshold = sc.nextInt();
if(lowThreshold < 1){
throw new InputMismatchException("Minimum value for low threshold set to 1");
}
System.out.println("What is the maximum number of CDR3 alpha/beta overlap wells to include in graph?");
highThreshold = sc.nextInt();
} catch (InputMismatchException ex) {
System.out.println(ex);
sc.next();
@@ -504,11 +496,9 @@ public class UserInterface {
System.out.println("Returning to main menu.");
}
else{
if(highThreshold >= plate.getSize()){
highThreshold = plate.getSize() - 1;
}
List<Integer[]> cells = cellReader.getCells();
GraphWithMapData data = Simulator.makeGraph(cells, plate, lowThreshold, highThreshold, true);
GraphWithMapData data = Simulator.makeGraph(cells, plate, 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("File I/O time is not included in results.");
@@ -520,6 +510,8 @@ public class UserInterface {
private static void matchCDR3s() throws IOException {
String filename = null;
String dataFile = null;
Integer lowThreshold = 0;
Integer highThreshold = Integer.MAX_VALUE;
Integer maxOccupancyDiff = Integer.MAX_VALUE;
Integer minOverlapPercent = 0;
try {
@@ -529,13 +521,18 @@ 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("Bipartite graph can be pre-filtered for relative alpha/beta occupancy.");
System.out.println("(To skip pre-filtering: enter number of wells on the plate used to make graph)");
System.out.println("What is the maximum difference in alpha/beta occupancy to attempt matching?");
filename = sc.next();
System.out.println("\nWhat is the minimum number of CDR3 alpha/beta overlap wells to attempt matching?");
lowThreshold = sc.nextInt();
if(lowThreshold < 1){
throw new InputMismatchException("Minimum value for low threshold set to 1");
}
System.out.println("\nWhat is the maximum number of CDR3 alpha/beta overlap wells to attempt matching?");
highThreshold = sc.nextInt();
System.out.println("\nWhat is the maximum difference in alpha/beta occupancy to attempt matching?");
maxOccupancyDiff = sc.nextInt();
System.out.println("Bipartite graph can be pre-filtered for pair well overlap percentage");
System.out.println("(To skip pre-filtering: enter 0)");
System.out.println("What is the minimum overlap percentage to attempt matching? (0 - 100)");
System.out.println("\nWell overlap percentage = pair overlap / sequence occupancy");
System.out.println("What is the minimum well overlap percentage to attempt matching? (0 to 100)");
minOverlapPercent = sc.nextInt();
if (minOverlapPercent < 0 || minOverlapPercent > 100) {
throw new InputMismatchException("Value outside range. Minimum percent set to 0");
@@ -552,7 +549,8 @@ public class UserInterface {
//set source file name
data.setSourceFilename(dataFile);
//simulate matching
MatchingResult results = Simulator.matchCDR3s(data, maxOccupancyDiff, minOverlapPercent, true);
MatchingResult results = Simulator.matchCDR3s(data, lowThreshold, highThreshold, maxOccupancyDiff,
minOverlapPercent, true);
//write results to file
MatchingFileWriter writer = new MatchingFileWriter(filename, results);
System.out.println("Writing results to file");