reimplement CLI (in progress)
This commit is contained in:
@@ -1,6 +1,45 @@
|
|||||||
import org.apache.commons.cli.*;
|
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 class CommandLineInterface {
|
||||||
|
|
||||||
public static void startCLI(String[] args) {
|
public static void startCLI(String[] args) {
|
||||||
@@ -20,7 +59,7 @@ public class CommandLineInterface {
|
|||||||
.longOpt("make-plates")
|
.longOpt("make-plates")
|
||||||
.desc("Makes a sample plate file")
|
.desc("Makes a sample plate file")
|
||||||
.build();
|
.build();
|
||||||
Option makeGraph = Option.builder("graoh")
|
Option makeGraph = Option.builder("graph")
|
||||||
.longOpt("make-graph")
|
.longOpt("make-graph")
|
||||||
.desc("Makes a graph and data file")
|
.desc("Makes a graph and data file")
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ public class InteractiveInterface {
|
|||||||
try {
|
try {
|
||||||
input = sc.nextInt();
|
input = sc.nextInt();
|
||||||
switch (input) {
|
switch (input) {
|
||||||
case 1 -> makeCellsInteractive();
|
case 1 -> makeCells();
|
||||||
case 2 -> makePlateInteractive();
|
case 2 -> makePlate();
|
||||||
case 3 -> makeCDR3GraphInteractive();
|
case 3 -> makeCDR3Graph();
|
||||||
case 4 -> matchCDR3sInteractive();
|
case 4 -> matchCDR3s();
|
||||||
//case 6 -> matchCellsCDR1();
|
//case 6 -> matchCellsCDR1();
|
||||||
case 9 -> acknowledge();
|
case 9 -> acknowledge();
|
||||||
case 0 -> quit = true;
|
case 0 -> quit = true;
|
||||||
@@ -48,7 +48,7 @@ public class InteractiveInterface {
|
|||||||
sc.close();
|
sc.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void makeCellsInteractive() {
|
private static void makeCells() {
|
||||||
String filename = null;
|
String filename = null;
|
||||||
Integer numCells = 0;
|
Integer numCells = 0;
|
||||||
Integer cdr1Freq = 1;
|
Integer cdr1Freq = 1;
|
||||||
@@ -79,7 +79,7 @@ public class InteractiveInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Output a CSV of sample plate
|
//Output a CSV of sample plate
|
||||||
private static void makePlateInteractive() {
|
private static void makePlate() {
|
||||||
String cellFile = null;
|
String cellFile = null;
|
||||||
String filename = null;
|
String filename = null;
|
||||||
Double stdDev = 0.0;
|
Double stdDev = 0.0;
|
||||||
@@ -192,7 +192,7 @@ public class InteractiveInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Output serialized binary of GraphAndMapData object
|
//Output serialized binary of GraphAndMapData object
|
||||||
private static void makeCDR3GraphInteractive() {
|
private static void makeCDR3Graph() {
|
||||||
String filename = null;
|
String filename = null;
|
||||||
String cellFile = null;
|
String cellFile = null;
|
||||||
String plateFile = null;
|
String plateFile = null;
|
||||||
@@ -241,7 +241,7 @@ public class InteractiveInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Simulate matching and output CSV file of results
|
//Simulate matching and output CSV file of results
|
||||||
private static void matchCDR3sInteractive() throws IOException {
|
private static void matchCDR3s() throws IOException {
|
||||||
String filename = null;
|
String filename = null;
|
||||||
String dataFilename = null;
|
String dataFilename = null;
|
||||||
Integer lowThreshold = 0;
|
Integer lowThreshold = 0;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ public class PlateFileWriter {
|
|||||||
private Double error;
|
private Double error;
|
||||||
private String filename;
|
private String filename;
|
||||||
private String sourceFileName;
|
private String sourceFileName;
|
||||||
private String[] headers;
|
|
||||||
private Integer[] concentrations;
|
private Integer[] concentrations;
|
||||||
private boolean isExponential = false;
|
private boolean isExponential = false;
|
||||||
|
|
||||||
@@ -58,20 +57,21 @@ public class PlateFileWriter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//this took forever and I don't use it
|
// //this took forever and I don't use it
|
||||||
List<List<String>> rows = new ArrayList<>();
|
// //if I wanted to use it, I'd replace printer.printRecords(wellsAsStrings) with printer.printRecords(rows)
|
||||||
List<String> tmp = new ArrayList<>();
|
// List<List<String>> rows = new ArrayList<>();
|
||||||
for(int i = 0; i < wellsAsStrings.size(); i++){//List<Integer[]> w: wells){
|
// List<String> tmp = new ArrayList<>();
|
||||||
tmp.add("well " + (i+1));
|
// 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++){
|
// rows.add(tmp);
|
||||||
tmp = new ArrayList<>();
|
// for(int row = 0; row < maxLength; row++){
|
||||||
for(List<String> c: wellsAsStrings){
|
// tmp = new ArrayList<>();
|
||||||
tmp.add(c.get(row));
|
// for(List<String> c: wellsAsStrings){
|
||||||
}
|
// tmp.add(c.get(row));
|
||||||
rows.add(tmp);
|
// }
|
||||||
}
|
// rows.add(tmp);
|
||||||
|
// }
|
||||||
|
|
||||||
//get list of well populations
|
//get list of well populations
|
||||||
List<Integer> wellPopulations = Arrays.asList(concentrations);
|
List<Integer> wellPopulations = Arrays.asList(concentrations);
|
||||||
|
|||||||
Reference in New Issue
Block a user