Refactor plate to fill its own wells in its constructor

This commit is contained in:
2022-02-27 14:17:11 -06:00
parent 6b5837e6ce
commit 974d2d650c

View File

@@ -8,6 +8,7 @@ TODO: Implement discrete frequency distributions using Vose's Alias Method
import java.util.*; import java.util.*;
public class Plate { public class Plate {
private CellSample cells;
private String sourceFile; private String sourceFile;
private List<List<Integer[]>> wells; private List<List<Integer[]>> wells;
private final Random rand = BiGpairSEQ.getRand(); private final Random rand = BiGpairSEQ.getRand();
@@ -18,6 +19,24 @@ public class Plate {
private double lambda; private double lambda;
boolean exponential = false; boolean exponential = false;
public Plate(CellSample cells, String cellFilename, int size, Integer[] populations,
double dropoutRate, double stdDev_or_lambda, boolean exponential){
this.cells = cells;
this.sourceFile = cellFilename;
this.size = size;
this.error = dropoutRate;
this.populations = populations;
this.exponential = exponential;
if (this.exponential) {
this.lambda = stdDev_or_lambda;
fillWellsExponential(cells.getCells(), this.lambda);
}
else {
this.stdDev = stdDev_or_lambda;
fillWells(cells.getCells(), this.stdDev);
}
}
public Plate(int size, double error, Integer[] populations) { public Plate(int size, double error, Integer[] populations) {
this.size = size; this.size = size;
@@ -43,10 +62,9 @@ public class Plate {
} }
} }
public void fillWellsExponential(String sourceFileName, List<Integer[]> cells, double lambda){ private void fillWellsExponential(List<Integer[]> cells, double lambda){
this.lambda = lambda; this.lambda = lambda;
exponential = true; exponential = true;
sourceFile = sourceFileName;
int numSections = populations.length; int numSections = populations.length;
int section = 0; int section = 0;
double m; double m;
@@ -74,9 +92,8 @@ public class Plate {
} }
} }
public void fillWells(String sourceFileName, List<Integer[]> cells, double stdDev) { private void fillWells( List<Integer[]> cells, double stdDev) {
this.stdDev = stdDev; this.stdDev = stdDev;
sourceFile = sourceFileName;
int numSections = populations.length; int numSections = populations.length;
int section = 0; int section = 0;
double m; double m;