Change plate reader/writer to use columns as wells

This commit is contained in:
2022-02-20 19:41:06 -06:00
parent b2a4e9a42b
commit 4fd5baeb98
2 changed files with 16 additions and 12 deletions

View File

@@ -49,21 +49,27 @@ public class PlateFileReader {
// } // }
// } // }
// wells.add(well); // wells.add(well);
for(CSVRecord record: parser) { boolean wellNamesRecord = true;
for(CSVRecord record: parser.getRecords()) {
if (record.hasComment()) { if (record.hasComment()) {
continue; continue;
} }
if (wells.size() == 0) { // if (wells.size() == 0) {
int num = record.size(); // int num = 0;
for (int i = 0; i < num; i++) { // for (String s: record) {
wells.add(new ArrayList<>()); // num++;
} // }
// for (int i = 0; i < num; i++) {
// wells.add(new ArrayList<>());
// }
if(wellNamesRecord){
wellNamesRecord = false;
continue; continue;
} else { } else {
int i = 0; List<Integer[]> well = new ArrayList<>();
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 brackts, split at commas into a string array //get rid of brackets, split at commas into a string array
String[] intsAsStrings = s.replaceAll("\\[", "") String[] intsAsStrings = s.replaceAll("\\[", "")
.replaceAll("]", "") .replaceAll("]", "")
.replaceAll(" ", "") .replaceAll(" ", "")
@@ -73,12 +79,10 @@ 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]);
} }
//Add Integer array to the correct well well.add(arr);
wells.get(i).add(arr);
i++;
} }
} }
wells.add(well);
} }
} }
} catch(IOException ex){ } catch(IOException ex){