Do new filtering before matching

This commit is contained in:
2022-02-18 17:42:05 -06:00
parent b9ee31b64c
commit 47e23addfa
2 changed files with 12 additions and 8 deletions

View File

@@ -196,12 +196,12 @@ public class Simulator {
//Filter by overlap size
if(verbose){System.out.println("Eliminating edges with weights much less than occupancy values");}
filterByOverlapSize(graph, alphaWellCounts, betaWellCounts);
filterByOverlapSize(graph, alphaWellCounts, betaWellCounts, plateVtoAMap, plateVtoBMap);
if(verbose){System.out.println("Edges with weights much less than occupancy values set to 0.0");}
//Filter by relative occupancy
if(verbose){System.out.println("Eliminating edges between vertices of massively different occupancy");}
filterByRelativeOccupancy(graph, alphaWellCounts, betaWellCounts);
filterByRelativeOccupancy(graph, alphaWellCounts, betaWellCounts, plateVtoAMap, plateVtoBMap);
if(verbose){System.out.println("Edges between vertices of massively different occupancy set to 0.0");}
@@ -679,10 +679,12 @@ public class Simulator {
//Remove edges for pairs with large occupancy discrepancy
private static void filterByRelativeOccupancy(SimpleWeightedGraph<Integer, DefaultWeightedEdge> graph,
Map<Integer, Integer> alphaWellCounts,
Map<Integer, Integer> betaWellCounts) {
Map<Integer, Integer> betaWellCounts,
Map<Integer, Integer> plateVtoAMap,
Map<Integer, Integer> plateVtoBMap) {
for (DefaultWeightedEdge e : graph.edgeSet()) {
Integer alphaOcc = alphaWellCounts.get(graph.getEdgeSource(e));
Integer betaOcc = betaWellCounts.get(graph.getEdgeTarget(e));
Integer alphaOcc = alphaWellCounts.get(plateVtoAMap.get(graph.getEdgeSource(e)));
Integer betaOcc = betaWellCounts.get(plateVtoBMap.get(graph.getEdgeTarget(e)));
//Adjust this to something cleverer later
if (Math.abs(alphaOcc - betaOcc) >= 20) {
graph.setEdgeWeight(e, 0.0);
@@ -693,10 +695,12 @@ public class Simulator {
//Remove edges for pairs where overlap size is significantly lower than the well occupancy
private static void filterByOverlapSize(SimpleWeightedGraph<Integer, DefaultWeightedEdge> graph,
Map<Integer, Integer> alphaWellCounts,
Map<Integer, Integer> betaWellCounts) {
Map<Integer, Integer> betaWellCounts,
Map<Integer, Integer> plateVtoAMap,
Map<Integer, Integer> plateVtoBMap) {
for (DefaultWeightedEdge e : graph.edgeSet()) {
Integer alphaOcc = alphaWellCounts.get(graph.getEdgeSource(e));
Integer betaOcc = betaWellCounts.get(graph.getEdgeTarget(e));
Integer alphaOcc = alphaWellCounts.get(plateVtoAMap.get(graph.getEdgeSource(e)));
Integer betaOcc = betaWellCounts.get(plateVtoBMap.get(graph.getEdgeTarget(e)));
//Adjust this to something cleverer later
Integer min = alphaOcc > betaOcc ? betaOcc : alphaOcc;
if (min - graph.getEdgeWeight(e) >= 15) {