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()) { if (record.hasComment()) {
continue; continue;
} }
// if (wells.size() == 0) { if (wells.size() == 0) {
// int num = 0; int num = 0;
// for (String s: record) { for (String s: record) {
// num++; num++;
// } }
// for (int i = 0; i < num; i++) { for (int i = 0; i < num; i++) {
// wells.add(new ArrayList<>()); wells.add(new ArrayList<>());
// } }
if(wellNamesRecord){
wellNamesRecord = false;
continue;
} else { } else {
List<Integer[]> well = new ArrayList<>(); int i = 0;
for (String s : record) { for (String s : record) {
if (!"".equals(s)) { //if value isn't the empty string if (!"".equals(s)) { //if value isn't the empty string
//get rid of brackets, split at commas into a string array //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++) { for (int j = 0; j < intsAsStrings.length; j++) {
arr[j] = Integer.valueOf(intsAsStrings[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){ } catch(IOException ex){

View File

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