コード例 #1
0
  private String reconstructSequestPeptideSequence(int searchId, SequestSearchResult resultDb) {
    // dynamic modifications for the search
    MsSearchResultPeptide peptideSeq = resultDb.getResultPeptide();
    List<MsResultResidueMod> resultMods = peptideSeq.getResultDynamicResidueModifications();
    Collections.sort(
        resultMods,
        new Comparator<MsResultResidueMod>() {
          public int compare(MsResultResidueMod o1, MsResultResidueMod o2) {
            return new Integer(o1.getModifiedPosition())
                .compareTo(new Integer(o2.getModifiedPosition()));
          }
        });

    String justSeq = peptideSeq.getPeptideSequence();
    StringBuilder fullSeq = new StringBuilder();
    fullSeq.append(peptideSeq.getPreResidue() + ".");
    int lastIdx = 0;
    for (MsResultResidueMod mod : resultMods) {
      int pos = mod.getModifiedPosition();
      fullSeq.append(justSeq.substring(lastIdx, pos + 1));
      fullSeq.append(mod.getModificationSymbol());
      lastIdx = pos + 1;
    }
    if (lastIdx < justSeq.length()) {
      fullSeq.append(justSeq.substring(lastIdx, justSeq.length()));
    }
    fullSeq.append("." + peptideSeq.getPostResidue());
    return fullSeq.toString();
  }
コード例 #2
0
  public PeptideTerminalAAResult calculateForRunSearchAnalysis(
      int analysisId, int runSearchAnalysisId) {

    if (lookAtUniqPeptides) {
      if (this.peptides == null) {
        peptides = new HashSet<String>();
      }
    }

    PercolatorResultDAO percDao = DAOFactory.instance().getPercolatorResultDAO();

    PercolatorResultFilterCriteria filterCriteria = new PercolatorResultFilterCriteria();
    filterCriteria.setMaxQValue(scoreCutoff);

    long s = System.currentTimeMillis();

    PeptideTerminalAAResultBuilder builder = new PeptideTerminalAAResultBuilder(analysisId, enzyme);
    builder.setScoreCutoff(this.scoreCutoff);
    builder.setScoreType("PERC_PSM_QVAL");

    int totalResults = 0;

    List<Integer> percResultIds =
        percDao.loadIdsForRunSearchAnalysis(runSearchAnalysisId, filterCriteria, null);

    log.info(
        "Found "
            + percResultIds.size()
            + " Percolator results at qvalue <= "
            + scoreCutoff
            + " for runSearchAnalysisID "
            + runSearchAnalysisId);

    for (Integer percResultId : percResultIds) {

      PercolatorResult pres = percDao.loadForPercolatorResultId(percResultId);
      MsSearchResultPeptide peptide = pres.getResultPeptide();
      String seq = peptide.getPeptideSequence();

      if (this.lookAtUniqPeptides) {
        String fullseq = peptide.getPreResidue() + "." + seq + "." + peptide.getPostResidue();
        if (peptides.contains(fullseq)) continue;
        else peptides.add(fullseq);
      }

      totalResults++;

      char ntermMinusOne = peptide.getPreResidue(); // nterm - 1 residue
      builder.addNtermMinusOneCount(ntermMinusOne);

      char nterm = seq.charAt(0); // nterm residue
      builder.addNtermCount(nterm);

      char cterm = seq.charAt(seq.length() - 1); // cterm residue
      builder.addCtermCount(cterm);

      char ctermPlusOne = peptide.getPostResidue(); // cterm + 1 residue
      builder.addCtermPlusOneCount(ctermPlusOne);

      int numEnzTerm = 0;
      if (this.rule != null)
        numEnzTerm = rule.getNumEnzymaticTermini(seq, ntermMinusOne, ctermPlusOne);
      builder.addEnzymaticTerminiCount(numEnzTerm);
    }

    long e = System.currentTimeMillis();

    log.info(
        "Time to get results for runSearchAnalysisId "
            + runSearchAnalysisId
            + " "
            + TimeUtils.timeElapsedSeconds(s, e)
            + " seconds");
    log.info("# filtered results: " + totalResults);

    builder.setTotalResultCount(totalResults);

    return builder.getResult();
  }