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:
2022-02-20 20:45:35 -06:00
parent 7558455f39
commit 63ef6aa7a0
5 changed files with 30 additions and 62 deletions

View File

@@ -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.");