Esempio n. 1
0
  /**
   * this is the function that the inheriting class can expect to have called when the command line
   * system has initialized.
   *
   * @return the return code to exit the program with
   */
  protected int execute() throws Exception {
    engine.setParser(parser);
    argumentSources.add(this);

    Walker<?, ?> walker = engine.getWalkerByName(getAnalysisName());

    try {
      // Make sure a valid GATK user key is present, if required.
      authorizeGATKRun();

      engine.setArguments(getArgumentCollection());

      // File lists can require a bit of additional expansion.  Set these explicitly by the engine.
      engine.setSAMFileIDs(
          ListFileUtils.unpackBAMFileList(getArgumentCollection().samFiles, parser));

      engine.setWalker(walker);
      walker.setToolkit(engine);

      Collection<ReadFilter> filters = engine.createFilters();
      engine.setFilters(filters);

      // load the arguments into the walker / filters.
      // TODO: The fact that this extra load call exists here when all the parsing happens at the
      // engine
      // TODO: level indicates that we're doing something wrong.  Turn this around so that the GATK
      // can drive
      // TODO: argument processing.
      loadArgumentsIntoObject(walker);
      argumentSources.add(walker);

      Collection<RMDTriplet> rodBindings =
          ListFileUtils.unpackRODBindings(parser.getRodBindings(), parser);
      engine.setReferenceMetaDataFiles(rodBindings);

      for (ReadFilter filter : filters) {
        loadArgumentsIntoObject(filter);
        argumentSources.add(filter);
      }

      engine.execute();
      generateGATKRunReport(walker);
    } catch (Exception e) {
      generateGATKRunReport(walker, e);
      throw e;
    }

    // always return 0
    return 0;
  }
Esempio n. 2
0
  /**
   * GATK provides the walker as an argument source.
   *
   * @return List of walkers to load dynamically.
   */
  @Override
  protected Class[] getArgumentSources() {
    // No walker info?  No plugins.
    if (getAnalysisName() == null) return new Class[] {};

    Collection<Class> argumentSources = new ArrayList<Class>();

    Walker walker = engine.getWalkerByName(getAnalysisName());
    engine.setArguments(getArgumentCollection());
    engine.setWalker(walker);
    walker.setToolkit(engine);
    argumentSources.add(walker.getClass());

    Collection<ReadFilter> filters = engine.createFilters();
    for (ReadFilter filter : filters) argumentSources.add(filter.getClass());

    Class[] argumentSourcesAsArray = new Class[argumentSources.size()];
    return argumentSources.toArray(argumentSourcesAsArray);
  }
Esempio n. 3
0
 @Override
 protected String getArgumentSourceName(Class argumentSource) {
   return engine.getWalkerName((Class<Walker>) argumentSource);
 }