Re-implemeting CLI options (in progress)
This commit is contained in:
12
src/main/java/BiGpairSEQ.java
Normal file
12
src/main/java/BiGpairSEQ.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
//main class. Only job is to choose which interface to use.
|
||||||
|
public class BiGpairSEQ {
|
||||||
|
|
||||||
|
private static void main(String[] args) {
|
||||||
|
if (args.length == 0) {
|
||||||
|
InteractiveInterface.startInteractive();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
CommandLineInterface.startCLI(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
283
src/main/java/CommandLineInterface.java
Normal file
283
src/main/java/CommandLineInterface.java
Normal file
@@ -0,0 +1,283 @@
|
|||||||
|
import org.apache.commons.cli.*;
|
||||||
|
|
||||||
|
//Class for parsing options passed to program from command line
|
||||||
|
public class CommandLineInterface {
|
||||||
|
|
||||||
|
public static void startCLI(String[] args) {
|
||||||
|
//These command line options are a big mess
|
||||||
|
//Really, I don't think command line tools are expected to work in this many different modes
|
||||||
|
//making cells, making plates, and matching are the sort of thing that UNIX philosophy would say
|
||||||
|
//should be three separate programs.
|
||||||
|
//There might be a way to do it with option parameters?
|
||||||
|
|
||||||
|
//main options set
|
||||||
|
Options mainOptions = new Options();
|
||||||
|
Option makeCells = Option.builder("cells")
|
||||||
|
.longOpt("make-cells")
|
||||||
|
.desc("Makes a file of distinct cells")
|
||||||
|
.build();
|
||||||
|
Option makePlate = Option.builder("plates")
|
||||||
|
.longOpt("make-plates")
|
||||||
|
.desc("Makes a sample plate file")
|
||||||
|
.build();
|
||||||
|
Option makeGraph = Option.builder("graoh")
|
||||||
|
.longOpt("make-graph")
|
||||||
|
.desc("Makes a graph and data file")
|
||||||
|
.build();
|
||||||
|
Option matchCDR3 = Option.builder("match")
|
||||||
|
.longOpt("match-cdr3")
|
||||||
|
.desc("Match CDR3s. Requires a cell sample file and any number of plate files.")
|
||||||
|
.build();
|
||||||
|
OptionGroup mainGroup = new OptionGroup();
|
||||||
|
mainGroup.addOption(makeCells);
|
||||||
|
mainGroup.addOption(makePlate);
|
||||||
|
mainGroup.addOption(makeGraph);
|
||||||
|
mainGroup.addOption(matchCDR3);
|
||||||
|
mainGroup.setRequired(true);
|
||||||
|
mainOptions.addOptionGroup(mainGroup);
|
||||||
|
|
||||||
|
//Reuse clones of this for other options groups, rather than making it lots of times
|
||||||
|
Option outputFile = Option.builder("o")
|
||||||
|
.longOpt("output-file")
|
||||||
|
.hasArg()
|
||||||
|
.argName("filename")
|
||||||
|
.desc("Name of output file")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(outputFile);
|
||||||
|
|
||||||
|
//Options cellOptions = new Options();
|
||||||
|
Option numCells = Option.builder("nc")
|
||||||
|
.longOpt("num-cells")
|
||||||
|
.desc("The number of distinct cells to generate")
|
||||||
|
.hasArg()
|
||||||
|
.argName("number")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(numCells);
|
||||||
|
Option cdr1Freq = Option.builder("d")
|
||||||
|
.longOpt("peptide-diversity-factor")
|
||||||
|
.hasArg()
|
||||||
|
.argName("number")
|
||||||
|
.desc("Number of distinct CDR3s for every CDR1")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(cdr1Freq);
|
||||||
|
//Option cellOutput = (Option) outputFile.clone();
|
||||||
|
//cellOutput.setRequired(true);
|
||||||
|
//mainOptions.addOption(cellOutput);
|
||||||
|
|
||||||
|
//Options plateOptions = new Options();
|
||||||
|
Option inputCells = Option.builder("c")
|
||||||
|
.longOpt("cell-file")
|
||||||
|
.hasArg()
|
||||||
|
.argName("file")
|
||||||
|
.desc("The cell sample file used for filling wells")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(inputCells);
|
||||||
|
Option numWells = Option.builder("w")
|
||||||
|
.longOpt("num-wells")
|
||||||
|
.hasArg()
|
||||||
|
.argName("number")
|
||||||
|
.desc("The number of wells on each plate")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(numWells);
|
||||||
|
Option numPlates = Option.builder("np")
|
||||||
|
.longOpt("num-plates")
|
||||||
|
.hasArg()
|
||||||
|
.argName("number")
|
||||||
|
.desc("The number of plate files to output")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(numPlates);
|
||||||
|
//Option plateOutput = (Option) outputFile.clone();
|
||||||
|
//plateOutput.setRequired(true);
|
||||||
|
//plateOutput.setDescription("Prefix for plate output filenames");
|
||||||
|
//mainOptions.addOption(plateOutput);
|
||||||
|
Option plateErr = Option.builder("err")
|
||||||
|
.longOpt("drop-out-rate")
|
||||||
|
.hasArg()
|
||||||
|
.argName("number")
|
||||||
|
.desc("Well drop-out rate. (Probability between 0 and 1)")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(plateErr);
|
||||||
|
Option plateConcentrations = Option.builder("t")
|
||||||
|
.longOpt("t-cells-per-well")
|
||||||
|
.hasArgs()
|
||||||
|
.argName("number 1, number 2, ...")
|
||||||
|
.desc("Number of T cells per well for each plate section")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(plateConcentrations);
|
||||||
|
|
||||||
|
//different distributions, mutually exclusive
|
||||||
|
OptionGroup plateDistributions = new OptionGroup();
|
||||||
|
Option plateExp = Option.builder("exponential")
|
||||||
|
.desc("Sample from distinct cells with exponential frequency distribution")
|
||||||
|
.build();
|
||||||
|
plateDistributions.addOption(plateExp);
|
||||||
|
Option plateGaussian = Option.builder("gaussian")
|
||||||
|
.desc("Sample from distinct cells with gaussain frequency distribution")
|
||||||
|
.build();
|
||||||
|
plateDistributions.addOption(plateGaussian);
|
||||||
|
Option platePoisson = Option.builder("poisson")
|
||||||
|
.desc("Sample from distinct cells with poisson frequency distribution")
|
||||||
|
.build();
|
||||||
|
plateDistributions.addOption(platePoisson);
|
||||||
|
mainOptions.addOptionGroup(plateDistributions);
|
||||||
|
|
||||||
|
Option plateStdDev = Option.builder("stddev")
|
||||||
|
.desc("Standard deviation for gaussian distribution")
|
||||||
|
.hasArg()
|
||||||
|
.argName("number")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(plateStdDev);
|
||||||
|
|
||||||
|
Option plateLambda = Option.builder("lambda")
|
||||||
|
.desc("Lambda for exponential distribution")
|
||||||
|
.hasArg()
|
||||||
|
.argName("number")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(plateLambda);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// String cellFile, String filename, Double stdDev,
|
||||||
|
// Integer numWells, Integer numSections,
|
||||||
|
// Integer[] concentrations, Double dropOutRate
|
||||||
|
//
|
||||||
|
|
||||||
|
//Options matchOptions = new Options();
|
||||||
|
inputCells.setDescription("The cell sample file to be used for matching.");
|
||||||
|
mainOptions.addOption(inputCells);
|
||||||
|
Option lowThresh = Option.builder("low")
|
||||||
|
.longOpt("low-threshold")
|
||||||
|
.hasArg()
|
||||||
|
.argName("number")
|
||||||
|
.desc("Sets the minimum occupancy overlap to attempt matching")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(lowThresh);
|
||||||
|
Option highThresh = Option.builder("high")
|
||||||
|
.longOpt("high-threshold")
|
||||||
|
.hasArg()
|
||||||
|
.argName("number")
|
||||||
|
.desc("Sets the maximum occupancy overlap to attempt matching")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(highThresh);
|
||||||
|
Option occDiff = Option.builder("occdiff")
|
||||||
|
.longOpt("occupancy-difference")
|
||||||
|
.hasArg()
|
||||||
|
.argName("Number")
|
||||||
|
.desc("Maximum difference in alpha/beta occupancy to attempt matching")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(occDiff);
|
||||||
|
Option overlapPer = Option.builder("ovper")
|
||||||
|
.longOpt("overlap-percent")
|
||||||
|
.hasArg()
|
||||||
|
.argName("Percent")
|
||||||
|
.desc("Minimum overlap percent to attempt matching (0 -100)")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(overlapPer);
|
||||||
|
Option inputPlates = Option.builder("p")
|
||||||
|
.longOpt("plate-files")
|
||||||
|
.hasArgs()
|
||||||
|
.desc("Plate files to match")
|
||||||
|
.build();
|
||||||
|
mainOptions.addOption(inputPlates);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CommandLineParser parser = new DefaultParser();
|
||||||
|
try {
|
||||||
|
CommandLine line = parser.parse(mainOptions, args);
|
||||||
|
if(line.hasOption("match")){
|
||||||
|
//line = parser.parse(mainOptions, args);
|
||||||
|
String cellFile = line.getOptionValue("c");
|
||||||
|
Integer lowThreshold = Integer.valueOf(line.getOptionValue(lowThresh));
|
||||||
|
Integer highThreshold = Integer.valueOf(line.getOptionValue(highThresh));
|
||||||
|
Integer occupancyDifference = Integer.valueOf(line.getOptionValue(occDiff));
|
||||||
|
Integer overlapPercent = Integer.valueOf(line.getOptionValue(overlapPer));
|
||||||
|
for(String plate: line.getOptionValues("p")) {
|
||||||
|
matchCDR3s(cellFile, plate, lowThreshold, highThreshold, occupancyDifference, overlapPercent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(line.hasOption("cells")){
|
||||||
|
//line = parser.parse(mainOptions, args);
|
||||||
|
String filename = line.getOptionValue("o");
|
||||||
|
Integer numDistCells = Integer.valueOf(line.getOptionValue("nc"));
|
||||||
|
Integer freq = Integer.valueOf(line.getOptionValue("d"));
|
||||||
|
makeCells(filename, numDistCells, freq);
|
||||||
|
}
|
||||||
|
else if(line.hasOption("plates")){
|
||||||
|
//line = parser.parse(mainOptions, args);
|
||||||
|
String cellFile = line.getOptionValue("c");
|
||||||
|
String filenamePrefix = line.getOptionValue("o");
|
||||||
|
Integer numWellsOnPlate = Integer.valueOf(line.getOptionValue("w"));
|
||||||
|
Integer numPlatesToMake = Integer.valueOf(line.getOptionValue("np"));
|
||||||
|
String[] concentrationsToUseString = line.getOptionValues("t");
|
||||||
|
Integer numSections = concentrationsToUseString.length;
|
||||||
|
|
||||||
|
Integer[] concentrationsToUse = new Integer[numSections];
|
||||||
|
for(int i = 0; i <numSections; i++){
|
||||||
|
concentrationsToUse[i] = Integer.valueOf(concentrationsToUseString[i]);
|
||||||
|
}
|
||||||
|
Double dropOutRate = Double.valueOf(line.getOptionValue("err"));
|
||||||
|
if(line.hasOption("exponential")){
|
||||||
|
Double lambda = Double.valueOf(line.getOptionValue("lambda"));
|
||||||
|
for(int i = 1; i <= numPlatesToMake; i++){
|
||||||
|
makePlateExp(cellFile, filenamePrefix + i, lambda, numWellsOnPlate,
|
||||||
|
concentrationsToUse,dropOutRate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(line.hasOption("gaussian")){
|
||||||
|
Double stdDev = Double.valueOf(line.getOptionValue("std-dev"));
|
||||||
|
for(int i = 1; i <= numPlatesToMake; i++){
|
||||||
|
makePlate(cellFile, filenamePrefix + i, stdDev, numWellsOnPlate,
|
||||||
|
concentrationsToUse,dropOutRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(line.hasOption("poisson")){
|
||||||
|
for(int i = 1; i <= numPlatesToMake; i++){
|
||||||
|
makePlatePoisson(cellFile, filenamePrefix + i, numWellsOnPlate,
|
||||||
|
concentrationsToUse,dropOutRate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ParseException exp) {
|
||||||
|
System.err.println("Parsing failed. Reason: " + exp.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//for calling from command line
|
||||||
|
public static void makeCells(String filename, Integer numCells, Integer cdr1Freq){
|
||||||
|
CellSample sample = Simulator.generateCellSample(numCells, cdr1Freq);
|
||||||
|
CellFileWriter writer = new CellFileWriter(filename, sample);
|
||||||
|
writer.writeCellsToFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void makePlateExp(String cellFile, String filename, Double lambda,
|
||||||
|
Integer numWells, Integer[] concentrations, Double dropOutRate){
|
||||||
|
CellFileReader cellReader = new CellFileReader(cellFile);
|
||||||
|
Plate samplePlate = new Plate(numWells, dropOutRate, concentrations);
|
||||||
|
samplePlate.fillWellsExponential(cellReader.getFilename(), cellReader.getCells(), lambda);
|
||||||
|
PlateFileWriter writer = new PlateFileWriter(filename, samplePlate);
|
||||||
|
writer.writePlateFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void makePlatePoisson(String cellFile, String filename, Integer numWells,
|
||||||
|
Integer[] concentrations, Double dropOutRate){
|
||||||
|
CellFileReader cellReader = new CellFileReader(cellFile);
|
||||||
|
Double stdDev = Math.sqrt(cellReader.getCellCount());
|
||||||
|
Plate samplePlate = new Plate(numWells, dropOutRate, concentrations);
|
||||||
|
samplePlate.fillWells(cellReader.getFilename(), cellReader.getCells(), stdDev);
|
||||||
|
PlateFileWriter writer = new PlateFileWriter(filename, samplePlate);
|
||||||
|
writer.writePlateFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void makePlate(String cellFile, String filename, Double stdDev,
|
||||||
|
Integer numWells, Integer[] concentrations, Double dropOutRate){
|
||||||
|
CellFileReader cellReader = new CellFileReader(cellFile);
|
||||||
|
Plate samplePlate = new Plate(numWells, dropOutRate, concentrations);
|
||||||
|
samplePlate.fillWells(cellReader.getFilename(), cellReader.getCells(), stdDev);
|
||||||
|
PlateFileWriter writer = new PlateFileWriter(filename, samplePlate);
|
||||||
|
writer.writePlateFile();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,260 +1,17 @@
|
|||||||
import org.apache.commons.cli.*;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.InputMismatchException;
|
import java.util.InputMismatchException;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
public class UserInterface {
|
public class InteractiveInterface {
|
||||||
|
|
||||||
final static Scanner sc = new Scanner(System.in);
|
final static Scanner sc = new Scanner(System.in);
|
||||||
static int input;
|
static int input;
|
||||||
static boolean quit = false;
|
static boolean quit = false;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void startInteractive() {
|
||||||
//for now, commenting out all the command line argument stuff.
|
|
||||||
// Refactoring to output files of graphs, so it would all need to change anyway.
|
|
||||||
|
|
||||||
// if(args.length != 0){
|
|
||||||
// //These command line options are a big mess
|
|
||||||
// //Really, I don't think command line tools are expected to work in this many different modes
|
|
||||||
// //making cells, making plates, and matching are the sort of thing that UNIX philosophy would say
|
|
||||||
// //should be three separate programs.
|
|
||||||
// //There might be a way to do it with option parameters?
|
|
||||||
//
|
|
||||||
// Options mainOptions = new Options();
|
|
||||||
// Option makeCells = Option.builder("cells")
|
|
||||||
// .longOpt("make-cells")
|
|
||||||
// .desc("Makes a file of distinct cells")
|
|
||||||
// .build();
|
|
||||||
// Option makePlate = Option.builder("plates")
|
|
||||||
// .longOpt("make-plates")
|
|
||||||
// .desc("Makes a sample plate file")
|
|
||||||
// .build();
|
|
||||||
// Option matchCDR3 = Option.builder("match")
|
|
||||||
// .longOpt("match-cdr3")
|
|
||||||
// .desc("Match CDR3s. Requires a cell sample file and any number of plate files.")
|
|
||||||
// .build();
|
|
||||||
// OptionGroup mainGroup = new OptionGroup();
|
|
||||||
// mainGroup.addOption(makeCells);
|
|
||||||
// mainGroup.addOption(makePlate);
|
|
||||||
// mainGroup.addOption(matchCDR3);
|
|
||||||
// mainGroup.setRequired(true);
|
|
||||||
// mainOptions.addOptionGroup(mainGroup);
|
|
||||||
//
|
|
||||||
// //Reuse clones of this for other options groups, rather than making it lots of times
|
|
||||||
// Option outputFile = Option.builder("o")
|
|
||||||
// .longOpt("output-file")
|
|
||||||
// .hasArg()
|
|
||||||
// .argName("filename")
|
|
||||||
// .desc("Name of output file")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(outputFile);
|
|
||||||
//
|
|
||||||
// //Options cellOptions = new Options();
|
|
||||||
// Option numCells = Option.builder("nc")
|
|
||||||
// .longOpt("num-cells")
|
|
||||||
// .desc("The number of distinct cells to generate")
|
|
||||||
// .hasArg()
|
|
||||||
// .argName("number")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(numCells);
|
|
||||||
// Option cdr1Freq = Option.builder("d")
|
|
||||||
// .longOpt("peptide-diversity-factor")
|
|
||||||
// .hasArg()
|
|
||||||
// .argName("number")
|
|
||||||
// .desc("Number of distinct CDR3s for every CDR1")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(cdr1Freq);
|
|
||||||
// //Option cellOutput = (Option) outputFile.clone();
|
|
||||||
// //cellOutput.setRequired(true);
|
|
||||||
// //mainOptions.addOption(cellOutput);
|
|
||||||
//
|
|
||||||
// //Options plateOptions = new Options();
|
|
||||||
// Option inputCells = Option.builder("c")
|
|
||||||
// .longOpt("cell-file")
|
|
||||||
// .hasArg()
|
|
||||||
// .argName("file")
|
|
||||||
// .desc("The cell sample file used for filling wells")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(inputCells);
|
|
||||||
// Option numWells = Option.builder("w")
|
|
||||||
// .longOpt("num-wells")
|
|
||||||
// .hasArg()
|
|
||||||
// .argName("number")
|
|
||||||
// .desc("The number of wells on each plate")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(numWells);
|
|
||||||
// Option numPlates = Option.builder("np")
|
|
||||||
// .longOpt("num-plates")
|
|
||||||
// .hasArg()
|
|
||||||
// .argName("number")
|
|
||||||
// .desc("The number of plate files to output")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(numPlates);
|
|
||||||
// //Option plateOutput = (Option) outputFile.clone();
|
|
||||||
// //plateOutput.setRequired(true);
|
|
||||||
// //plateOutput.setDescription("Prefix for plate output filenames");
|
|
||||||
// //mainOptions.addOption(plateOutput);
|
|
||||||
// Option plateErr = Option.builder("err")
|
|
||||||
// .longOpt("drop-out-rate")
|
|
||||||
// .hasArg()
|
|
||||||
// .argName("number")
|
|
||||||
// .desc("Well drop-out rate. (Probability between 0 and 1)")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(plateErr);
|
|
||||||
// Option plateConcentrations = Option.builder("t")
|
|
||||||
// .longOpt("t-cells-per-well")
|
|
||||||
// .hasArgs()
|
|
||||||
// .argName("number 1, number 2, ...")
|
|
||||||
// .desc("Number of T cells per well for each plate section")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(plateConcentrations);
|
|
||||||
//
|
|
||||||
////different distributions, mutually exclusive
|
|
||||||
// OptionGroup plateDistributions = new OptionGroup();
|
|
||||||
// Option plateExp = Option.builder("exponential")
|
|
||||||
// .desc("Sample from distinct cells with exponential frequency distribution")
|
|
||||||
// .build();
|
|
||||||
// plateDistributions.addOption(plateExp);
|
|
||||||
// Option plateGaussian = Option.builder("gaussian")
|
|
||||||
// .desc("Sample from distinct cells with gaussain frequency distribution")
|
|
||||||
// .build();
|
|
||||||
// plateDistributions.addOption(plateGaussian);
|
|
||||||
// Option platePoisson = Option.builder("poisson")
|
|
||||||
// .desc("Sample from distinct cells with poisson frequency distribution")
|
|
||||||
// .build();
|
|
||||||
// plateDistributions.addOption(platePoisson);
|
|
||||||
// mainOptions.addOptionGroup(plateDistributions);
|
|
||||||
//
|
|
||||||
// Option plateStdDev = Option.builder("stddev")
|
|
||||||
// .desc("Standard deviation for gaussian distribution")
|
|
||||||
// .hasArg()
|
|
||||||
// .argName("number")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(plateStdDev);
|
|
||||||
//
|
|
||||||
// Option plateLambda = Option.builder("lambda")
|
|
||||||
// .desc("Lambda for exponential distribution")
|
|
||||||
// .hasArg()
|
|
||||||
// .argName("number")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(plateLambda);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
////
|
|
||||||
//// String cellFile, String filename, Double stdDev,
|
|
||||||
//// Integer numWells, Integer numSections,
|
|
||||||
//// Integer[] concentrations, Double dropOutRate
|
|
||||||
////
|
|
||||||
//
|
|
||||||
// //Options matchOptions = new Options();
|
|
||||||
// inputCells.setDescription("The cell sample file to be used for matching.");
|
|
||||||
// mainOptions.addOption(inputCells);
|
|
||||||
// Option lowThresh = Option.builder("low")
|
|
||||||
// .longOpt("low-threshold")
|
|
||||||
// .hasArg()
|
|
||||||
// .argName("number")
|
|
||||||
// .desc("Sets the minimum occupancy overlap to attempt matching")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(lowThresh);
|
|
||||||
// Option highThresh = Option.builder("high")
|
|
||||||
// .longOpt("high-threshold")
|
|
||||||
// .hasArg()
|
|
||||||
// .argName("number")
|
|
||||||
// .desc("Sets the maximum occupancy overlap to attempt matching")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(highThresh);
|
|
||||||
// Option occDiff = Option.builder("occdiff")
|
|
||||||
// .longOpt("occupancy-difference")
|
|
||||||
// .hasArg()
|
|
||||||
// .argName("Number")
|
|
||||||
// .desc("Maximum difference in alpha/beta occupancy to attempt matching")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(occDiff);
|
|
||||||
// Option overlapPer = Option.builder("ovper")
|
|
||||||
// .longOpt("overlap-percent")
|
|
||||||
// .hasArg()
|
|
||||||
// .argName("Percent")
|
|
||||||
// .desc("Minimum overlap percent to attempt matching (0 -100)")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(overlapPer);
|
|
||||||
// Option inputPlates = Option.builder("p")
|
|
||||||
// .longOpt("plate-files")
|
|
||||||
// .hasArgs()
|
|
||||||
// .desc("Plate files to match")
|
|
||||||
// .build();
|
|
||||||
// mainOptions.addOption(inputPlates);
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// CommandLineParser parser = new DefaultParser();
|
|
||||||
// try {
|
|
||||||
// CommandLine line = parser.parse(mainOptions, args);
|
|
||||||
// if(line.hasOption("match")){
|
|
||||||
// //line = parser.parse(mainOptions, args);
|
|
||||||
// String cellFile = line.getOptionValue("c");
|
|
||||||
// Integer lowThreshold = Integer.valueOf(line.getOptionValue(lowThresh));
|
|
||||||
// Integer highThreshold = Integer.valueOf(line.getOptionValue(highThresh));
|
|
||||||
// Integer occupancyDifference = Integer.valueOf(line.getOptionValue(occDiff));
|
|
||||||
// Integer overlapPercent = Integer.valueOf(line.getOptionValue(overlapPer));
|
|
||||||
// for(String plate: line.getOptionValues("p")) {
|
|
||||||
// matchCDR3s(cellFile, plate, lowThreshold, highThreshold, occupancyDifference, overlapPercent);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else if(line.hasOption("cells")){
|
|
||||||
// //line = parser.parse(mainOptions, args);
|
|
||||||
// String filename = line.getOptionValue("o");
|
|
||||||
// Integer numDistCells = Integer.valueOf(line.getOptionValue("nc"));
|
|
||||||
// Integer freq = Integer.valueOf(line.getOptionValue("d"));
|
|
||||||
// makeCells(filename, numDistCells, freq);
|
|
||||||
// }
|
|
||||||
// else if(line.hasOption("plates")){
|
|
||||||
// //line = parser.parse(mainOptions, args);
|
|
||||||
// String cellFile = line.getOptionValue("c");
|
|
||||||
// String filenamePrefix = line.getOptionValue("o");
|
|
||||||
// Integer numWellsOnPlate = Integer.valueOf(line.getOptionValue("w"));
|
|
||||||
// Integer numPlatesToMake = Integer.valueOf(line.getOptionValue("np"));
|
|
||||||
// String[] concentrationsToUseString = line.getOptionValues("t");
|
|
||||||
// Integer numSections = concentrationsToUseString.length;
|
|
||||||
//
|
|
||||||
// Integer[] concentrationsToUse = new Integer[numSections];
|
|
||||||
// for(int i = 0; i <numSections; i++){
|
|
||||||
// concentrationsToUse[i] = Integer.valueOf(concentrationsToUseString[i]);
|
|
||||||
// }
|
|
||||||
// Double dropOutRate = Double.valueOf(line.getOptionValue("err"));
|
|
||||||
// if(line.hasOption("exponential")){
|
|
||||||
// Double lambda = Double.valueOf(line.getOptionValue("lambda"));
|
|
||||||
// for(int i = 1; i <= numPlatesToMake; i++){
|
|
||||||
// makePlateExp(cellFile, filenamePrefix + i, lambda, numWellsOnPlate,
|
|
||||||
// concentrationsToUse,dropOutRate);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else if(line.hasOption("gaussian")){
|
|
||||||
// Double stdDev = Double.valueOf(line.getOptionValue("std-dev"));
|
|
||||||
// for(int i = 1; i <= numPlatesToMake; i++){
|
|
||||||
// makePlate(cellFile, filenamePrefix + i, stdDev, numWellsOnPlate,
|
|
||||||
// concentrationsToUse,dropOutRate);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// else if(line.hasOption("poisson")){
|
|
||||||
// for(int i = 1; i <= numPlatesToMake; i++){
|
|
||||||
// makePlatePoisson(cellFile, filenamePrefix + i, numWellsOnPlate,
|
|
||||||
// concentrationsToUse,dropOutRate);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// catch (ParseException exp) {
|
|
||||||
// System.err.println("Parsing failed. Reason: " + exp.getMessage());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
while (!quit) {
|
while (!quit) {
|
||||||
System.out.println();
|
System.out.println();
|
||||||
System.out.println("--------BiGPairSEQ SIMULATOR--------");
|
System.out.println("--------BiGPairSEQ SIMULATOR--------");
|
||||||
@@ -274,10 +31,10 @@ public class UserInterface {
|
|||||||
try {
|
try {
|
||||||
input = sc.nextInt();
|
input = sc.nextInt();
|
||||||
switch (input) {
|
switch (input) {
|
||||||
case 1 -> makeCells();
|
case 1 -> makeCellsInteractive();
|
||||||
case 2 -> makePlate();
|
case 2 -> makePlateInteractive();
|
||||||
case 3 -> makeCDR3Graph();
|
case 3 -> makeCDR3GraphInteractive();
|
||||||
case 4 -> matchCDR3s();
|
case 4 -> matchCDR3sInteractive();
|
||||||
//case 6 -> matchCellsCDR1();
|
//case 6 -> matchCellsCDR1();
|
||||||
case 9 -> acknowledge();
|
case 9 -> acknowledge();
|
||||||
case 0 -> quit = true;
|
case 0 -> quit = true;
|
||||||
@@ -289,10 +46,9 @@ public class UserInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sc.close();
|
sc.close();
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void makeCells() {
|
private static void makeCellsInteractive() {
|
||||||
String filename = null;
|
String filename = null;
|
||||||
Integer numCells = 0;
|
Integer numCells = 0;
|
||||||
Integer cdr1Freq = 1;
|
Integer cdr1Freq = 1;
|
||||||
@@ -322,43 +78,8 @@ public class UserInterface {
|
|||||||
System.gc();
|
System.gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
// //for calling from command line
|
|
||||||
// private static void makeCells(String filename, Integer numCells, Integer cdr1Freq){
|
|
||||||
// CellSample sample = Simulator.generateCellSample(numCells, cdr1Freq);
|
|
||||||
// CellFileWriter writer = new CellFileWriter(filename, sample);
|
|
||||||
// writer.writeCellsToFile();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private static void makePlateExp(String cellFile, String filename, Double lambda,
|
|
||||||
// Integer numWells, Integer[] concentrations, Double dropOutRate){
|
|
||||||
// CellFileReader cellReader = new CellFileReader(cellFile);
|
|
||||||
// Plate samplePlate = new Plate(numWells, dropOutRate, concentrations);
|
|
||||||
// samplePlate.fillWellsExponential(cellReader.getFilename(), cellReader.getCells(), lambda);
|
|
||||||
// PlateFileWriter writer = new PlateFileWriter(filename, samplePlate);
|
|
||||||
// writer.writePlateFile();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private static void makePlatePoisson(String cellFile, String filename, Integer numWells,
|
|
||||||
// Integer[] concentrations, Double dropOutRate){
|
|
||||||
// CellFileReader cellReader = new CellFileReader(cellFile);
|
|
||||||
// Double stdDev = Math.sqrt(cellReader.getCellCount());
|
|
||||||
// Plate samplePlate = new Plate(numWells, dropOutRate, concentrations);
|
|
||||||
// samplePlate.fillWells(cellReader.getFilename(), cellReader.getCells(), stdDev);
|
|
||||||
// PlateFileWriter writer = new PlateFileWriter(filename, samplePlate);
|
|
||||||
// writer.writePlateFile();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private static void makePlate(String cellFile, String filename, Double stdDev,
|
|
||||||
// Integer numWells, Integer[] concentrations, Double dropOutRate){
|
|
||||||
// CellFileReader cellReader = new CellFileReader(cellFile);
|
|
||||||
// Plate samplePlate = new Plate(numWells, dropOutRate, concentrations);
|
|
||||||
// samplePlate.fillWells(cellReader.getFilename(), cellReader.getCells(), stdDev);
|
|
||||||
// PlateFileWriter writer = new PlateFileWriter(filename, samplePlate);
|
|
||||||
// writer.writePlateFile();
|
|
||||||
// }
|
|
||||||
|
|
||||||
//Output a CSV of sample plate
|
//Output a CSV of sample plate
|
||||||
private static void makePlate() {
|
private static void makePlateInteractive() {
|
||||||
String cellFile = null;
|
String cellFile = null;
|
||||||
String filename = null;
|
String filename = null;
|
||||||
Double stdDev = 0.0;
|
Double stdDev = 0.0;
|
||||||
@@ -471,7 +192,7 @@ public class UserInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Output serialized binary of GraphAndMapData object
|
//Output serialized binary of GraphAndMapData object
|
||||||
private static void makeCDR3Graph() {
|
private static void makeCDR3GraphInteractive() {
|
||||||
String filename = null;
|
String filename = null;
|
||||||
String cellFile = null;
|
String cellFile = null;
|
||||||
String plateFile = null;
|
String plateFile = null;
|
||||||
@@ -520,7 +241,7 @@ public class UserInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Simulate matching and output CSV file of results
|
//Simulate matching and output CSV file of results
|
||||||
private static void matchCDR3s() throws IOException {
|
private static void matchCDR3sInteractive() throws IOException {
|
||||||
String filename = null;
|
String filename = null;
|
||||||
String dataFilename = null;
|
String dataFilename = null;
|
||||||
Integer lowThreshold = 0;
|
Integer lowThreshold = 0;
|
||||||
Reference in New Issue
Block a user