Added metadata to MatchingResult to enable CLI options
This commit is contained in:
@@ -1,26 +1,28 @@
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/*
|
||||
TODO: Implement exponential distribution using inversion method - DONE
|
||||
TODO: Implement discrete frequency distributions using Vose's Alias Method
|
||||
*/
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Plate {
|
||||
private String sourceFile;
|
||||
private List<List<Integer[]>> wells;
|
||||
private Random rand = new Random();
|
||||
private int size;
|
||||
private double error;
|
||||
private Integer[] concentrations;
|
||||
private Integer[] populations;
|
||||
private double stdDev;
|
||||
private double lambda;
|
||||
boolean exponential = false;
|
||||
|
||||
|
||||
public Plate(int size, double error, Integer[] concentrations) {
|
||||
public Plate(int size, double error, Integer[] populations) {
|
||||
this.size = size;
|
||||
this.error = error;
|
||||
this.concentrations = concentrations;
|
||||
this.populations = populations;
|
||||
wells = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -35,9 +37,9 @@ public class Plate {
|
||||
concentrations.add(w.size());
|
||||
}
|
||||
}
|
||||
this.concentrations = new Integer[concentrations.size()];
|
||||
for (int i = 0; i < this.concentrations.length; i++) {
|
||||
this.concentrations[i] = concentrations.get(i);
|
||||
this.populations = new Integer[concentrations.size()];
|
||||
for (int i = 0; i < this.populations.length; i++) {
|
||||
this.populations[i] = concentrations.get(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +47,7 @@ public class Plate {
|
||||
this.lambda = lambda;
|
||||
exponential = true;
|
||||
sourceFile = sourceFileName;
|
||||
int numSections = concentrations.length;
|
||||
int numSections = populations.length;
|
||||
int section = 0;
|
||||
double m;
|
||||
int n;
|
||||
@@ -53,7 +55,7 @@ public class Plate {
|
||||
while (section < numSections){
|
||||
for (int i = 0; i < (size / numSections); i++) {
|
||||
List<Integer[]> well = new ArrayList<>();
|
||||
for (int j = 0; j < concentrations[section]; j++) {
|
||||
for (int j = 0; j < populations[section]; j++) {
|
||||
do {
|
||||
//inverse transform sampling: for random number u in [0,1), x = log(1-u) / (-lambda)
|
||||
m = (Math.log10((1 - rand.nextDouble()))/(-lambda)) * Math.sqrt(cells.size());
|
||||
@@ -84,14 +86,14 @@ public class Plate {
|
||||
public void fillWells(String sourceFileName, List<Integer[]> cells, double stdDev) {
|
||||
this.stdDev = stdDev;
|
||||
sourceFile = sourceFileName;
|
||||
int numSections = concentrations.length;
|
||||
int numSections = populations.length;
|
||||
int section = 0;
|
||||
double m;
|
||||
int n;
|
||||
while (section < numSections){
|
||||
for (int i = 0; i < (size / numSections); i++) {
|
||||
List<Integer[]> well = new ArrayList<>();
|
||||
for (int j = 0; j < concentrations[section]; j++) {
|
||||
for (int j = 0; j < populations[section]; j++) {
|
||||
do {
|
||||
m = (rand.nextGaussian() * stdDev) + (cells.size() / 2);
|
||||
} while (m >= cells.size() || m < 0);
|
||||
@@ -110,8 +112,8 @@ public class Plate {
|
||||
}
|
||||
}
|
||||
|
||||
public Integer[] getConcentrations(){
|
||||
return concentrations;
|
||||
public Integer[] getPopulations(){
|
||||
return populations;
|
||||
}
|
||||
|
||||
public int getSize(){
|
||||
|
||||
Reference in New Issue
Block a user