make everything use same random number generator
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
|
import java.util.Random;
|
||||||
|
|
||||||
//main class. For choosing interface type and caching file data
|
//main class. For choosing interface type and caching file data
|
||||||
public class BiGpairSEQ {
|
public class BiGpairSEQ {
|
||||||
|
|
||||||
|
private static final Random rand = new Random();
|
||||||
private static CellSample cellSampleInMemory = null;
|
private static CellSample cellSampleInMemory = null;
|
||||||
private static String cellFilename = null;
|
private static String cellFilename = null;
|
||||||
private static Plate plateInMemory = null;
|
private static Plate plateInMemory = null;
|
||||||
private static String plateFilename = null;
|
private static String plateFilename = null;
|
||||||
|
|
||||||
private static GraphWithMapData graphInMemory = null;
|
private static GraphWithMapData graphInMemory = null;
|
||||||
private static String graphFilename = null;
|
private static String graphFilename = null;
|
||||||
|
|
||||||
@@ -20,6 +22,10 @@ public class BiGpairSEQ {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Random getRand() {
|
||||||
|
return rand;
|
||||||
|
}
|
||||||
|
|
||||||
public static CellSample getCellSampleInMemory() {
|
public static CellSample getCellSampleInMemory() {
|
||||||
return cellSampleInMemory;
|
return cellSampleInMemory;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,6 @@ import java.math.MathContext;
|
|||||||
|
|
||||||
public abstract class Equations {
|
public abstract class Equations {
|
||||||
|
|
||||||
public static int getRandomInt(int min, int max) {
|
|
||||||
return (int) ((Math.random() * (max - min)) + min);
|
|
||||||
}
|
|
||||||
|
|
||||||
//pValue calculation as described in original pairSEQ paper.
|
//pValue calculation as described in original pairSEQ paper.
|
||||||
//Included for comparison with original results.
|
//Included for comparison with original results.
|
||||||
//Not used by BiGpairSEQ for matching.
|
//Not used by BiGpairSEQ for matching.
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Scanner;
|
|
||||||
import java.util.InputMismatchException;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
//
|
//
|
||||||
public class InteractiveInterface {
|
public class InteractiveInterface {
|
||||||
|
|
||||||
final static Scanner sc = new Scanner(System.in);
|
private static final Random rand = BiGpairSEQ.getRand();
|
||||||
static int input;
|
private static final Scanner sc = new Scanner(System.in);
|
||||||
static boolean quit = false;
|
private static int input;
|
||||||
|
private static boolean quit = false;
|
||||||
|
|
||||||
public static void startInteractive() {
|
public static void startInteractive() {
|
||||||
|
|
||||||
@@ -169,10 +167,11 @@ public class InteractiveInterface {
|
|||||||
if(maxPop < minPop) {
|
if(maxPop < minPop) {
|
||||||
throw new InputMismatchException("Max well population must be greater than min well population");
|
throw new InputMismatchException("Max well population must be greater than min well population");
|
||||||
}
|
}
|
||||||
populations = new Integer[numSections];
|
//maximum should be inclusive, so need to add one to max of randomly generated values
|
||||||
for(int i = 0; i < numSections; i++) {
|
populations = (Integer[]) rand.ints(minPop, maxPop + 1)
|
||||||
populations[i] = Equations.getRandomInt(minPop, maxPop);
|
.limit(numSections)
|
||||||
}
|
.boxed()
|
||||||
|
.toArray();
|
||||||
System.out.print("Populations: ");
|
System.out.print("Populations: ");
|
||||||
System.out.println(Arrays.toString(populations));
|
System.out.println(Arrays.toString(populations));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.util.*;
|
|||||||
public class Plate {
|
public class Plate {
|
||||||
private String sourceFile;
|
private String sourceFile;
|
||||||
private List<List<Integer[]>> wells;
|
private List<List<Integer[]>> wells;
|
||||||
private Random rand = new Random();
|
private final Random rand = BiGpairSEQ.getRand();
|
||||||
private int size;
|
private int size;
|
||||||
private double error;
|
private double error;
|
||||||
private Integer[] populations;
|
private Integer[] populations;
|
||||||
|
|||||||
Reference in New Issue
Block a user