From 58fa140ee5bd62a8ecf9d1a3a26074fd990f4d8d Mon Sep 17 00:00:00 2001 From: eugenefischer <66030419+eugenefischer@users.noreply.github.com> Date: Sun, 25 Sep 2022 16:10:17 -0500 Subject: [PATCH] add comments --- src/main/java/GraphModificationFunctions.java | 6 +++--- src/main/java/Simulator.java | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/GraphModificationFunctions.java b/src/main/java/GraphModificationFunctions.java index 68cc9d2..4b5591a 100644 --- a/src/main/java/GraphModificationFunctions.java +++ b/src/main/java/GraphModificationFunctions.java @@ -8,7 +8,7 @@ import java.util.Map; public interface GraphModificationFunctions { - //remove over- and under-weight edges + //remove over- and under-weight edges, return removed edges static Map filterByOverlapThresholds(SimpleWeightedGraph graph, int low, int high, boolean saveEdges) { Map removedEdges = new HashMap<>(); @@ -35,7 +35,7 @@ public interface GraphModificationFunctions { return removedEdges; } - //Remove edges for pairs with large occupancy discrepancy + //Remove edges for pairs with large occupancy discrepancy, return removed edges static Map filterByRelativeOccupancy(SimpleWeightedGraph graph, Integer maxOccupancyDifference, boolean saveEdges) { Map removedEdges = new HashMap<>(); @@ -63,7 +63,7 @@ public interface GraphModificationFunctions { return removedEdges; } - //Remove edges for pairs where overlap size is significantly lower than the well occupancy + //Remove edges for pairs where overlap size is significantly lower than the well occupancy, return removed edges static Map filterByOverlapPercent(SimpleWeightedGraph graph, Integer minOverlapPercent, boolean saveEdges) { diff --git a/src/main/java/Simulator.java b/src/main/java/Simulator.java index d53ece6..0d9e17b 100644 --- a/src/main/java/Simulator.java +++ b/src/main/java/Simulator.java @@ -47,7 +47,7 @@ public class Simulator implements GraphModificationFunctions { if(verbose){System.out.println("All betas count: " + betaCount);} if(verbose){System.out.println("Well maps made");} - + //ideally we wouldn't do any graph pre-filtering. But sequences present in all wells add a huge number of edges to the graph and don't carry any signal value if(verbose){System.out.println("Removing sequences present in all wells.");} filterByOccupancyThresholds(allAlphas, 1, numWells - 1); filterByOccupancyThresholds(allBetas, 1, numWells - 1); @@ -105,7 +105,9 @@ public class Simulator implements GraphModificationFunctions { Vertex alphaVertex = new Vertex(SequenceType.CDR3_ALPHA, seq, alphaWellCounts.get(seq), plateAtoVMap.get(seq)); alphaVertices.add(alphaVertex); } + //Sort to make sure the order of vertices in list matches the order of the adjacency matrix Collections.sort(alphaVertices); + //Add ordered list of vertices to the graph graphGenerator.first(alphaVertices); //the list of beta vertices //List betaVertices = new ArrayList<>(plateVtoBMap.keySet());//This will work because LinkedHashMap preserves order of entry @@ -114,7 +116,9 @@ public class Simulator implements GraphModificationFunctions { Vertex betaVertex = new Vertex(SequenceType.CDR3_BETA, seq, betaWellCounts.get(seq), plateBtoVMap.get(seq)); betaVertices.add(betaVertex); } + //Sort to make sure the order of vertices in list matches the order of the adjacency matrix Collections.sort(betaVertices); + //Add ordered list of vertices to the graph graphGenerator.second(betaVertices); //use adjacency matrix of weight created previously graphGenerator.weights(weights);