コード例 #1
0
ファイル: Evaluate.java プロジェクト: GeorgeVacek/PairHMM
  public static void main(final String[] argv) throws IOException {

    Set<String> args = new HashSet<String>(Arrays.asList(argv));
    if (args.size() < 1) {
      throw new RuntimeException(
          "\r\nYou must specify a file name for input.\n"
              + "filename \n ----------------------------\n"
              + "Run with -d or --debug for debug output");
    } else {
      final Evaluate evaluate = new Evaluate(args);
      final List<String> testFiles = new LinkedList<String>();

      final boolean noCaching = args.contains("--nocache");

      for (String arg : args) {
        if (!arg.startsWith("-")) {
          logger.info("Adding test dataset: " + arg);
          testFiles.add(arg);
        }
      }

      for (final String testSet : testFiles) {
        logger.info("Using " + testSet + " tests");
        evaluate.initializeHMMs(args);
        final Iterator<PairHMM> pairHMMIterator = evaluate.pairHMM.iterator();
        while (pairHMMIterator.hasNext()) {
          final PairHMM hmm = pairHMMIterator.next();
          final String hmmName = hmm.getClass().getSimpleName();
          final String[] testSplit = testSet.split("/"); // get rid of the file path (if any)
          final String testName =
              testSplit[testSplit.length - 1].split("\\.")[0]; // get rid of the file extension
          logger.info("Running " + hmmName);
          evaluate.runTests(hmm, createIteratorFor(testSet), hmmName, testName, noCaching);
          pairHMMIterator.remove();
        }
        logger.info("Finished all HMMs for " + testSet + " tests");
      }
    }
  }