Change real sequence collision so it isn't biased toward sequences in the earlier wells.
This commit is contained in:
@@ -166,6 +166,8 @@ public class Plate {
|
|||||||
Map<String, List<String>> sequencesAndMisreads = new HashMap<>();
|
Map<String, List<String>> sequencesAndMisreads = new HashMap<>();
|
||||||
//Map of all sequences read. Keys are sequences, values are associated SequenceRecords
|
//Map of all sequences read. Keys are sequences, values are associated SequenceRecords
|
||||||
Map<String, SequenceRecord> sequenceMap = new LinkedHashMap<>();
|
Map<String, SequenceRecord> sequenceMap = new LinkedHashMap<>();
|
||||||
|
//get list of all distinct, real sequences
|
||||||
|
String[] realSequences = assayWells(sIndices).toArray(new String[0]);
|
||||||
for (int well = 0; well < size; well++) {
|
for (int well = 0; well < size; well++) {
|
||||||
for (String[] cell: wells.get(well)) {
|
for (String[] cell: wells.get(well)) {
|
||||||
for (int sIndex: sIndices) {
|
for (int sIndex: sIndices) {
|
||||||
@@ -201,8 +203,8 @@ public class Plate {
|
|||||||
String wrongSequence;
|
String wrongSequence;
|
||||||
do{
|
do{
|
||||||
//get a random real sequence that's been read from the plate before
|
//get a random real sequence that's been read from the plate before
|
||||||
int index = rand.nextInt(sequencesAndMisreads.size());
|
int index = rand.nextInt(realSequences.length);
|
||||||
wrongSequence = sequencesAndMisreads.keySet().toArray(new String[0])[index];
|
wrongSequence = realSequences[index];
|
||||||
//make sure it's not accidentally the *right* sequence
|
//make sure it's not accidentally the *right* sequence
|
||||||
//Also that it's not a wrong sequence already in the misread list
|
//Also that it's not a wrong sequence already in the misread list
|
||||||
} while(currentSequence.equals(wrongSequence) || sequencesAndMisreads.get(currentSequence).contains(wrongSequence));
|
} while(currentSequence.equals(wrongSequence) || sequencesAndMisreads.get(currentSequence).contains(wrongSequence));
|
||||||
@@ -240,6 +242,18 @@ public class Plate {
|
|||||||
return sequenceMap;
|
return sequenceMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HashSet<String> assayWells(int[] indices) {
|
||||||
|
HashSet<String> allSequences = new HashSet<>();
|
||||||
|
for (List<String[]> well: wells) {
|
||||||
|
for (String[] cell: well) {
|
||||||
|
for(int index: indices) {
|
||||||
|
allSequences.add(cell[index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return allSequences;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSourceFileName() {
|
public String getSourceFileName() {
|
||||||
return sourceFile;
|
return sourceFile;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user