Deactivate file I/O announcement for CLI

This commit is contained in:
2022-02-27 16:16:24 -06:00
parent 2485ac4cf6
commit 32c5bcaaff
2 changed files with 15 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
import org.apache.commons.cli.*;
import java.io.IOException;
import java.util.Arrays;
import java.util.stream.Stream;
/*
@@ -48,21 +49,15 @@ import java.util.stream.Stream;
public class CommandLineInterface {
public static void startCLI(String[] args) {
//These command line options are a big mess
//Really, I don't think command line tools are expected to work in this many different modes
//making cells, making plates, and matching are the sort of thing that UNIX philosophy would say
//should be three separate programs.
//There might be a way to do it with option parameters?
//main options set - for the four different program modes
Options mainOptions = buildMainOptions();
CommandLineParser parser = new DefaultParser();
try{
CommandLine line = parser.parse(mainOptions, args);
CommandLine line = parser.parse(mainOptions, Arrays.copyOfRange(args, 0, 1));
if (line.hasOption("cells")) {
Options cellOptions = buildCellOptions();
line = parser.parse(cellOptions, args);
line = parser.parse(cellOptions, Arrays.copyOfRange(args, 1, args.length));
Integer number = Integer.valueOf(line.getOptionValue("n"));
Integer diversity = Integer.valueOf(line.getOptionValue("d"));
String filename = line.getOptionValue("o");
@@ -71,7 +66,7 @@ public class CommandLineInterface {
else if (line.hasOption("plate")) {
Options plateOptions = buildPlateOptions();
line = parser.parse(plateOptions, args);
line = parser.parse(plateOptions, Arrays.copyOfRange(args, 1, args.length));
//get the cells
String cellFilename = line.getOptionValue("c");
CellSample cells = getCells(cellFilename);
@@ -122,7 +117,7 @@ public class CommandLineInterface {
else if (line.hasOption("graph")) { //Making a graph
Options graphOptions = buildGraphOptions();
line = parser.parse(graphOptions, args);
line = parser.parse(graphOptions, Arrays.copyOfRange(args, 1, args.length));
String cellFilename = line.getOptionValue("c");
String plateFilename = line.getOptionValue("p");
String outputFilename = line.getOptionValue("o");
@@ -132,7 +127,7 @@ public class CommandLineInterface {
Plate plate = getPlate(plateFilename);
GraphWithMapData graph = Simulator.makeGraph(cells, plate, false);
if (!line.hasOption("no-binary")) { //output binary file unless told not to
GraphDataObjectWriter writer = new GraphDataObjectWriter(outputFilename, graph);
GraphDataObjectWriter writer = new GraphDataObjectWriter(outputFilename, graph, false);
writer.writeDataToFile();
}
if (line.hasOption("graphml")) { //if told to, output graphml file
@@ -143,7 +138,7 @@ 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, args);
line = parser.parse(matchOptions, Arrays.copyOfRange(args, 1, args.length));
String graphFilename = line.getOptionValue("g");
String outputFilename = line.getOptionValue("o");
Integer minThreshold = Integer.parseInt(line.getOptionValue("min"));
@@ -193,8 +188,8 @@ public class CommandLineInterface {
.longOpt("make-cells")
.desc("Makes a cell sample file of distinct T cells")
.build();
Option makePlate = Option.builder("plates")
.longOpt("make-plates")
Option makePlate = Option.builder("plate")
.longOpt("make-plate")
.desc("Makes a sample plate file. Requires a cell sample file.")
.build();
Option makeGraph = Option.builder("graph")
@@ -324,12 +319,15 @@ public class CommandLineInterface {
Option outputGraphML = Option.builder("graphml")
.desc("Output GraphML file")
.build();
Option outputSerializedBinary = Option.builder("no-binary")
Option outputSerializedBinary = Option.builder("nb")
.longOpt("no-binary")
.desc("Don't output serialized binary file")
.build();
graphOptions.addOption(cellFilename);
graphOptions.addOption(plateFilename);
graphOptions.addOption(outputFileOption());
graphOptions.addOption(outputGraphML);
graphOptions.addOption(outputSerializedBinary);
return graphOptions;
}
@@ -389,7 +387,7 @@ public class CommandLineInterface {
private static GraphWithMapData getGraph(String graphFilename) {
assert graphFilename != null;
try{
GraphDataObjectReader reader = new GraphDataObjectReader(graphFilename);
GraphDataObjectReader reader = new GraphDataObjectReader(graphFilename, false);
return reader.getData();
}

View File

@@ -375,7 +375,7 @@ public class InteractiveInterface {
data = BiGpairSEQ.getGraphInMemory();
}
else {
GraphDataObjectReader dataReader = new GraphDataObjectReader(graphFilename);
GraphDataObjectReader dataReader = new GraphDataObjectReader(graphFilename, true);
data = dataReader.getData();
if(BiGpairSEQ.cacheGraph()) {
BiGpairSEQ.setGraphInMemory(data, graphFilename);