@Override public final void set(E value) { checkNotNull(value); checkArgument(options.contains(value), "Value [%s] not permitted", value); super.set(value); }
/* main method */ public DefaultParam importCommandLine() { /* Assigning Parameter ID to an ascending number */ putParameterID(); /* Assigning parameter descriptions to each parameter ID */ addParameterInfo(); /* need a Object parser of PosixParser class for the function parse of CommandLine class */ PosixParser parser = new PosixParser(); /* print out help information */ HelpParam help = new HelpParam(parameter, parameterMap); /* check each parameter for assignment */ try { long input_limit = -1; int threads = Runtime.getRuntime().availableProcessors(); /* Set Object cl of CommandLine class for Parameter storage */ CommandLine cl = parser.parse(parameter, arguments, true); if (cl.hasOption(HELP)) { help.printStatisticerHelp(); System.exit(0); } if (cl.hasOption(HELP2)) { help.printStatisticerHelp(); System.exit(0); } if (cl.hasOption(VERSION)) { System.exit(0); } /* Checking all parameters */ String value; if ((value = cl.getOptionValue(PARTITIONS)) != null) { param.partitions = Integer.decode(value); } if ((value = cl.getOptionValue(COLUMN)) != null) { param.columns = value; param.columnStart = Integer.decode(value.split("-")[0]); param.columnEnd = Integer.decode(value.split("-")[1]); } else { param.columnStart = Integer.decode(param.columns.split("-")[0]); param.columnEnd = Integer.decode(param.columns.split("-")[1]); } if (cl.hasOption(CACHE)) { param.cache = true; } if ((value = cl.getOptionValue(INPUT_VCF)) != null) { param.inputFqPath = value; } else if ((value = cl.getOptionValue(INPUT_TAB)) != null) { param.inputFqPath = value; } else { help.printStatisticerHelp(); System.exit(0); // throw new IOException("Input file not specified.\nUse -help for list of // options"); } /* not applicable for HDFS and S3 */ /* using TextFileBufferInput for such purpose */ // File inputFastq = new File(param.inputFqPath).getAbsoluteFile(); // if (!inputFastq.exists()){ // err.println("Input query file not found."); // return; // i } if ((value = cl.getOptionValue(OUTPUT_LINE)) != null) { param.outputPath = value; } else { help.printStatisticerHelp(); info.readMessage("Output file not set with -outfile options"); info.screenDump(); System.exit(0); } File outfile = new File(param.outputPath).getAbsoluteFile(); if (outfile.exists()) { info.readParagraphedMessages( "Output file : \n\t" + param.outputPath + "\nalready exists, will be overwrite."); info.screenDump(); Runtime.getRuntime().exec("rm -rf " + param.outputPath); } } catch (IOException e) { // Don`t catch this, NaNaNaNa, U can`t touch this. info.readMessage("Parameter settings incorrect."); info.screenDump(); e.printStackTrace(); System.exit(0); } catch (RuntimeException e) { info.readMessage("Parameter settings incorrect."); info.screenDump(); e.printStackTrace(); System.exit(0); } catch (ParseException e) { info.readMessage("Parameter settings incorrect."); info.screenDump(); e.printStackTrace(); System.exit(0); } return param; }