public void appendPeptides(Appendable out) { try { List<String> proteins = new ArrayList<String>(proteinToHits.keySet()); Collections.sort(proteins); for (String protein : proteins) { Set<IdentifiedPSM> pps = proteinToHits.get(protein); List<IdentifiedPSM> peptides = new ArrayList<IdentifiedPSM>(pps); Collections.sort(peptides); for (IdentifiedPSM psm : peptides) { Polypeptide peptide = (Polypeptide) psm.getPeptide(); // .getUnModified(); out.append(peptide.toString()); out.append("\t"); out.append(psm.getId()); out.append("\t"); out.append(protein); out.append("\t"); String rt = String.format("%11.3f", peptide.getRetentionTime()).trim(); out.append(rt); out.append("\n"); } } } catch (Exception e) { throw new RuntimeException(e); } }
public void setPeptideId(final String pPeptideId) { if (m_Peptide != null || m_PeptideId != null) throw new IllegalStateException("Cannot reset peptide"); // ToDo change m_PeptideId = pPeptideId; IMainData main = getMainData(); if (main != null) { // RawPeptideScan rawScan = main.getRawScan(getId()); // pMeasured = rawScan; ITaxonomy taxonomy = main.getTaxonomy(); if (taxonomy != null) { String peptideId = getPeptideId(); m_Peptide = taxonomy.getPeptideById(peptideId); if (m_Peptide == null) m_Peptide = Polypeptide.fromString(peptideId); // key may be all we need } } else { m_Peptide = Polypeptide.fromString(getPeptideId()); } if (m_Peptide != null) { IPeptideDigester digester = PeptideBondDigester.getDefaultDigester(); int missedCleavages = digester.probableNumberMissedCleavages(m_Peptide); ((Polypeptide) m_Peptide).setMissedCleavages(missedCleavages); } }
public static IdentifiedPSM processPeptide(final String line, double retentionTime, String id) { String peptide = XMLUtil.extractAttribute(line, "peptide"); if (peptide == null) throw new IllegalArgumentException("bad line " + line); Polypeptide polypeptide = Polypeptide.fromString(peptide); polypeptide.setRetentionTime(retentionTime); return new IdentifiedPSM(id, polypeptide); }
/** finish handling and set up the enclosed object Usually called when the end tag is seen */ @Override public void finishProcessing() { IMeasuredSpectrum pMeasured = null; final double pScore = getScore(); final double pHyperScore = getHyperScore(); final double rawScore = getRawScore(); IonTypeScorer scorer = getIonScore(); IProteinPosition[] containedInProteins = m_Positions.toArray(IProteinPosition.EMPTY_ARRAY); ((Polypeptide) m_Peptide).setContainedInProteins(containedInProteins); SpectralMatch scan = new SpectralMatch(m_Peptide, pMeasured, pScore, pHyperScore, rawScore, scorer, null); if (m_Usage != null) scan.getUsage().addTo(m_Usage); setElementObject(scan); }