Change access modifiers and add count of wells removed to output

This commit is contained in:
eugenefischer
2022-09-29 15:56:19 -05:00
parent ec6713a1c0
commit 133984276f

View File

@@ -71,9 +71,11 @@ public class Simulator implements GraphModificationFunctions {
} }
if (realSequenceCollisionRate > 0.0) { if (realSequenceCollisionRate > 0.0) {
if(verbose){System.out.println("Removing wells with anomalous read counts from sequence records");} if(verbose){System.out.println("Removing wells with anomalous read counts from sequence records");}
filterWellsByReadCount(alphaSequences); int alphaWellsRemoved = filterWellsByReadCount(alphaSequences);
filterWellsByReadCount(betaSequences); int betaWellsRemoved = filterWellsByReadCount(betaSequences);
if(verbose){System.out.println("Wells with anomalous read counts removed from sequence records");} if(verbose){System.out.println("Wells with anomalous read counts removed from sequence records");}
if(verbose){System.out.println("Total alpha sequence wells removed: " + alphaWellsRemoved);}
if(verbose){System.out.println("Total beta sequence wells removed: " + betaWellsRemoved);}
} }
//construct the graph. For simplicity, going to make //construct the graph. For simplicity, going to make
@@ -653,7 +655,7 @@ public class Simulator implements GraphModificationFunctions {
// } // }
//Remove sequences based on occupancy //Remove sequences based on occupancy
public static void filterByOccupancyThresholds(Map<String, SequenceRecord> wellMap, int low, int high){ private static void filterByOccupancyThresholds(Map<String, SequenceRecord> wellMap, int low, int high){
List<String> noise = new ArrayList<>(); List<String> noise = new ArrayList<>();
for(String k: wellMap.keySet()){ for(String k: wellMap.keySet()){
if((wellMap.get(k).getOccupancy() > high) || (wellMap.get(k).getOccupancy() < low)){ if((wellMap.get(k).getOccupancy() > high) || (wellMap.get(k).getOccupancy() < low)){
@@ -665,7 +667,7 @@ public class Simulator implements GraphModificationFunctions {
} }
} }
public static void filterByOccupancyAndReadCount(Map<String, SequenceRecord> sequences, int readDepth) { private static void filterByOccupancyAndReadCount(Map<String, SequenceRecord> sequences, int readDepth) {
List<String> noise = new ArrayList<>(); List<String> noise = new ArrayList<>();
for(String k : sequences.keySet()){ for(String k : sequences.keySet()){
//occupancy times read depth should be more than half the sequence read count if the read error rate is low //occupancy times read depth should be more than half the sequence read count if the read error rate is low
@@ -679,7 +681,8 @@ public class Simulator implements GraphModificationFunctions {
} }
} }
public static void filterWellsByReadCount(Map<String, SequenceRecord> sequences) { private static int filterWellsByReadCount(Map<String, SequenceRecord> sequences) {
int count = 0;
for (String k: sequences.keySet()) { for (String k: sequences.keySet()) {
//If a sequence has read count R and appears in W wells, then on average its read count in each //If a sequence has read count R and appears in W wells, then on average its read count in each
//well should be R/W. Delete any wells where the read count is less than R/2W. //well should be R/W. Delete any wells where the read count is less than R/2W.
@@ -688,12 +691,14 @@ public class Simulator implements GraphModificationFunctions {
for (Integer well: sequences.get(k).getWells()) { for (Integer well: sequences.get(k).getWells()) {
if (sequences.get(k).getReadCount(well) < threshold) { if (sequences.get(k).getReadCount(well) < threshold) {
noise.add(well); noise.add(well);
count++;
} }
} }
for (Integer well: noise) { for (Integer well: noise) {
sequences.get(k).deleteWell(well); sequences.get(k).deleteWell(well);
} }
} }
return count;
} }
private static Map<String, String> makeSequenceToSequenceMap(List<String[]> cells, int keySequenceIndex, private static Map<String, String> makeSequenceToSequenceMap(List<String[]> cells, int keySequenceIndex,