reimplement CLI (in progress)

This commit is contained in:
2022-02-22 19:42:23 -06:00
parent 906c06062f
commit 875f457a2d
3 changed files with 64 additions and 25 deletions

View File

@@ -1,6 +1,45 @@
import org.apache.commons.cli.*;
//Class for parsing options passed to program from command line
/*
* Class for parsing options passed to program from command line
*
* Top-level flags:
* cells : to make a cell sample file
* plate : to make a sample plate file
* graph : to make a graph and data file
* match : to do a cdr3 matching (WITH OR WITHOUT MAKING A RESULTS FILE. May just want to print summary for piping.)
*
* Cell flags:
* count : number of cells to generate
* diversity factor : factor by which CDR3s are more diverse than CDR1s
* output : name of the output file
*
* Plate flags:
* cellfile : name of the cell sample file to use as input
* wells : the number of wells on the plate
* dist : the statistical distribution to use
* (if exponential) lambda : the lambda value of the exponential distribution
* (if gaussian) stddev : the standard deviation of the gaussian distribution
* rand : randomize well populations, take a minimum argument and a maximum argument
* populations : number of t cells per well per section (number of arguments determines number of sections)
* dropout : plate dropout rate, double from 0.0 to 1.0
* output : name of the output file
*
* Graph flags:
* cellfile : name of the cell sample file to use as input
* platefile : name of the sample plate file to use as input
* output : name of the output file
*
* Match flags:
* graphFile : name of graph and data file to use as input
* min : minimum number of overlap wells to attempt a matching
* max : the maximum number of overlap wells to attempt a matching
* maxdiff : (optional) the maximum difference in occupancy to attempt a matching
* minpercent : (optional) the minimum percent overlap to attempt a matching.
* writefile : (optional) the filename to write results to
* output : the values to print to System.out for piping
*
*/
public class CommandLineInterface {
public static void startCLI(String[] args) {
@@ -20,7 +59,7 @@ public class CommandLineInterface {
.longOpt("make-plates")
.desc("Makes a sample plate file")
.build();
Option makeGraph = Option.builder("graoh")
Option makeGraph = Option.builder("graph")
.longOpt("make-graph")
.desc("Makes a graph and data file")
.build();

View File

@@ -31,10 +31,10 @@ public class InteractiveInterface {
try {
input = sc.nextInt();
switch (input) {
case 1 -> makeCellsInteractive();
case 2 -> makePlateInteractive();
case 3 -> makeCDR3GraphInteractive();
case 4 -> matchCDR3sInteractive();
case 1 -> makeCells();
case 2 -> makePlate();
case 3 -> makeCDR3Graph();
case 4 -> matchCDR3s();
//case 6 -> matchCellsCDR1();
case 9 -> acknowledge();
case 0 -> quit = true;
@@ -48,7 +48,7 @@ public class InteractiveInterface {
sc.close();
}
private static void makeCellsInteractive() {
private static void makeCells() {
String filename = null;
Integer numCells = 0;
Integer cdr1Freq = 1;
@@ -79,7 +79,7 @@ public class InteractiveInterface {
}
//Output a CSV of sample plate
private static void makePlateInteractive() {
private static void makePlate() {
String cellFile = null;
String filename = null;
Double stdDev = 0.0;
@@ -192,7 +192,7 @@ public class InteractiveInterface {
}
//Output serialized binary of GraphAndMapData object
private static void makeCDR3GraphInteractive() {
private static void makeCDR3Graph() {
String filename = null;
String cellFile = null;
String plateFile = null;
@@ -241,7 +241,7 @@ public class InteractiveInterface {
}
//Simulate matching and output CSV file of results
private static void matchCDR3sInteractive() throws IOException {
private static void matchCDR3s() throws IOException {
String filename = null;
String dataFilename = null;
Integer lowThreshold = 0;

View File

@@ -16,7 +16,6 @@ public class PlateFileWriter {
private Double error;
private String filename;
private String sourceFileName;
private String[] headers;
private Integer[] concentrations;
private boolean isExponential = false;
@@ -58,20 +57,21 @@ public class PlateFileWriter {
}
}
//this took forever and I don't use it
List<List<String>> rows = new ArrayList<>();
List<String> tmp = new ArrayList<>();
for(int i = 0; i < wellsAsStrings.size(); i++){//List<Integer[]> w: wells){
tmp.add("well " + (i+1));
}
rows.add(tmp);
for(int row = 0; row < maxLength; row++){
tmp = new ArrayList<>();
for(List<String> c: wellsAsStrings){
tmp.add(c.get(row));
}
rows.add(tmp);
}
// //this took forever and I don't use it
// //if I wanted to use it, I'd replace printer.printRecords(wellsAsStrings) with printer.printRecords(rows)
// List<List<String>> rows = new ArrayList<>();
// List<String> tmp = new ArrayList<>();
// for(int i = 0; i < wellsAsStrings.size(); i++){//List<Integer[]> w: wells){
// tmp.add("well " + (i+1));
// }
// rows.add(tmp);
// for(int row = 0; row < maxLength; row++){
// tmp = new ArrayList<>();
// for(List<String> c: wellsAsStrings){
// tmp.add(c.get(row));
// }
// rows.add(tmp);
// }
//get list of well populations
List<Integer> wellPopulations = Arrays.asList(concentrations);