Search in sources :

Example 1 with BooleanArgument

use of org.dishevelled.commandline.argument.BooleanArgument in project ImmunogeneticDataTools by nmdp-bioinformatics.

the class AnalyzeGLStrings method main.

/**
 * Main.
 *
 * @param args command line args
 */
public static void main(final String[] args) {
    Switch about = new Switch("a", "about", "display about message");
    Switch help = new Switch("h", "help", "display help message");
    FileArgument inputFile = new FileArgument("i", "input-file", "input file, default stdin", false);
    FileArgument outputFile = new FileArgument("o", "output-location", "specify an output file or an existing directory, default stdout", false);
    StringArgument hladb = new StringArgument("v", "hladb-version", "HLA DB version (e.g. 3.19.0), default latest", false);
    StringArgument freq = new StringArgument("f", "frequencies", "Frequency Set (e.g. nmdp, nmdp-2007, wiki), default nmdp-2007", false);
    BooleanArgument warnings = new BooleanArgument("w", "warnings-only", "Only log warnings, default all GL String output", false);
    FileSetArgument frequencyFiles = new FileSetArgument("q", "frequency-file(s)", "frequency input files (comma separated), default nmdp-2007 five locus", false);
    FileArgument allelesFile = new FileArgument("l", "allele-file", "alleles known to have frequencies, default none", false);
    ArgumentList arguments = new ArgumentList(about, help, inputFile, outputFile, hladb, freq, warnings, frequencyFiles, allelesFile);
    CommandLine commandLine = new CommandLine(args);
    AnalyzeGLStrings analyzeGLStrings = null;
    try {
        CommandLineParser.parse(commandLine, arguments);
        if (about.wasFound()) {
            About.about(System.out);
            System.exit(0);
        }
        if (help.wasFound()) {
            Usage.usage(USAGE, null, commandLine, arguments, System.out);
            System.exit(0);
        }
        analyzeGLStrings = new AnalyzeGLStrings(inputFile.getValue(), outputFile.getValue(), hladb.getValue(), freq.getValue(), warnings.getValue(), frequencyFiles.getValue(), allelesFile.getValue());
    } catch (CommandLineParseException | IllegalArgumentException e) {
        Usage.usage(USAGE, e, commandLine, arguments, System.err);
        System.exit(-1);
    }
    try {
        System.exit(analyzeGLStrings.call());
    } catch (Exception e) {
        e.printStackTrace();
        System.exit(1);
    }
}
Also used : CommandLine(org.dishevelled.commandline.CommandLine) Switch(org.dishevelled.commandline.Switch) CommandLineParseException(org.dishevelled.commandline.CommandLineParseException) BooleanArgument(org.dishevelled.commandline.argument.BooleanArgument) FileArgument(org.dishevelled.commandline.argument.FileArgument) FileSetArgument(org.dishevelled.commandline.argument.FileSetArgument) ArgumentList(org.dishevelled.commandline.ArgumentList) IOException(java.io.IOException) CommandLineParseException(org.dishevelled.commandline.CommandLineParseException) StringArgument(org.dishevelled.commandline.argument.StringArgument)

Aggregations

IOException (java.io.IOException)1 ArgumentList (org.dishevelled.commandline.ArgumentList)1 CommandLine (org.dishevelled.commandline.CommandLine)1 CommandLineParseException (org.dishevelled.commandline.CommandLineParseException)1 Switch (org.dishevelled.commandline.Switch)1 BooleanArgument (org.dishevelled.commandline.argument.BooleanArgument)1 FileArgument (org.dishevelled.commandline.argument.FileArgument)1 FileSetArgument (org.dishevelled.commandline.argument.FileSetArgument)1 StringArgument (org.dishevelled.commandline.argument.StringArgument)1