Adding parameters to filter by occupancy difference and percent overlap

This commit is contained in:
2022-02-19 14:05:26 -06:00
parent ce88e170c1
commit 6faacd9a82
2 changed files with 74 additions and 95 deletions

View File

@@ -166,6 +166,20 @@ public class UserInterface {
.desc("Sets the maximum occupancy overlap to attempt matching")
.build();
mainOptions.addOption(highThresh);
Option occDiff = Option.builder("occdiff")
.longOpt("occupancy-difference")
.hasArg()
.argName("Number")
.desc("Maximum difference in alpha/beta occupancy to attempt matching")
.build();
mainOptions.addOption(occDiff);
Option overlapPer = Option.builder("ovper")
.longOpt("overlap-percent")
.hasArg()
.argName("Percent")
.desc("Minimum overlap percent to attempt matching (0 -100)")
.build();
mainOptions.addOption(overlapPer);
Option inputPlates = Option.builder("p")
.longOpt("plate-files")
.hasArgs()
@@ -183,8 +197,10 @@ public class UserInterface {
String cellFile = line.getOptionValue("c");
Integer lowThreshold = Integer.valueOf(line.getOptionValue(lowThresh));
Integer highThreshold = Integer.valueOf(line.getOptionValue(highThresh));
Integer occupancyDifference = Integer.valueOf(line.getOptionValue(occDiff));
Integer overlapPercent = Integer.valueOf(line.getOptionValue(overlapPer));
for(String plate: line.getOptionValues("p")) {
matchCDR3s(cellFile, plate, lowThreshold, highThreshold);
matchCDR3s(cellFile, plate, lowThreshold, highThreshold, occupancyDifference, overlapPercent);
}
}
else if(line.hasOption("cells")){
@@ -432,7 +448,8 @@ public class UserInterface {
}
}
private static void matchCDR3s(String cellFile, String plateFile, Integer lowThreshold, Integer highThreshold){
private static void matchCDR3s(String cellFile, String plateFile, Integer lowThreshold, Integer highThreshold,
Integer maxOccupancyDifference, Integer minOverlapPercent){
CellFileReader cellReader = new CellFileReader(cellFile);
PlateFileReader plateReader = new PlateFileReader(plateFile);
Plate plate = new Plate(plateReader.getFilename(), plateReader.getWells());
@@ -448,7 +465,7 @@ public class UserInterface {
highThreshold = plate.getSize() - 1;
}
List<Integer[]> cells = cellReader.getCells();
MatchingResult results = Simulator.matchCDR3s(cells, plate, lowThreshold, highThreshold, false);
MatchingResult results = Simulator.matchCDR3s(cells, plate, lowThreshold, highThreshold, maxOccupancyDifference, minOverlapPercent, false);
//result writer
MatchingFileWriter writer = new MatchingFileWriter("", results);
writer.writeErrorRateToTerminal();
@@ -462,6 +479,8 @@ public class UserInterface {
String plateFile = null;
Integer lowThreshold = 0;
Integer highThreshold = Integer.MAX_VALUE;
Integer maxOccupancyDiff = 96; //no filtering if max difference is all wells by default
Integer minOverlapPercent = 0; //no filtering if min percentage is zero by default
try {
System.out.println("\nSimulated experiment requires a cell sample file and a sample plate file.");
System.out.print("Please enter name of an existing cell sample file: ");
@@ -478,6 +497,13 @@ public class UserInterface {
}
System.out.println("What is the maximum number of alpha/beta overlap wells to attempt matching?");
highThreshold = sc.nextInt();
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();
@@ -499,7 +525,7 @@ public class UserInterface {
highThreshold = plate.getSize() - 1;
}
List<Integer[]> cells = cellReader.getCells();
MatchingResult results = Simulator.matchCDR3s(cells, plate, lowThreshold, highThreshold, true);
MatchingResult results = Simulator.matchCDR3s(cells, plate, lowThreshold, highThreshold, maxOccupancyDiff, minOverlapPercent, true);
//result writer
MatchingFileWriter writer = new MatchingFileWriter(filename, results);
writer.writeResultsToFile();
@@ -518,6 +544,8 @@ public class UserInterface {
String plateFile = null;
Integer lowThresholdCDR3 = 0;
Integer highThresholdCDR3 = Integer.MAX_VALUE;
Integer maxOccupancyDiffCDR3 = 96; //no filtering if max difference is all wells by default
Integer minOverlapPercentCDR3 = 0; //no filtering if min percentage is zero by default
Integer lowThresholdCDR1 = 0;
Integer highThresholdCDR1 = Integer.MAX_VALUE;
boolean outputCDR3Matches = false;
@@ -537,6 +565,13 @@ public class UserInterface {
}
System.out.println("What is the maximum number of CDR3 alpha/beta overlap wells to attempt matching?");
highThresholdCDR3 = sc.nextInt();
System.out.println("What is the maximum difference in CDR3 alpha/beta occupancy to attempt matching?");
maxOccupancyDiffCDR3 = sc.nextInt();
System.out.println("What is the minimum CDR3 overlap percentage to attempt matching? (0 - 100)");
minOverlapPercentCDR3 = sc.nextInt();
if (minOverlapPercentCDR3 < 0 || minOverlapPercentCDR3 > 100) {
throw new InputMismatchException("Value outside range. Minimum percent set to 0");
}
System.out.println("What is the minimum number of CDR3/CDR1 overlap wells to attempt matching?");
lowThresholdCDR1 = sc.nextInt();
if(lowThresholdCDR1 < 1){
@@ -583,7 +618,8 @@ public class UserInterface {
highThresholdCDR1 = plate.getSize() - 1;
}
List<Integer[]> cells = cellReader.getCells();
MatchingResult preliminaryResults = Simulator.matchCDR3s(cells, plate, lowThresholdCDR3, highThresholdCDR3, true);
MatchingResult preliminaryResults = Simulator.matchCDR3s(cells, plate, lowThresholdCDR3, highThresholdCDR3,
maxOccupancyDiffCDR3, minOverlapPercentCDR3, true);
MatchingResult[] results = Simulator.matchCDR1s(cells, plate, lowThresholdCDR1,
highThresholdCDR1, preliminaryResults);
MatchingFileWriter writer = new MatchingFileWriter(filename + "_FirstPass", results[0]);