Change plate reader/writer to use columns as wells

This commit is contained in:
2022-02-20 19:48:09 -06:00
parent 4fd5baeb98
commit 2b13e10e95
3 changed files with 14 additions and 15 deletions

View File

@@ -54,19 +54,16 @@ public class PlateFileReader {
if (record.hasComment()) {
continue;
}
// if (wells.size() == 0) {
// int num = 0;
// for (String s: record) {
// num++;
// }
// for (int i = 0; i < num; i++) {
// wells.add(new ArrayList<>());
// }
if(wellNamesRecord){
wellNamesRecord = false;
continue;
if (wells.size() == 0) {
int num = 0;
for (String s: record) {
num++;
}
for (int i = 0; i < num; i++) {
wells.add(new ArrayList<>());
}
} else {
List<Integer[]> well = new ArrayList<>();
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
@@ -79,10 +76,12 @@ public class PlateFileReader {
for (int j = 0; j < intsAsStrings.length; j++) {
arr[j] = Integer.valueOf(intsAsStrings[j]);
}
well.add(arr);
//Add Integer array to the correct well
wells.get(i).add(arr);
i++;
}
}
wells.add(well);
}
}
} catch(IOException ex){

View File

@@ -99,7 +99,7 @@ public class PlateFileWriter {
else {
printer.printComment("Std. dev.: " + stdDev);
}
printer.printRecords(wellsAsStrings);
printer.printRecords(rows);
} catch(IOException ex){
System.out.println("Could not make new file named "+filename);
System.err.println(ex);