private static TagsByTaxa newTBT(String filename, String[] taxonNames, TagCountMutable tcm) { if (TagsByTaxaUtils.format(filename).equals(TagsByTaxa.FilePacking.Byte)) { return new TagsByTaxaByteFileMap(filename, taxonNames, tcm); } else { return null; } }
private static TagsByTaxa newTBT(String filename) { if (TagsByTaxaUtils.format(filename).equals(TagsByTaxa.FilePacking.Byte)) { return new TagsByTaxaByteFileMap(filename); } else { return null; } }
public void setParameters(String[] args) { myLogger.addAppender(new ConsoleAppender(new SimpleLayout())); if (args.length == 0) { printUsage(); throw new IllegalArgumentException("\n\nPlease use the above arguments/options.\n\n"); } if (myArgsEngine == null) { myArgsEngine = new ArgsEngine(); myArgsEngine.add("-i", "--input-directory", true); myArgsEngine.add("-o", "--output_file", true); myArgsEngine.add("-s", "--max_tags", true); myArgsEngine.add("-x", "--combine-synonymous-taxa"); myArgsEngine.add("-h", "--write-hapmap", true); } myArgsEngine.parse(args); if (myArgsEngine.getBoolean("-x")) { combineSynonymousTaxa = true; } if (myArgsEngine.getBoolean("-h")) { hapmapFile = new File(myArgsEngine.getString("-h")); } if (myArgsEngine.getBoolean("-s")) { maxTags = Integer.parseInt(myArgsEngine.getString("-s")); } if (myArgsEngine.getBoolean("-o")) { outfilename = myArgsEngine.getString("-o"); File outfile = new File(outfilename); if (outfile.isDirectory()) { printUsage(); throw new IllegalArgumentException( "The output filename you provided is a directory, not a file."); } } else { printUsage(); throw new IllegalArgumentException("Please specify an output file."); } if (myArgsEngine.getBoolean("-i")) { inputDirectory = new File(myArgsEngine.getString("-i")); if (!inputDirectory.isDirectory()) { printUsage(); throw new IllegalArgumentException("The input name you supplied is not a directory."); } else { infiles = DirectoryCrawler.listFileNames( ".*\\.tbt\\.bin|.*\\.tbt\\.byte", inputDirectory.getAbsolutePath()); myLogger.info("Merging the following .tbt.bin or .tbt.byte files..."); for (String filename : infiles) { if (!TagsByTaxaUtils.format(filename).equals(TagsByTaxaUtils.format(outfilename))) { myLogger.warn("Input file extension does not match output file extension."); } myLogger.info(filename); } myLogger.info("...to \"" + outfilename + "\"."); } } else { printUsage(); throw new IllegalArgumentException("You forgot to provide an input directory name."); } }