Ejemplo n.º 1
0
	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 );
				}
			}
		}
	}
Ejemplo n.º 2
0
	private bool CheckPsm( PSM psm ) {
		if( psm.Peptide == null )
			return false;
		return CheckPsm( psm.passThreshold, psm.Rank, psm.Confidence, psm.Score, psm.ScoreType );
	}