Add -help CLI option
This commit is contained in:
@@ -49,14 +49,30 @@ import java.util.stream.Stream;
|
||||
public class CommandLineInterface {
|
||||
|
||||
public static void startCLI(String[] args) {
|
||||
//main options set - for the four different program modes
|
||||
//Options sets for the different modes
|
||||
Options mainOptions = buildMainOptions();
|
||||
Options cellOptions = buildCellOptions();
|
||||
Options plateOptions = buildPlateOptions();
|
||||
Options graphOptions = buildGraphOptions();
|
||||
Options matchOptions = buildMatchCDR3options();
|
||||
|
||||
CommandLineParser parser = new DefaultParser();
|
||||
try{
|
||||
CommandLine line = parser.parse(mainOptions, Arrays.copyOfRange(args, 0, 1));
|
||||
|
||||
if (line.hasOption("cells")) {
|
||||
Options cellOptions = buildCellOptions();
|
||||
if (line.hasOption("help")) {
|
||||
HelpFormatter formatter = new HelpFormatter();
|
||||
formatter.printHelp("BiGpairSEQ_Sim", mainOptions);
|
||||
System.out.println();
|
||||
formatter.printHelp("BiGpairSEQ_SIM -cells", cellOptions);
|
||||
System.out.println();
|
||||
formatter.printHelp("BiGpairSEQ_Sim -plate", plateOptions);
|
||||
System.out.println();
|
||||
formatter.printHelp("BiGpairSEQ_Sim -graph", graphOptions);
|
||||
System.out.println();
|
||||
formatter.printHelp("BiGpairSEQ_Sim -match", matchOptions);
|
||||
}
|
||||
else if (line.hasOption("cells")) {
|
||||
line = parser.parse(cellOptions, Arrays.copyOfRange(args, 1, args.length));
|
||||
Integer number = Integer.valueOf(line.getOptionValue("n"));
|
||||
Integer diversity = Integer.valueOf(line.getOptionValue("d"));
|
||||
@@ -65,7 +81,6 @@ public class CommandLineInterface {
|
||||
}
|
||||
|
||||
else if (line.hasOption("plate")) {
|
||||
Options plateOptions = buildPlateOptions();
|
||||
line = parser.parse(plateOptions, Arrays.copyOfRange(args, 1, args.length));
|
||||
//get the cells
|
||||
String cellFilename = line.getOptionValue("c");
|
||||
@@ -116,7 +131,6 @@ public class CommandLineInterface {
|
||||
}
|
||||
|
||||
else if (line.hasOption("graph")) { //Making a graph
|
||||
Options graphOptions = buildGraphOptions();
|
||||
line = parser.parse(graphOptions, Arrays.copyOfRange(args, 1, args.length));
|
||||
String cellFilename = line.getOptionValue("c");
|
||||
String plateFilename = line.getOptionValue("p");
|
||||
@@ -137,7 +151,6 @@ public class CommandLineInterface {
|
||||
}
|
||||
|
||||
else if (line.hasOption("match")) { //can add a flag for which match type in future, spit this in two
|
||||
Options matchOptions = buildMatchCDR3options();
|
||||
line = parser.parse(matchOptions, Arrays.copyOfRange(args, 1, args.length));
|
||||
String graphFilename = line.getOptionValue("g");
|
||||
String outputFilename = line.getOptionValue("o");
|
||||
@@ -184,6 +197,7 @@ public class CommandLineInterface {
|
||||
|
||||
private static Options buildMainOptions() {
|
||||
Options mainOptions = new Options();
|
||||
Option help = Option.builder("help").build();
|
||||
Option makeCells = Option.builder("cells")
|
||||
.longOpt("make-cells")
|
||||
.desc("Makes a cell sample file of distinct T cells")
|
||||
@@ -201,6 +215,7 @@ public class CommandLineInterface {
|
||||
.desc("Matches CDR3s. Requires a graph/data file.")
|
||||
.build();
|
||||
OptionGroup mainGroup = new OptionGroup();
|
||||
mainGroup.addOption(help);
|
||||
mainGroup.addOption(makeCells);
|
||||
mainGroup.addOption(makePlate);
|
||||
mainGroup.addOption(makeGraph);
|
||||
@@ -236,11 +251,13 @@ public class CommandLineInterface {
|
||||
.longOpt("cell-file")
|
||||
.desc("The cell sample file to use")
|
||||
.hasArg()
|
||||
.argName("filename")
|
||||
.required().build();
|
||||
Option numWells = Option.builder("w")// add this to plate options
|
||||
.longOpt("wells")
|
||||
.desc("The number of wells on the sample plate")
|
||||
.hasArg()
|
||||
.argName("number")
|
||||
.required().build();
|
||||
//options group for choosing with distribution to use
|
||||
OptionGroup distributions = new OptionGroup();// add this to plate options
|
||||
@@ -260,12 +277,14 @@ public class CommandLineInterface {
|
||||
//options group for statistical distribution parameters
|
||||
OptionGroup statParams = new OptionGroup();// add this to plate options
|
||||
Option stdDev = Option.builder("stddev")
|
||||
.desc("Standard deviation for Gaussian distribution")
|
||||
.desc("If using -gaussian flag, standard deviation for distrbution")
|
||||
.hasArg()
|
||||
.argName("value")
|
||||
.build();
|
||||
Option lambda = Option.builder("lambda")
|
||||
.desc("Lambda value for exponential distribution")
|
||||
.desc("If using -exponential flag, lambda value for distribution")
|
||||
.hasArg()
|
||||
.argName("value")
|
||||
.build();
|
||||
statParams.addOption(stdDev);
|
||||
statParams.addOption(lambda);
|
||||
@@ -275,19 +294,20 @@ public class CommandLineInterface {
|
||||
Option randomWellPopulations = Option.builder("random")
|
||||
.desc("Randomize well populations on sample plate.")
|
||||
.hasArgs()
|
||||
.argName("MIN_POP MAX_POP")
|
||||
.numberOfArgs(2)
|
||||
.argName("max_pop min_pop")
|
||||
.build();
|
||||
Option specificWellPopulations = Option.builder("pop")
|
||||
.longOpt("populations")
|
||||
.desc("The well populations for each section of the sample plate")
|
||||
.desc("The well populations for each section of the sample plate. There will be as many sections as populations given.")
|
||||
.hasArgs()
|
||||
.argName("SECTION_1_POP [SECTION_2_POP] [SECTION_3_POP] ...")
|
||||
.argName("1st_pop [2nd_pop]...")
|
||||
.build();
|
||||
Option dropoutRate = Option.builder("err") //add this to plate options
|
||||
.longOpt("dropout-rate")
|
||||
.hasArg()
|
||||
.desc("The sequence dropout rate due to amplification error")
|
||||
.argName("DROPOUT_RATE (value between 0.0 and 1.0)")
|
||||
.argName("rate")
|
||||
.required()
|
||||
.build();
|
||||
wellPopOptions.addOption(randomWellPopulations);
|
||||
@@ -308,13 +328,13 @@ public class CommandLineInterface {
|
||||
.longOpt("cell-file")
|
||||
.desc("Cell sample file to use for checking accuracy")
|
||||
.hasArg()
|
||||
.argName("CELL_FILENAME")
|
||||
.argName("filename")
|
||||
.required().build();
|
||||
Option plateFilename = Option.builder("p")
|
||||
.longOpt("plate-filename")
|
||||
.desc("Sample plate file (made from given cell sample file) to construct graph from")
|
||||
.hasArg()
|
||||
.argName("PLATE_FILENAME")
|
||||
.argName("filename")
|
||||
.required().build();
|
||||
Option outputGraphML = Option.builder("graphml")
|
||||
.desc("Output GraphML file")
|
||||
@@ -337,29 +357,31 @@ public class CommandLineInterface {
|
||||
.longOpt("graph-file")
|
||||
.desc("Graph/data file to use")
|
||||
.hasArg()
|
||||
.argName("GRAPH/DATA_FILENAME")
|
||||
.argName("filename")
|
||||
.required().build();
|
||||
Option minOccupancyOverlap = Option.builder("min")
|
||||
.longOpt("min-overlap-size")
|
||||
.desc("The minimum number of shared wells to attempt to match a sequence pair")
|
||||
.hasArg()
|
||||
.argName("MIN_OVERLAP")
|
||||
.argName("minimum")
|
||||
.required().build();
|
||||
Option maxOccupancyOverlap = Option.builder("max")
|
||||
.longOpt("max_overlap_size")
|
||||
.desc("The maximum number of shared wells to attempt to match a sequence pair")
|
||||
.hasArg()
|
||||
.argName("MAX_OVERLAP")
|
||||
.argName("maximum")
|
||||
.required().build();
|
||||
Option minOverlapPercent = Option.builder("minpct")
|
||||
.longOpt("min-overlap-percent")
|
||||
.desc("The minimum percentage of a sequence's total occupancy shared by another sequence to attempt matching")
|
||||
.desc("(Optional) The minimum percentage of a sequence's total occupancy shared by another sequence to attempt matching. (0 - 100) ")
|
||||
.hasArg()
|
||||
.argName("minimum")
|
||||
.build();
|
||||
Option maxOccupancyDifference = Option.builder("maxdiff")
|
||||
.longOpt("max-occupancy-difference")
|
||||
.desc("The maximum difference in total occupancy between two sequences to attempt matching")
|
||||
.desc("(Optional) The maximum difference in total occupancy between two sequences to attempt matching.")
|
||||
.hasArg()
|
||||
.argName("maximum")
|
||||
.build();
|
||||
matchCDR3options.addOption(graphFilename);
|
||||
matchCDR3options.addOption(minOccupancyOverlap);
|
||||
@@ -367,6 +389,9 @@ public class CommandLineInterface {
|
||||
matchCDR3options.addOption(minOverlapPercent);
|
||||
matchCDR3options.addOption(maxOccupancyDifference);
|
||||
matchCDR3options.addOption(outputFileOption());
|
||||
//options for output to System.out
|
||||
//Option printPairingErrorRate = Option.builder()
|
||||
|
||||
return matchCDR3options;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user