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 //get plate
Plate plate = getPlate(plateFilename); Plate plate = getPlate(plateFilename);
GraphWithMapData graph; GraphWithMapData graph;
if(line.hasOption("rd")){ Integer readDepth = 1;
String[] readDepthArgs = line.getOptionValues("rd"); Double readErrorRate = 0.0;
Integer readDepth = Integer.parseInt(readDepthArgs[0]); Double errorCollisionRate = 0.0;
Double readErrorRate = Double.parseDouble(readDepthArgs[1]); if (line.hasOption("rd")) {
Double errorCollisionRate = Double.parseDouble(readDepthArgs[2]); readDepth = Integer.parseInt(line.getOptionValue("rd"));
graph = Simulator.makeGraph(cells, plate, readDepth, readErrorRate, errorCollisionRate, false);
} }
else{ if (line.hasOption("err")) {
graph = Simulator.makeGraph(cells, plate, 1, 0.0, 0.0, false); 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);
if (!line.hasOption("no-binary")) { //output binary file unless told not to if (!line.hasOption("no-binary")) { //output binary file unless told not to
GraphDataObjectWriter writer = new GraphDataObjectWriter(outputFilename, graph, false); GraphDataObjectWriter writer = new GraphDataObjectWriter(outputFilename, graph, false);
writer.writeDataToFile(); writer.writeDataToFile();
@@ -398,18 +401,32 @@ public class CommandLineInterface {
.longOpt("no-binary") .longOpt("no-binary")
.desc("(Optional) Don't output serialized binary file") .desc("(Optional) Don't output serialized binary file")
.build(); .build();
Option simulateReadDepth = Option.builder("rd") Option readDepth = Option.builder("rd")
.longOpt("read-depth") .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)") .desc("(Optional) The number of times to read each sequence.")
.hasArgs() .hasArg()
.numberOfArgs(3) .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(); .build();
graphOptions.addOption(cellFilename); graphOptions.addOption(cellFilename);
graphOptions.addOption(plateFilename); graphOptions.addOption(plateFilename);
graphOptions.addOption(outputFileOption()); graphOptions.addOption(outputFileOption());
graphOptions.addOption(outputGraphML); graphOptions.addOption(outputGraphML);
graphOptions.addOption(outputSerializedBinary); graphOptions.addOption(outputSerializedBinary);
graphOptions.addOption(simulateReadDepth); graphOptions.addOption(readDepth);
graphOptions.addOption(readErrorProb);
graphOptions.addOption(errorCollisionProb);
return graphOptions; return graphOptions;
} }