Reorder conditional

This commit is contained in:
eugenefischer
2022-09-28 00:57:06 -05:00
parent 88b6c79caa
commit 8781afd74c

View File

@@ -184,18 +184,9 @@ public class Plate {
SequenceType[] sequenceTypes = EnumSet.allOf(SequenceType.class).toArray(new SequenceType[0]); SequenceType[] sequenceTypes = EnumSet.allOf(SequenceType.class).toArray(new SequenceType[0]);
Map<String, Integer> distinctMisreadCounts = new HashMap<>(); Map<String, Integer> distinctMisreadCounts = new HashMap<>();
Map<String, SequenceRecord> sequenceMap = new LinkedHashMap<>(); Map<String, SequenceRecord> sequenceMap = new LinkedHashMap<>();
//booleans for testing
Boolean first= false;
Boolean second = false;
Boolean third = false;
Boolean fourth = false;
for (int well = 0; well < size; well++) { for (int well = 0; well < size; well++) {
first = true;
for (String[] cell : wells.get(well)) { for (String[] cell : wells.get(well)) {
second = true;
for (int sIndex : sIndices) { for (int sIndex : sIndices) {
third = true;
//skip dropout sequences, which have value -1 //skip dropout sequences, which have value -1
if (!"-1".equals(cell[sIndex])) { if (!"-1".equals(cell[sIndex])) {
for (int j = 0; j < readDepth; j++) { for (int j = 0; j < readDepth; j++) {
@@ -204,7 +195,7 @@ public class Plate {
StringBuilder spurious = new StringBuilder(cell[sIndex]); StringBuilder spurious = new StringBuilder(cell[sIndex]);
//if this sequence hasn't been misread before, or the read error is unique, //if this sequence hasn't been misread before, or the read error is unique,
//append one more "*" than has been appended before //append one more "*" than has been appended before
if (!distinctMisreadCounts.containsKey(cell[sIndex]) || rand.nextDouble() > errorCollisionRate) { if (rand.nextDouble() > errorCollisionRate || !distinctMisreadCounts.containsKey(cell[sIndex])) {
distinctMisreadCounts.merge(cell[sIndex], 1, (oldValue, newValue) -> oldValue + newValue); distinctMisreadCounts.merge(cell[sIndex], 1, (oldValue, newValue) -> oldValue + newValue);
for (int k = 0; k < distinctMisreadCounts.get(cell[sIndex]); k++) { for (int k = 0; k < distinctMisreadCounts.get(cell[sIndex]); k++) {
spurious.append("*"); spurious.append("*");
@@ -224,7 +215,6 @@ public class Plate {
} }
//sequence is read correctly //sequence is read correctly
else { else {
fourth = true;
if (!sequenceMap.containsKey(cell[sIndex])) { if (!sequenceMap.containsKey(cell[sIndex])) {
SequenceRecord tmp = new SequenceRecord(cell[sIndex], sequenceTypes[sIndex]); SequenceRecord tmp = new SequenceRecord(cell[sIndex], sequenceTypes[sIndex]);
tmp.addRead(well); tmp.addRead(well);
@@ -238,11 +228,6 @@ public class Plate {
} }
} }
} }
System.out.println("First: " + first.toString());
System.out.println("Second: " + second.toString());
System.out.println("Third: " + third.toString());
System.out.println("Fourth: " + fourth.toString());
System.out.println(sequenceMap.size());
return sequenceMap; return sequenceMap;
} }