Added metadata to MatchingResult to enable CLI options

This commit is contained in:
2022-02-22 18:36:30 -06:00
parent 90ae2ff474
commit 906c06062f
8 changed files with 417 additions and 370 deletions

View File

@@ -7,7 +7,6 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.util.*;
import java.util.regex.Pattern;
public class PlateFileWriter {
private int size;
@@ -18,7 +17,7 @@ public class PlateFileWriter {
private String filename;
private String sourceFileName;
private String[] headers;
private List<Integer> concentrations;
private Integer[] concentrations;
private boolean isExponential = false;
public PlateFileWriter(String filename, Plate plate) {
@@ -37,8 +36,8 @@ public class PlateFileWriter {
}
this.error = plate.getError();
this.wells = plate.getWells();
this.concentrations = Arrays.asList(plate.getConcentrations());
concentrations.sort(Comparator.reverseOrder());
this.concentrations = plate.getPopulations();
Arrays.sort(concentrations);
}
public void writePlateFile(){
@@ -59,7 +58,7 @@ public class PlateFileWriter {
}
}
//this took forever
//this took forever and I don't use it
List<List<String>> rows = new ArrayList<>();
List<String> tmp = new ArrayList<>();
for(int i = 0; i < wellsAsStrings.size(); i++){//List<Integer[]> w: wells){
@@ -73,14 +72,19 @@ public class PlateFileWriter {
}
rows.add(tmp);
}
//build string of well concentrations
StringBuilder concen = new StringBuilder();
for(Integer i: concentrations){
concen.append(i.toString());
concen.append(" ");
}
String concenString = concen.toString();
//get list of well populations
List<Integer> wellPopulations = Arrays.asList(concentrations);
//make string out of populations list
StringBuilder populationsStringBuilder = new StringBuilder();
populationsStringBuilder.append(wellPopulations.remove(0).toString());
for(Integer i: wellPopulations){
populationsStringBuilder.append(", ");
populationsStringBuilder.append(i.toString());
}
String wellPopulationsString = populationsStringBuilder.toString();
//set CSV format
CSVFormat plateFileFormat = CSVFormat.Builder.create()
.setCommentMarker('#')
.build();
@@ -92,7 +96,7 @@ public class PlateFileWriter {
printer.printComment("Each row represents one well on the plate.");
printer.printComment("Plate size: " + size);
printer.printComment("Error rate: " + error);
printer.printComment("Concentrations: " + concenString);
printer.printComment("Well populations: " + wellPopulationsString);
if(isExponential){
printer.printComment("Lambda: " + lambda);
}