Add read depth simulation options to CLI

This commit is contained in:
eugenefischer
2022-09-27 15:05:50 -05:00
parent 423c9d5c93
commit 4ad1979c18

View File

@@ -147,16 +147,19 @@ public class CommandLineInterface {
//get plate
Plate plate = getPlate(plateFilename);
GraphWithMapData graph;
Integer readDepth = 1;
Double readErrorRate = 0.0;
Double errorCollisionRate = 0.0;
if (line.hasOption("rd")) {
String[] readDepthArgs = line.getOptionValues("rd");
Integer readDepth = Integer.parseInt(readDepthArgs[0]);
Double readErrorRate = Double.parseDouble(readDepthArgs[1]);
Double errorCollisionRate = Double.parseDouble(readDepthArgs[2]);
readDepth = Integer.parseInt(line.getOptionValue("rd"));
}
if (line.hasOption("err")) {
readErrorRate = Double.parseDouble(line.getOptionValue("err"));
}
if (line.hasOption("coll")) {
errorCollisionRate = Double.parseDouble(line.getOptionValue("coll"));
}
graph = Simulator.makeGraph(cells, plate, readDepth, readErrorRate, errorCollisionRate, false);
}
else{
graph = Simulator.makeGraph(cells, plate, 1, 0.0, 0.0, false);
}
if (!line.hasOption("no-binary")) { //output binary file unless told not to
GraphDataObjectWriter writer = new GraphDataObjectWriter(outputFilename, graph, false);
writer.writeDataToFile();
@@ -398,18 +401,32 @@ public class CommandLineInterface {
.longOpt("no-binary")
.desc("(Optional) Don't output serialized binary file")
.build();
Option simulateReadDepth = Option.builder("rd")
Option readDepth = Option.builder("rd")
.longOpt("read-depth")
.desc("(Optional) Simulate read depth and read errors. Has three arguments: the read depth (integer >= 1), the read error probability (0.0 - 1.0), and the error collision probability (0.0 - 1.0)")
.hasArgs()
.numberOfArgs(3)
.desc("(Optional) The number of times to read each sequence.")
.hasArg()
.argName("depth")
.build();
Option readErrorProb = Option.builder("err")
.longOpt("read-error-prob")
.desc("(Optional) The probability that a sequence will be misread. (0.0 - 1.0)")
.hasArg()
.argName("prob")
.build();
Option errorCollisionProb = Option.builder("coll")
.longOpt("error-collision-prob")
.desc("(Optional) The probability that two misreads will produce the same spurious sequence. (0.0 - 1.0)")
.hasArg()
.argName("prob")
.build();
graphOptions.addOption(cellFilename);
graphOptions.addOption(plateFilename);
graphOptions.addOption(outputFileOption());
graphOptions.addOption(outputGraphML);
graphOptions.addOption(outputSerializedBinary);
graphOptions.addOption(simulateReadDepth);
graphOptions.addOption(readDepth);
graphOptions.addOption(readErrorProb);
graphOptions.addOption(errorCollisionProb);
return graphOptions;
}