196 lines
6.2 KiB
Java
196 lines
6.2 KiB
Java
import java.util.Random;
|
|
|
|
//main class. For choosing interface type and holding settings
|
|
public class BiGpairSEQ {
|
|
|
|
private static final Random rand = new Random();
|
|
private static CellSample cellSampleInMemory = null;
|
|
private static String cellFilename = null;
|
|
private static Plate plateInMemory = null;
|
|
private static String plateFilename = null;
|
|
private static GraphWithMapData graphInMemory = null;
|
|
private static String graphFilename = null;
|
|
private static boolean cacheCells = false;
|
|
private static boolean cachePlate = false;
|
|
private static boolean cacheGraph = false;
|
|
private static AlgorithmType matchingAlgorithmType = AlgorithmType.HUNGARIAN;
|
|
private static HeapType priorityQueueHeapType = HeapType.PAIRING;
|
|
private static DistributionType distributionType = DistributionType.ZIPF;
|
|
private static boolean outputBinary = true;
|
|
private static boolean outputGraphML = false;
|
|
private static boolean calculatePValue = false;
|
|
private static final String version = "version 4.2";
|
|
|
|
public static void main(String[] args) {
|
|
if (args.length == 0) {
|
|
InteractiveInterface.startInteractive();
|
|
}
|
|
else {
|
|
//This will be uncommented when command line arguments are re-implemented.
|
|
CommandLineInterface.startCLI(args);
|
|
//System.out.println("Command line arguments are still being re-implemented.");
|
|
}
|
|
}
|
|
|
|
public static Random getRand() {
|
|
return rand;
|
|
}
|
|
|
|
public static CellSample getCellSampleInMemory() {
|
|
return cellSampleInMemory;
|
|
}
|
|
|
|
public static void setCellSampleInMemory(CellSample cellSample, String filename) {
|
|
if(cellSampleInMemory != null) {
|
|
clearCellSampleInMemory();
|
|
}
|
|
cellSampleInMemory = cellSample;
|
|
cellFilename = filename;
|
|
System.out.println("Cell sample file " + filename + " cached.");
|
|
}
|
|
|
|
public static void clearCellSampleInMemory() {
|
|
cellSampleInMemory = null;
|
|
cellFilename = null;
|
|
System.gc();
|
|
System.out.println("Cell sample file cache cleared.");
|
|
|
|
}
|
|
|
|
public static String getCellFilename() {
|
|
return cellFilename;
|
|
}
|
|
|
|
public static DistributionType getDistributionType() {return distributionType;}
|
|
|
|
public static void setDistributionType(DistributionType type) {distributionType = type;}
|
|
|
|
public static Plate getPlateInMemory() {
|
|
return plateInMemory;
|
|
}
|
|
|
|
public static void setPlateInMemory(Plate plate, String filename) {
|
|
if(plateInMemory != null) {
|
|
clearPlateInMemory();
|
|
}
|
|
plateInMemory = plate;
|
|
plateFilename = filename;
|
|
System.out.println("Sample plate file " + filename + " cached.");
|
|
}
|
|
|
|
public static void clearPlateInMemory() {
|
|
plateInMemory = null;
|
|
plateFilename = null;
|
|
System.gc();
|
|
System.out.println("Sample plate file cache cleared.");
|
|
|
|
}
|
|
|
|
public static String getPlateFilename() {
|
|
return plateFilename;
|
|
}
|
|
|
|
|
|
public static GraphWithMapData getGraphInMemory() {return graphInMemory;
|
|
}
|
|
|
|
public static void setGraphInMemory(GraphWithMapData g, String filename) {
|
|
if (graphInMemory != null) {
|
|
clearGraphInMemory();
|
|
}
|
|
graphInMemory = g;
|
|
graphFilename = filename;
|
|
System.out.println("Graph and data file " + filename + " cached.");
|
|
}
|
|
|
|
public static void clearGraphInMemory() {
|
|
graphInMemory = null;
|
|
graphFilename = null;
|
|
System.gc();
|
|
System.out.println("Graph and data file cache cleared.");
|
|
}
|
|
|
|
public static String getGraphFilename() {
|
|
return graphFilename;
|
|
}
|
|
|
|
public static boolean cacheCells() {
|
|
return cacheCells;
|
|
}
|
|
|
|
public static void setCacheCells(boolean cacheCells) {
|
|
//if not caching, clear the memory
|
|
if(!cacheCells){
|
|
BiGpairSEQ.clearCellSampleInMemory();
|
|
System.out.println("Cell sample file caching: OFF.");
|
|
}
|
|
else {
|
|
System.out.println("Cell sample file caching: ON.");
|
|
}
|
|
BiGpairSEQ.cacheCells = cacheCells;
|
|
}
|
|
|
|
public static boolean cachePlate() {
|
|
return cachePlate;
|
|
}
|
|
|
|
public static void setCachePlate(boolean cachePlate) {
|
|
//if not caching, clear the memory
|
|
if(!cachePlate) {
|
|
BiGpairSEQ.clearPlateInMemory();
|
|
System.out.println("Sample plate file caching: OFF.");
|
|
}
|
|
else {
|
|
System.out.println("Sample plate file caching: ON.");
|
|
}
|
|
BiGpairSEQ.cachePlate = cachePlate;
|
|
}
|
|
|
|
public static boolean cacheGraph() {
|
|
return cacheGraph;
|
|
}
|
|
|
|
public static void setCacheGraph(boolean cacheGraph) {
|
|
//if not caching, clear the memory
|
|
if(!cacheGraph) {
|
|
BiGpairSEQ.clearGraphInMemory();
|
|
System.out.println("Graph/data file caching: OFF.");
|
|
}
|
|
else {
|
|
System.out.println("Graph/data file caching: ON.");
|
|
}
|
|
BiGpairSEQ.cacheGraph = cacheGraph;
|
|
}
|
|
|
|
public static HeapType getPriorityQueueHeapType() {
|
|
return priorityQueueHeapType;
|
|
}
|
|
|
|
public static AlgorithmType getMatchingAlgorithmType() { return matchingAlgorithmType; }
|
|
|
|
public static void setHungarianAlgorithm() { matchingAlgorithmType = AlgorithmType.HUNGARIAN; }
|
|
|
|
public static void setIntegerWeightScalingAlgorithm() { matchingAlgorithmType = AlgorithmType.INTEGER_WEIGHT_SCALING; }
|
|
|
|
public static void setAuctionAlgorithm() { matchingAlgorithmType = AlgorithmType.AUCTION; }
|
|
|
|
public static void setPairingHeap() {
|
|
priorityQueueHeapType = HeapType.PAIRING;
|
|
}
|
|
|
|
public static void setFibonacciHeap() {
|
|
priorityQueueHeapType = HeapType.FIBONACCI;
|
|
}
|
|
|
|
public static boolean outputBinary() {return outputBinary;}
|
|
public static void setOutputBinary(boolean b) {outputBinary = b;}
|
|
|
|
public static boolean outputGraphML() {return outputGraphML;}
|
|
public static void setOutputGraphML(boolean b) {outputGraphML = b;}
|
|
|
|
public static boolean calculatePValue() {return calculatePValue; }
|
|
public static void setCalculatePValue(boolean b) {calculatePValue = b; }
|
|
|
|
public static String getVersion() { return version; }
|
|
}
|