Revert attempt to switch plate output format. It worked, but introduced a bug in graph filtering I don't want to chase down
This commit is contained in:
@@ -31,54 +31,23 @@ public class PlateFileReader {
|
||||
BufferedReader reader = Files.newBufferedReader(Path.of(filename));
|
||||
CSVParser parser = new CSVParser(reader, plateFileFormat);
|
||||
){
|
||||
//old code for wells as rows
|
||||
// for(CSVRecord record: parser.getRecords()) {
|
||||
// List<Integer[]> well = new ArrayList<>();
|
||||
// for(String s: record) {
|
||||
// if(!"".equals(s)) {
|
||||
// String[] intString = s.replaceAll("\\[", "")
|
||||
// .replaceAll("]", "")
|
||||
// .replaceAll(" ", "")
|
||||
// .split(",");
|
||||
// //System.out.println(intString);
|
||||
// Integer[] arr = new Integer[intString.length];
|
||||
// for (int i = 0; i < intString.length; i++) {
|
||||
// arr[i] = Integer.valueOf(intString[i]);
|
||||
// }
|
||||
// well.add(arr);
|
||||
// }
|
||||
// }
|
||||
// wells.add(well);
|
||||
for(CSVRecord record: parser.getRecords()) {
|
||||
if (wells.size() == 0) {
|
||||
int num = 0;
|
||||
for (String s: record) {
|
||||
num++;
|
||||
}
|
||||
for (int i = 0; i < num; i++) {
|
||||
wells.add(new ArrayList<>());
|
||||
}
|
||||
} else {
|
||||
int i = 0;
|
||||
for (String s : record) {
|
||||
if (!"".equals(s)) { //if value isn't the empty string
|
||||
//get rid of brackets, split at commas into a string array
|
||||
String[] intsAsStrings = s.replaceAll("\\[", "")
|
||||
.replaceAll("]", "")
|
||||
.replaceAll(" ", "")
|
||||
.split(",");
|
||||
//Make Integer array with the same values
|
||||
Integer[] arr = new Integer[intsAsStrings.length];
|
||||
for (int j = 0; j < intsAsStrings.length; j++) {
|
||||
arr[j] = Integer.valueOf(intsAsStrings[j]);
|
||||
}
|
||||
//Add Integer array to the correct well
|
||||
wells.get(i).add(arr);
|
||||
i++;
|
||||
List<Integer[]> well = new ArrayList<>();
|
||||
for(String s: record) {
|
||||
if(!"".equals(s)) {
|
||||
String[] intString = s.replaceAll("\\[", "")
|
||||
.replaceAll("]", "")
|
||||
.replaceAll(" ", "")
|
||||
.split(",");
|
||||
//System.out.println(intString);
|
||||
Integer[] arr = new Integer[intString.length];
|
||||
for (int i = 0; i < intString.length; i++) {
|
||||
arr[i] = Integer.valueOf(intString[i]);
|
||||
}
|
||||
well.add(arr);
|
||||
}
|
||||
|
||||
}
|
||||
wells.add(well);
|
||||
}
|
||||
} catch(IOException ex){
|
||||
System.out.println("plate file " + filename + " not found.");
|
||||
|
||||
@@ -59,7 +59,7 @@ public class PlateFileWriter {
|
||||
}
|
||||
}
|
||||
|
||||
//this took forever, and I don't use it, because it makes reading data in a huge pain
|
||||
//this took forever
|
||||
List<List<String>> rows = new ArrayList<>();
|
||||
List<String> tmp = new ArrayList<>();
|
||||
for(int i = 0; i < wellsAsStrings.size(); i++){//List<Integer[]> w: wells){
|
||||
@@ -89,6 +89,7 @@ public class PlateFileWriter {
|
||||
CSVPrinter printer = new CSVPrinter(writer, plateFileFormat);
|
||||
){
|
||||
printer.printComment("Cell source file name: " + sourceFileName);
|
||||
printer.printComment("Each row represents one well on the plate.");
|
||||
printer.printComment("Plate size: " + size);
|
||||
printer.printComment("Error rate: " + error);
|
||||
printer.printComment("Concentrations: " + concenString);
|
||||
|
||||
@@ -319,7 +319,6 @@ public class UserInterface {
|
||||
assert filename != null;
|
||||
CellFileWriter writer = new CellFileWriter(filename, sample);
|
||||
writer.writeCellsToFile();
|
||||
System.gc();
|
||||
}
|
||||
|
||||
// //for calling from command line
|
||||
@@ -466,7 +465,6 @@ public class UserInterface {
|
||||
System.out.println("Writing Sample Plate to file");
|
||||
writer.writePlateFile();
|
||||
System.out.println("Sample Plate written to file: " + filename);
|
||||
System.gc();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,7 +513,6 @@ public class UserInterface {
|
||||
System.out.println("File I/O time is not included in results.");
|
||||
dataWriter.writeDataToFile();
|
||||
System.out.println("Graph and Data file written to: " + filename);
|
||||
System.gc();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,7 +567,6 @@ public class UserInterface {
|
||||
System.out.println("Writing results to file");
|
||||
writer.writeResultsToFile();
|
||||
System.out.println("Results written to file: " + filename);
|
||||
System.gc();
|
||||
}
|
||||
|
||||
///////
|
||||
|
||||
Reference in New Issue
Block a user