Add read depth simulation options to CLI

This commit is contained in:
eugenefischer
2022-09-27 14:35:55 -05:00
parent 7c3c95ab4b
commit 423c9d5c93

View File

@@ -146,7 +146,17 @@ public class CommandLineInterface {
CellSample cells = getCells(cellFilename);
//get plate
Plate plate = getPlate(plateFilename);
GraphWithMapData graph = Simulator.makeGraph(cells, plate, 1, 0.0, 0.0, false);
GraphWithMapData graph;
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]);
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();
@@ -388,11 +398,18 @@ public class CommandLineInterface {
.longOpt("no-binary")
.desc("(Optional) Don't output serialized binary file")
.build();
Option simulateReadDepth = 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)
.build();
graphOptions.addOption(cellFilename);
graphOptions.addOption(plateFilename);
graphOptions.addOption(outputFileOption());
graphOptions.addOption(outputGraphML);
graphOptions.addOption(outputSerializedBinary);
graphOptions.addOption(simulateReadDepth);
return graphOptions;
}