diff --git a/src/main/java/Plate.java b/src/main/java/Plate.java index 75f3a86..572ea57 100644 --- a/src/main/java/Plate.java +++ b/src/main/java/Plate.java @@ -148,37 +148,7 @@ public class Plate { return wells; } -// //returns a map of the counts of the sequence at cell index sIndex, in all wells -// public void assayWellsSequenceS(Map sequences, int... sIndices){ -// this.assayWellsSequenceS(sequences, 0, size, sIndices); -// } -// -// //returns a map of the counts of the sequence at cell index sIndex, in a specific well -// public void assayWellsSequenceS(Map sequences, int n, int... sIndices) { -// this.assayWellsSequenceS(sequences, n, n+1, sIndices); -// } -// -// //returns a map of the counts of the sequence at cell index sIndex, in a range of wells -// public void assayWellsSequenceS(Map sequences, int start, int end, int... sIndices) { -// for(int sIndex: sIndices){ -// for(int i = start; i < end; i++){ -// countSequences(sequences, wells.get(i), sIndex); -// } -// } -// } -// //For the sequences at cell indices sIndices, counts number of unique sequences in the given well into the given map -// private void countSequences(Map wellMap, List well, int... sIndices) { -// for(String[] cell : well) { -// for(int sIndex: sIndices){ -// //skip dropout sequences, which have value -1 -// if(!"-1".equals(cell[sIndex])){ -// wellMap.merge(cell[sIndex], 1, (oldValue, newValue) -> oldValue + newValue); -// } -// } -// } -// } - - //For the sequences at cell indices sIndices, counts number of unique sequences in all well into the given map + //For the sequences at cell indices sIndices, counts number of unique sequences in all wells into the given map public Map countSequences(Integer readDepth, Double readErrorRate, Double errorCollisionRate, int... sIndices) { SequenceType[] sequenceTypes = EnumSet.allOf(SequenceType.class).toArray(new SequenceType[0]); @@ -231,98 +201,6 @@ public class Plate { return sequenceMap; } - -// //returns a map of the counts of the sequence at cell index sIndex, in all wells -// //Simulates read depth and read errors, counts the number of reads of a unique sequence into the given map. -// public void assayWellsSequenceSWithReadDepth(Map misreadCounts, Map occupancyMap, Map readCountMap, -// int readDepth, double readErrorProb, double errorCollisionProb, int... sIndices) { -// this.assayWellsSequenceSWithReadDepth(misreadCounts, occupancyMap, readCountMap, readDepth, readErrorProb, errorCollisionProb, 0, size, sIndices); -// } -// //returns a map of the counts of the sequence at cell index sIndex, in a specific of wells -// //Simulates read depth and read errors, counts the number of reads of a unique sequence into the given map. -// public void assayWellsSequenceSWithReadDepth(Map misreadCounts, Map occupancyMap, Map readCountMap, -// int readDepth, double readErrorProb, double errorCollisionProb, -// int n, int... sIndices) { -// this.assayWellsSequenceSWithReadDepth(misreadCounts, occupancyMap, readCountMap, readDepth, readErrorProb, errorCollisionProb, n, n+1, sIndices); -// } -// -// //returns a map of the counts of the sequence at cell index sIndex, in a range of wells -// //Simulates read depth and read errors, counts the number of reads of a unique sequence into the given map. -// public void assayWellsSequenceSWithReadDepth(Map misreadCounts, Map occupancyMap, Map readCountMap, -// int readDepth, double readErrorProb, double errorCollisionProb, -// int start, int end, int... sIndices) { -// for(int sIndex: sIndices){ -// for(int i = start; i < end; i++){ -// countSequencesWithReadDepth(misreadCounts, occupancyMap, readCountMap, readDepth, readErrorProb, errorCollisionProb, wells.get(i), sIndex); -// } -// } -// } -// -// //For the sequences at cell indices sIndices, counts number of unique sequences in the given well into the given map -// //Simulates read depth and read errors, counts the number of reads of a unique sequence into the given map. -// //NOTE: this function changes the content of the well, adding spurious cells to contain the misread sequences -// //(this is necessary because, in the simulation, the plate is read multiple times, but random misreads can only -// //be simulated once). -// //(Possibly I should refactor all of this to only require a single plate assay, to speed things up. Or at least -// //to see if it would speed things up.) -// private void countSequencesWithReadDepth(Map distinctMisreadCounts, Map occupancyMap, Map readCountMap, -// int readDepth, double readErrorProb, double errorCollisionProb, -// List well, int... sIndices) { -// //list of spurious cells to add to well after counting -// List spuriousCells = new ArrayList<>(); -// for(String[] cell : well) { -// //new potential spurious cell for each cell that gets read -// String[] spuriousCell = new String[SequenceType.values().length]; -// //initialize spurious cell with all dropout sequences -// Arrays.fill(spuriousCell, "-1"); -// //has a read error occurred? -// boolean readError = false; -// for(int sIndex: sIndices){ -// //skip dropout sequences, which have value "-1" -// if(!"-1".equals(cell[sIndex])){ -// Map sequencesWithReadCounts = new LinkedHashMap<>(); -// for(int i = 0; i < readDepth; i++) { -// if (rand.nextDouble() <= readErrorProb) { -// readError = true; -// //Read errors are represented by appending "*"s to the end of the sequence some number of times -// StringBuilder spurious = new StringBuilder(cell[sIndex]); -// //if this sequence hasn't been misread before, or the read error is unique, -// //append one more "*" than has been appended before -// if (!distinctMisreadCounts.containsKey(cell[sIndex]) || rand.nextDouble() > errorCollisionProb) { -// distinctMisreadCounts.merge(cell[sIndex], 1, (oldValue, newValue) -> oldValue + newValue); -// for (int j = 0; j < distinctMisreadCounts.get(cell[sIndex]); j++) { -// spurious.append("*"); -// } -// } -// //if this is a read error collision, randomly choose a number of "*"s that has been appended before -// else { -// int starCount = rand.nextInt(distinctMisreadCounts.get(cell[sIndex])); -// for (int j = 0; j < starCount; j++) { -// spurious.append("*"); -// } -// } -// sequencesWithReadCounts.merge(spurious.toString(), 1, (oldValue, newValue) -> oldValue + newValue); -// //add spurious sequence to spurious cell -// spuriousCell[sIndex] = spurious.toString(); -// } -// else { -// sequencesWithReadCounts.merge(cell[sIndex], 1, (oldValue, newValue) -> oldValue + newValue); -// } -// } -// for(String seq : sequencesWithReadCounts.keySet()) { -// occupancyMap.merge(seq, 1, (oldValue, newValue) -> oldValue + newValue); -// readCountMap.merge(seq, sequencesWithReadCounts.get(seq), (oldValue, newValue) -> oldValue + newValue); -// } -// } -// } -// if (readError) { //only add a new spurious cell if there was a read error -// spuriousCells.add(spuriousCell); -// } -// } -// //add all spurious cells to the well -// well.addAll(spuriousCells); -// } - public String getSourceFileName() { return sourceFile; }