Code cleanup

This commit is contained in:
2022-02-26 09:56:46 -06:00
parent 1ea68045ce
commit 817fe51708
2 changed files with 59 additions and 57 deletions

View File

@@ -15,32 +15,33 @@ public class GraphWithMapData implements java.io.Serializable {
private Integer alphaCount; private Integer alphaCount;
private Integer betaCount; private Integer betaCount;
private final Map<Integer, Integer> distCellsMapAlphaKey; private final Map<Integer, Integer> distCellsMapAlphaKey;
private final Map<Integer, Integer> plateVtoAMap; // private final Map<Integer, Integer> plateVtoAMap;
private final Map<Integer, Integer> plateVtoBMap; // private final Map<Integer, Integer> plateVtoBMap;
private final Map<Integer, Integer> plateAtoVMap; // private final Map<Integer, Integer> plateAtoVMap;
private final Map<Integer, Integer> plateBtoVMap; // private final Map<Integer, Integer> plateBtoVMap;
private final Map<Integer, Integer> alphaWellCounts; // private final Map<Integer, Integer> alphaWellCounts;
private final Map<Integer, Integer> betaWellCounts; // private final Map<Integer, Integer> betaWellCounts;
private final Duration time; private final Duration time;
public GraphWithMapData(SimpleWeightedGraph graph, Integer numWells, Integer[] wellConcentrations, public GraphWithMapData(SimpleWeightedGraph graph, Integer numWells, Integer[] wellConcentrations,
Integer alphaCount, Integer betaCount, Map<Integer, Integer> distCellsMapAlphaKey, Duration time){
Map<Integer, Integer> distCellsMapAlphaKey, Map<Integer, Integer> plateVtoAMap,
Map<Integer,Integer> plateVtoBMap, Map<Integer, Integer> plateAtoVMap, // Map<Integer, Integer> plateVtoAMap, Integer alphaCount, Integer betaCount,
Map<Integer, Integer> plateBtoVMap, Map<Integer, Integer> alphaWellCounts, // Map<Integer,Integer> plateVtoBMap, Map<Integer, Integer> plateAtoVMap,
Map<Integer, Integer> betaWellCounts, Duration time) { // Map<Integer, Integer> plateBtoVMap, Map<Integer, Integer> alphaWellCounts,
// Map<Integer, Integer> betaWellCounts,) {
this.graph = graph; this.graph = graph;
this.numWells = numWells; this.numWells = numWells;
this.wellPopulations = wellConcentrations; this.wellPopulations = wellConcentrations;
this.alphaCount = alphaCount; this.alphaCount = alphaCount;
this.betaCount = betaCount; this.betaCount = betaCount;
this.distCellsMapAlphaKey = distCellsMapAlphaKey; this.distCellsMapAlphaKey = distCellsMapAlphaKey;
this.plateVtoAMap = plateVtoAMap; // this.plateVtoAMap = plateVtoAMap;
this.plateVtoBMap = plateVtoBMap; // this.plateVtoBMap = plateVtoBMap;
this.plateAtoVMap = plateAtoVMap; // this.plateAtoVMap = plateAtoVMap;
this.plateBtoVMap = plateBtoVMap; // this.plateBtoVMap = plateBtoVMap;
this.alphaWellCounts = alphaWellCounts; // this.alphaWellCounts = alphaWellCounts;
this.betaWellCounts = betaWellCounts; // this.betaWellCounts = betaWellCounts;
this.time = time; this.time = time;
} }
@@ -56,41 +57,41 @@ public class GraphWithMapData implements java.io.Serializable {
return wellPopulations; return wellPopulations;
} }
public Integer getAlphaCount() { // public Integer getAlphaCount() {
return alphaCount; // return alphaCount;
} // }
//
public Integer getBetaCount() { // public Integer getBetaCount() {
return betaCount; // return betaCount;
} // }
public Map<Integer, Integer> getDistCellsMapAlphaKey() { public Map<Integer, Integer> getDistCellsMapAlphaKey() {
return distCellsMapAlphaKey; return distCellsMapAlphaKey;
} }
public Map<Integer, Integer> getPlateVtoAMap() { // public Map<Integer, Integer> getPlateVtoAMap() {
return plateVtoAMap; // return plateVtoAMap;
} // }
//
public Map<Integer, Integer> getPlateVtoBMap() { // public Map<Integer, Integer> getPlateVtoBMap() {
return plateVtoBMap; // return plateVtoBMap;
} // }
//
public Map<Integer, Integer> getPlateAtoVMap() { // public Map<Integer, Integer> getPlateAtoVMap() {
return plateAtoVMap; // return plateAtoVMap;
} // }
//
public Map<Integer, Integer> getPlateBtoVMap() { // public Map<Integer, Integer> getPlateBtoVMap() {
return plateBtoVMap; // return plateBtoVMap;
} // }
//
public Map<Integer, Integer> getAlphaWellCounts() { // public Map<Integer, Integer> getAlphaWellCounts() {
return alphaWellCounts; // return alphaWellCounts;
} // }
//
public Map<Integer, Integer> getBetaWellCounts() { // public Map<Integer, Integer> getBetaWellCounts() {
return betaWellCounts; // return betaWellCounts;
} // }
public Duration getTime() { public Duration getTime() {
return time; return time;

View File

@@ -19,11 +19,12 @@ import static java.lang.Float.*;
//NOTE: "sequence" in method and variable names refers to a peptide sequence from a simulated T cell //NOTE: "sequence" in method and variable names refers to a peptide sequence from a simulated T cell
public class Simulator implements GraphModificationFunctions { public class Simulator implements GraphModificationFunctions {
//These are the indices of the different sequences within a cell array //Replaced with SequenceType ordinals
private static final int cdr3AlphaIndex = 0; // //These are the indices of the different sequences within a cell array
private static final int cdr3BetaIndex = 1; // private static final int cdr3AlphaIndex = 0;
private static final int cdr1AlphaIndex = 2; // private static final int cdr3BetaIndex = 1;
private static final int cdr1BetaIndex = 3; // private static final int cdr1AlphaIndex = 2;
// private static final int cdr1BetaIndex = 3;
//Make the graph needed for matching sequences. //Make the graph needed for matching sequences.
//sourceVertexIndices and targetVertexIndices are indices within the cell to use as for the two sets of vertices //sourceVertexIndices and targetVertexIndices are indices within the cell to use as for the two sets of vertices
@@ -127,9 +128,7 @@ public class Simulator implements GraphModificationFunctions {
Duration time = Duration.between(start, stop); Duration time = Duration.between(start, stop);
//create GraphWithMapData object //create GraphWithMapData object
GraphWithMapData output = new GraphWithMapData(graph, numWells, samplePlate.getPopulations(), alphaCount, betaCount, GraphWithMapData output = new GraphWithMapData(graph, numWells, samplePlate.getPopulations(), distCellsMapAlphaKey, time);
distCellsMapAlphaKey, plateVtoAMap, plateVtoBMap, plateAtoVMap,
plateBtoVMap, alphaWellCounts, betaWellCounts, time);
//Set source file name in graph to name of sample plate //Set source file name in graph to name of sample plate
output.setSourceFilename(samplePlate.getSourceFileName()); output.setSourceFilename(samplePlate.getSourceFileName());
//return GraphWithMapData object //return GraphWithMapData object
@@ -145,8 +144,8 @@ public class Simulator implements GraphModificationFunctions {
Map<Vertex[], Integer> removedEdges = new HashMap<>(); Map<Vertex[], Integer> removedEdges = new HashMap<>();
boolean saveEdges = BiGpairSEQ.cacheGraph(); boolean saveEdges = BiGpairSEQ.cacheGraph();
int numWells = data.getNumWells(); int numWells = data.getNumWells();
Integer alphaCount = data.getAlphaCount(); //Integer alphaCount = data.getAlphaCount();
Integer betaCount = data.getBetaCount(); //Integer betaCount = data.getBetaCount();
Map<Integer, Integer> distCellsMapAlphaKey = data.getDistCellsMapAlphaKey(); Map<Integer, Integer> distCellsMapAlphaKey = data.getDistCellsMapAlphaKey();
Set<Vertex> alphas = new HashSet<>(); Set<Vertex> alphas = new HashSet<>();
Set<Vertex> betas = new HashSet<>(); Set<Vertex> betas = new HashSet<>();
@@ -158,6 +157,8 @@ public class Simulator implements GraphModificationFunctions {
betas.add(v); betas.add(v);
} }
} }
Integer alphaCount = alphas.size();
Integer betaCount = betas.size();
//remove edges with weights outside given overlap thresholds, add those to removed edge list //remove edges with weights outside given overlap thresholds, add those to removed edge list
if(verbose){System.out.println("Eliminating edges with weights outside overlap threshold values");} if(verbose){System.out.println("Eliminating edges with weights outside overlap threshold values");}