add comments
This commit is contained in:
@@ -8,7 +8,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public interface GraphModificationFunctions {
|
public interface GraphModificationFunctions {
|
||||||
|
|
||||||
//remove over- and under-weight edges
|
//remove over- and under-weight edges, return removed edges
|
||||||
static Map<Vertex[], Integer> filterByOverlapThresholds(SimpleWeightedGraph<Vertex, DefaultWeightedEdge> graph,
|
static Map<Vertex[], Integer> filterByOverlapThresholds(SimpleWeightedGraph<Vertex, DefaultWeightedEdge> graph,
|
||||||
int low, int high, boolean saveEdges) {
|
int low, int high, boolean saveEdges) {
|
||||||
Map<Vertex[], Integer> removedEdges = new HashMap<>();
|
Map<Vertex[], Integer> removedEdges = new HashMap<>();
|
||||||
@@ -35,7 +35,7 @@ public interface GraphModificationFunctions {
|
|||||||
return removedEdges;
|
return removedEdges;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Remove edges for pairs with large occupancy discrepancy
|
//Remove edges for pairs with large occupancy discrepancy, return removed edges
|
||||||
static Map<Vertex[], Integer> filterByRelativeOccupancy(SimpleWeightedGraph<Vertex, DefaultWeightedEdge> graph,
|
static Map<Vertex[], Integer> filterByRelativeOccupancy(SimpleWeightedGraph<Vertex, DefaultWeightedEdge> graph,
|
||||||
Integer maxOccupancyDifference, boolean saveEdges) {
|
Integer maxOccupancyDifference, boolean saveEdges) {
|
||||||
Map<Vertex[], Integer> removedEdges = new HashMap<>();
|
Map<Vertex[], Integer> removedEdges = new HashMap<>();
|
||||||
@@ -63,7 +63,7 @@ public interface GraphModificationFunctions {
|
|||||||
return removedEdges;
|
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<Vertex[], Integer> filterByOverlapPercent(SimpleWeightedGraph<Vertex, DefaultWeightedEdge> graph,
|
static Map<Vertex[], Integer> filterByOverlapPercent(SimpleWeightedGraph<Vertex, DefaultWeightedEdge> graph,
|
||||||
Integer minOverlapPercent,
|
Integer minOverlapPercent,
|
||||||
boolean saveEdges) {
|
boolean saveEdges) {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public class Simulator implements GraphModificationFunctions {
|
|||||||
if(verbose){System.out.println("All betas count: " + betaCount);}
|
if(verbose){System.out.println("All betas count: " + betaCount);}
|
||||||
if(verbose){System.out.println("Well maps made");}
|
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.");}
|
if(verbose){System.out.println("Removing sequences present in all wells.");}
|
||||||
filterByOccupancyThresholds(allAlphas, 1, numWells - 1);
|
filterByOccupancyThresholds(allAlphas, 1, numWells - 1);
|
||||||
filterByOccupancyThresholds(allBetas, 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));
|
Vertex alphaVertex = new Vertex(SequenceType.CDR3_ALPHA, seq, alphaWellCounts.get(seq), plateAtoVMap.get(seq));
|
||||||
alphaVertices.add(alphaVertex);
|
alphaVertices.add(alphaVertex);
|
||||||
}
|
}
|
||||||
|
//Sort to make sure the order of vertices in list matches the order of the adjacency matrix
|
||||||
Collections.sort(alphaVertices);
|
Collections.sort(alphaVertices);
|
||||||
|
//Add ordered list of vertices to the graph
|
||||||
graphGenerator.first(alphaVertices);
|
graphGenerator.first(alphaVertices);
|
||||||
//the list of beta vertices
|
//the list of beta vertices
|
||||||
//List<Integer> betaVertices = new ArrayList<>(plateVtoBMap.keySet());//This will work because LinkedHashMap preserves order of entry
|
//List<Integer> 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));
|
Vertex betaVertex = new Vertex(SequenceType.CDR3_BETA, seq, betaWellCounts.get(seq), plateBtoVMap.get(seq));
|
||||||
betaVertices.add(betaVertex);
|
betaVertices.add(betaVertex);
|
||||||
}
|
}
|
||||||
|
//Sort to make sure the order of vertices in list matches the order of the adjacency matrix
|
||||||
Collections.sort(betaVertices);
|
Collections.sort(betaVertices);
|
||||||
|
//Add ordered list of vertices to the graph
|
||||||
graphGenerator.second(betaVertices);
|
graphGenerator.second(betaVertices);
|
||||||
//use adjacency matrix of weight created previously
|
//use adjacency matrix of weight created previously
|
||||||
graphGenerator.weights(weights);
|
graphGenerator.weights(weights);
|
||||||
|
|||||||
Reference in New Issue
Block a user