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);
for(CSVRecord record: parser) {
boolean wellNamesRecord = true;
for(CSVRecord record: parser.getRecords()) {
if (record.hasComment()) {
continue;
}
if (wells.size() == 0) {
int num = record.size();
for (int i = 0; i < num; i++) {
wells.add(new ArrayList<>());
}
// 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;
} else {
int i = 0;
List<Integer[]> well = new ArrayList<>();
for (String s : record) {
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("\\[", "")
.replaceAll("]", "")
.replaceAll(" ", "")
@@ -73,12 +79,10 @@ public class PlateFileReader {
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++;
well.add(arr);
}
}
wells.add(well);
}
}
} catch(IOException ex){