public PeptideTerminalAAResult calculateForAnalysis(int analysisId) {

    DAOFactory daoFactory = DAOFactory.instance();

    MsRunSearchAnalysisDAO rsaDao = daoFactory.getMsRunSearchAnalysisDAO();
    List<Integer> runSearchAnalysisIds = rsaDao.getRunSearchAnalysisIdsForAnalysis(analysisId);

    PeptideTerminalAAResult result =
        calculateForRunSearchAnalysisIds(analysisId, runSearchAnalysisIds);
    result.setEnzyme(enzyme);
    return result;
  }
  public PeptideTerminalAAResult calculateForRunSearchAnalysisIds(
      int analysisId, List<Integer> runSearchAnalysisIds) {

    long s = System.currentTimeMillis();

    PeptideTerminalAAResult result = new PeptideTerminalAAResult();
    result.setAnalysisId(analysisId);
    result.setScoreCutoff(this.scoreCutoff);
    result.setScoreType("PERC_PSM_QVAL");
    result.setEnzyme(this.enzyme);

    for (Integer rsaId : runSearchAnalysisIds) {

      PeptideTerminalAAResult rsaResult = calculateForRunSearchAnalysis(analysisId, rsaId);
      result.combineWith(rsaResult);
    }

    long e = System.currentTimeMillis();

    log.info("Total time to get results " + TimeUtils.timeElapsedSeconds(s, e) + " seconds");
    log.info("Total filtered results: " + result.getTotalResultCount());

    result.setEnzyme(enzyme);
    return result;
  }