Deactivate file I/O announcement for CLI
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import org.apache.commons.cli.*;
|
import org.apache.commons.cli.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -48,21 +49,15 @@ import java.util.stream.Stream;
|
|||||||
public class CommandLineInterface {
|
public class CommandLineInterface {
|
||||||
|
|
||||||
public static void startCLI(String[] args) {
|
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
|
//main options set - for the four different program modes
|
||||||
Options mainOptions = buildMainOptions();
|
Options mainOptions = buildMainOptions();
|
||||||
CommandLineParser parser = new DefaultParser();
|
CommandLineParser parser = new DefaultParser();
|
||||||
try{
|
try{
|
||||||
CommandLine line = parser.parse(mainOptions, args);
|
CommandLine line = parser.parse(mainOptions, Arrays.copyOfRange(args, 0, 1));
|
||||||
|
|
||||||
if (line.hasOption("cells")) {
|
if (line.hasOption("cells")) {
|
||||||
Options cellOptions = buildCellOptions();
|
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 number = Integer.valueOf(line.getOptionValue("n"));
|
||||||
Integer diversity = Integer.valueOf(line.getOptionValue("d"));
|
Integer diversity = Integer.valueOf(line.getOptionValue("d"));
|
||||||
String filename = line.getOptionValue("o");
|
String filename = line.getOptionValue("o");
|
||||||
@@ -71,7 +66,7 @@ public class CommandLineInterface {
|
|||||||
|
|
||||||
else if (line.hasOption("plate")) {
|
else if (line.hasOption("plate")) {
|
||||||
Options plateOptions = buildPlateOptions();
|
Options plateOptions = buildPlateOptions();
|
||||||
line = parser.parse(plateOptions, args);
|
line = parser.parse(plateOptions, Arrays.copyOfRange(args, 1, args.length));
|
||||||
//get the cells
|
//get the cells
|
||||||
String cellFilename = line.getOptionValue("c");
|
String cellFilename = line.getOptionValue("c");
|
||||||
CellSample cells = getCells(cellFilename);
|
CellSample cells = getCells(cellFilename);
|
||||||
@@ -122,7 +117,7 @@ public class CommandLineInterface {
|
|||||||
|
|
||||||
else if (line.hasOption("graph")) { //Making a graph
|
else if (line.hasOption("graph")) { //Making a graph
|
||||||
Options graphOptions = buildGraphOptions();
|
Options graphOptions = buildGraphOptions();
|
||||||
line = parser.parse(graphOptions, args);
|
line = parser.parse(graphOptions, Arrays.copyOfRange(args, 1, args.length));
|
||||||
String cellFilename = line.getOptionValue("c");
|
String cellFilename = line.getOptionValue("c");
|
||||||
String plateFilename = line.getOptionValue("p");
|
String plateFilename = line.getOptionValue("p");
|
||||||
String outputFilename = line.getOptionValue("o");
|
String outputFilename = line.getOptionValue("o");
|
||||||
@@ -132,7 +127,7 @@ public class CommandLineInterface {
|
|||||||
Plate plate = getPlate(plateFilename);
|
Plate plate = getPlate(plateFilename);
|
||||||
GraphWithMapData graph = Simulator.makeGraph(cells, plate, false);
|
GraphWithMapData graph = Simulator.makeGraph(cells, plate, 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);
|
GraphDataObjectWriter writer = new GraphDataObjectWriter(outputFilename, graph, false);
|
||||||
writer.writeDataToFile();
|
writer.writeDataToFile();
|
||||||
}
|
}
|
||||||
if (line.hasOption("graphml")) { //if told to, output graphml file
|
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
|
else if (line.hasOption("match")) { //can add a flag for which match type in future, spit this in two
|
||||||
Options matchOptions = buildMatchCDR3options();
|
Options matchOptions = buildMatchCDR3options();
|
||||||
line = parser.parse(matchOptions, args);
|
line = parser.parse(matchOptions, Arrays.copyOfRange(args, 1, args.length));
|
||||||
String graphFilename = line.getOptionValue("g");
|
String graphFilename = line.getOptionValue("g");
|
||||||
String outputFilename = line.getOptionValue("o");
|
String outputFilename = line.getOptionValue("o");
|
||||||
Integer minThreshold = Integer.parseInt(line.getOptionValue("min"));
|
Integer minThreshold = Integer.parseInt(line.getOptionValue("min"));
|
||||||
@@ -193,8 +188,8 @@ public class CommandLineInterface {
|
|||||||
.longOpt("make-cells")
|
.longOpt("make-cells")
|
||||||
.desc("Makes a cell sample file of distinct T cells")
|
.desc("Makes a cell sample file of distinct T cells")
|
||||||
.build();
|
.build();
|
||||||
Option makePlate = Option.builder("plates")
|
Option makePlate = Option.builder("plate")
|
||||||
.longOpt("make-plates")
|
.longOpt("make-plate")
|
||||||
.desc("Makes a sample plate file. Requires a cell sample file.")
|
.desc("Makes a sample plate file. Requires a cell sample file.")
|
||||||
.build();
|
.build();
|
||||||
Option makeGraph = Option.builder("graph")
|
Option makeGraph = Option.builder("graph")
|
||||||
@@ -324,12 +319,15 @@ public class CommandLineInterface {
|
|||||||
Option outputGraphML = Option.builder("graphml")
|
Option outputGraphML = Option.builder("graphml")
|
||||||
.desc("Output GraphML file")
|
.desc("Output GraphML file")
|
||||||
.build();
|
.build();
|
||||||
Option outputSerializedBinary = Option.builder("no-binary")
|
Option outputSerializedBinary = Option.builder("nb")
|
||||||
|
.longOpt("no-binary")
|
||||||
.desc("Don't output serialized binary file")
|
.desc("Don't output serialized binary file")
|
||||||
.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(outputSerializedBinary);
|
||||||
return graphOptions;
|
return graphOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,7 +387,7 @@ public class CommandLineInterface {
|
|||||||
private static GraphWithMapData getGraph(String graphFilename) {
|
private static GraphWithMapData getGraph(String graphFilename) {
|
||||||
assert graphFilename != null;
|
assert graphFilename != null;
|
||||||
try{
|
try{
|
||||||
GraphDataObjectReader reader = new GraphDataObjectReader(graphFilename);
|
GraphDataObjectReader reader = new GraphDataObjectReader(graphFilename, false);
|
||||||
return reader.getData();
|
return reader.getData();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ public class InteractiveInterface {
|
|||||||
data = BiGpairSEQ.getGraphInMemory();
|
data = BiGpairSEQ.getGraphInMemory();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GraphDataObjectReader dataReader = new GraphDataObjectReader(graphFilename);
|
GraphDataObjectReader dataReader = new GraphDataObjectReader(graphFilename, true);
|
||||||
data = dataReader.getData();
|
data = dataReader.getData();
|
||||||
if(BiGpairSEQ.cacheGraph()) {
|
if(BiGpairSEQ.cacheGraph()) {
|
||||||
BiGpairSEQ.setGraphInMemory(data, graphFilename);
|
BiGpairSEQ.setGraphInMemory(data, graphFilename);
|
||||||
|
|||||||
Reference in New Issue
Block a user