use of org.dishevelled.commandline.CommandLineParseException in project ImmunogeneticDataTools by nmdp-bioinformatics.
the class ExtractMugs 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 Hmlfile = new FileArgument("i", "hml-file", "hml file file, default stdin; at least one of expected or observed file must be provided", false);
FileArgument outputFile = new FileArgument("o", "output-file", "output file, default stdout", false);
StringArgument sample = new StringArgument("s", "sample-id", "sample ID", false);
ArgumentList arguments = new ArgumentList(about, help, Hmlfile, outputFile, sample);
CommandLine commandLine = new CommandLine(args);
ExtractMugs validateLdHml = 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);
}
// todo: allow for configuration of glclient
validateLdHml = new ExtractMugs(Hmlfile.getValue(), outputFile.getValue(), sample.getValue(), LocalGlClient.create());
} catch (CommandLineParseException e) {
if (about.wasFound()) {
About.about(System.out);
System.exit(0);
}
if (help.wasFound()) {
Usage.usage(USAGE, null, commandLine, arguments, System.out);
System.exit(0);
}
Usage.usage(USAGE, e, commandLine, arguments, System.err);
System.exit(-1);
}
try {
System.exit(validateLdHml.call());
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
use of org.dishevelled.commandline.CommandLineParseException in project ImmunogeneticDataTools by nmdp-bioinformatics.
the class ValidateLdGlstrings 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 inputHmlFile = new FileArgument("i", "input-file", "input file, default stdin", false);
FileArgument outputFile = new FileArgument("o", "output-file", "output allele assignment file, default stdout", false);
ArgumentList arguments = new ArgumentList(about, help, inputHmlFile, outputFile);
CommandLine commandLine = new CommandLine(args);
ValidateLdGlstrings validateLdGlstrings = 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);
}
validateLdGlstrings = new ValidateLdGlstrings(inputHmlFile.getValue(), outputFile.getValue());
} catch (CommandLineParseException | IllegalArgumentException e) {
Usage.usage(USAGE, e, commandLine, arguments, System.err);
System.exit(-1);
}
try {
System.exit(validateLdGlstrings.call());
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
use of org.dishevelled.commandline.CommandLineParseException in project ImmunogeneticDataTools by nmdp-bioinformatics.
the class NormalizeFrequencyFile 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);
StringArgument frequencies = new StringArgument("f", "frequencies", "frequencies (acb, cb, drb1_dqb1, drb_dqb, five_loc, six_loc, single), default five_loc", false);
FileArgument outputFile = new FileArgument("o", "output-file", "output allele assignment file, default stdout", false);
ArgumentList arguments = new ArgumentList(about, help, inputFile, frequencies, outputFile);
CommandLine commandLine = new CommandLine(args);
NormalizeFrequencyFile normalizeFrequencyFile = 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);
}
normalizeFrequencyFile = new NormalizeFrequencyFile(inputFile.getValue(), frequencies.getValue(), outputFile.getValue());
} catch (CommandLineParseException | IllegalArgumentException e) {
Usage.usage(USAGE, e, commandLine, arguments, System.err);
System.exit(-1);
}
try {
System.exit(normalizeFrequencyFile.call());
} catch (Exception e) {
e.printStackTrace();
System.exit(1);
}
}
use of org.dishevelled.commandline.CommandLineParseException 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);
}
}
Aggregations