@Override
  public void analyzeSelf(
      String traceFile, String analysisFile, int windowSize, int stepSize, String analysisId)
      throws AnalysisException {

    try {
      AlignmentAnalyses analyses = readAnalyses(analysisFile, getWorkingDir());

      if (analysisId == null) {
        for (AbstractAnalysis a : analyses.analyses()) {
          if (a instanceof ScanAnalysis && a.getId().endsWith("-self-scan")) {
            ScanAnalysis sa = (ScanAnalysis) a;
            sa.setWindowSize(windowSize);
            sa.setStepSize(stepSize);
            sa.run(null);
          }
        }
      } else {
        ScanAnalysis sa = (ScanAnalysis) analyses.getAnalysis(analysisId);
        sa.run(null);
      }
    } catch (IOException e) {
      throw new RuntimeException(e);
    } catch (ParameterProblemException e) {
      throw new RuntimeException(e);
    } catch (FileFormatException e) {
      throw new RuntimeException(e);
    }
  }
  private PhyloClusterAnalysis getPhyloAnalysis(String genusId, String typeId, Region region)
      throws IOException, ParameterProblemException, FileFormatException {
    String alignmentId = genusId;

    if (region != null) alignmentId += "-" + region.getName();

    String analysisId;
    if (typeId != null) analysisId = "phylo-minor-" + typeId;
    else analysisId = "phylo-major";

    PhyloClusterAnalysis result = phyloAnalyses.get(alignmentId + "-" + analysisId);

    if (result == null) {
      String f = "phylo-" + alignmentId + ".xml";
      if (new File(getXmlPathAsString() + f).canRead()) {
        AlignmentAnalyses analyses = readAnalyses(getXmlPathAsString() + f, getWorkingDir());
        analyses.setRegion(region);

        if (analyses.haveAnalysis(analysisId)) {
          result = (PhyloClusterAnalysis) analyses.getAnalysis(analysisId);
          phyloAnalyses.put(alignmentId + "-" + analysisId, result);
        }
      }
    }

    return result;
  }
  public GenericTool(ToolConfig toolConfig, File workDir)
      throws IOException, ParameterProblemException, FileFormatException {
    super(toolConfig, workDir);

    blastXml = readAnalyses(getXmlPathAsString() + "blast.xml", getWorkingDir());
    blastAnalysis = (BlastAnalysis) blastXml.getAnalysis("blast");
  }
 @Override
 protected void formatDB() throws ApplicationException {
   blastAnalysis.formatDB(blastXml.getAlignment());
 }