private void LoadRelations( SortedList<string,string> SortedAccession, SortedList<string,Peptide> SortedPeptides) { if( m_mzid.Data.DataCollection.AnalysisData.SpectrumIdentificationList.Length != 1 ) throw new ApplicationException( "Multiple spectrum identification lists not supported" ); SortedList<string,PeptideEvidenceType> SortedEvidences = new SortedList<string, PeptideEvidenceType>(); foreach( PeptideEvidenceType evidence in m_mzid.Data.SequenceCollection.PeptideEvidence ) SortedEvidences.Add( evidence.id, evidence ); int SpectrumID = 1; int PsmID = 1; double score; string type; Peptide.ConfidenceType confidence; foreach( SpectrumIdentificationResultType idres in m_mzid.Data.DataCollection.AnalysisData.SpectrumIdentificationList[0].SpectrumIdentificationResult ) { Spectrum spectrum = new Spectrum(); spectrum.ID = SpectrumID++; spectrum.File = idres.spectraData_ref; spectrum.SpectrumID = idres.spectrumID; spectrum.Psm = new List<PSM>(); Spectra.Add(spectrum); foreach( SpectrumIdentificationItemType item in idres.SpectrumIdentificationItem ) { //Console.Out.WriteLine(item.id); GetPsmScore( item, out score, out type, out confidence ); PSM psm = new PSM(); psm.ID = PsmID++; psm.Charge = item.chargeState; psm.Mz = item.experimentalMassToCharge; psm.Rank = item.rank; psm.Score = score; psm.ScoreType = type; psm.Confidence = confidence; psm.passThreshold = item.passThreshold; psm.Spectrum = spectrum; spectrum.Psm.Add(psm); if( item.PeptideEvidenceRef == null ) continue; foreach( PeptideEvidenceRefType evref in item.PeptideEvidenceRef ) { //Console.Out.WriteLine(evref.peptideEvidence_ref); PeptideEvidenceType evidence = SortedEvidences[evref.peptideEvidence_ref]; Peptide pep = SortedPeptides[evidence.peptide_ref]; if( pep.Sequence == null || pep.Sequence.Length == 0 ) { // ProCon 0.9.348 bug //Notify( "Skiped peptide with empty sequence: " + pep.DBRef ); continue; } pep.Decoy = evidence.isDecoy; psm.Peptide = pep; //pep.Psm.Add(psm); Protein prot = m_SortedProteins[SortedAccession[evidence.dBSequence_ref]]; if( pep.Proteins.Contains(prot) ) continue; prot.Peptides.Add( pep ); pep.Proteins.Add( prot ); } } } }
/// <summary> /// Create an object using the contents of the corresponding MzIdentML object /// </summary> /// <param name="pe"></param> /// <param name="idata"></param> public PeptideEvidenceObj(PeptideEvidenceType pe, IdentDataObj idata) : base(pe, idata) { DBSequenceRef = pe.dBSequence_ref; PeptideRef = pe.peptide_ref; _start = pe.start; StartSpecified = pe.startSpecified; _end = pe.end; EndSpecified = pe.endSpecified; Pre = pe.pre; Post = pe.post; TranslationTableRef = pe.translationTable_ref; _frame = pe.frame; FrameSpecified = pe.frameSpecified; IsDecoy = pe.isDecoy; Id = pe.id; Name = pe.name; }