Ejemplo n.º 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();
  }
Ejemplo n.º 2
0
  private void printSequestSQTData(
      SQTRunSearch runSearch, int searchDatabaseId, BufferedWriter outFile) throws IOException {

    List<MsResidueModification> dynaResidueModsDb =
        getDynaResidueModsForSearch(runSearch.getSearchId());

    SQTSearchScanDAO scanDao = DAOFactory.instance().getSqtSpectrumDAO();

    SequestSearchResultDAO resultDao = DAOFactory.instance().getSequestResultDAO();
    List<Integer> resultIds = resultDao.loadResultIdsForRunSearch(runSearch.getId());
    int currCharge = -1;
    int currScanId = -1;
    SearchScan currScan = null;
    for (Integer resultId : resultIds) {
      SequestSearchResult result = resultDao.load(resultId);
      if (result.getScanId() != currScanId || result.getCharge() != currCharge) {
        if (currScan != null) {
          outFile.write(currScan.toString());
          outFile.write("\n");
        }
        currScanId = result.getScanId();
        currCharge = result.getCharge();
        SQTSearchScan scanDb =
            scanDao.load(runSearch.getId(), currScanId, currCharge, result.getObservedMass());
        currScan = makeScanResult(scanDb);
      }
      List<MsResidueModificationIn> dynaResidueMods = new ArrayList<MsResidueModificationIn>();
      for (MsResidueModification modDb : dynaResidueModsDb) {
        dynaResidueMods.add(modDb);
      }
      SequestResult peptResult = new SequestResult();
      peptResult.setResultPeptide(result.getResultPeptide());
      SequestResultData data = result.getSequestResultData();
      peptResult.setCharge(result.getCharge());
      peptResult.setObservedMass(result.getObservedMass());
      peptResult.setDeltaCN(data.getDeltaCN());
      peptResult.setCalculatedMass(data.getCalculatedMass());
      peptResult.setMatchingIons(data.getMatchingIons());
      peptResult.setPredictedIons(data.getPredictedIons());
      peptResult.setOriginalPeptideSequence(
          reconstructSequestPeptideSequence(runSearch.getSearchId(), result));
      peptResult.setScanNumber(currScan.getScanNumber());
      peptResult.setSp(data.getSp());
      peptResult.setSpRank(data.getSpRank());
      peptResult.setValidationStatus(result.getValidationStatus().getStatusChar());
      peptResult.setxCorr(data.getxCorr());
      peptResult.setxCorrRank(data.getxCorrRank());
      peptResult.setEvalue(data.getEvalue());

      List<MsSearchResultProtein> proteins = getProteinsForResultId(resultId);
      for (MsSearchResultProtein pr : proteins) {
        peptResult.addMatchingLocus(pr.getAccession(), null);
      }
      // currScan.addPeptideResult(peptResult);
    }
    // print the last one
    if (currScan != null) {
      outFile.write(currScan.toString());
      outFile.write("\n");
    }
  }