Пример #1
0
        private ProteinDetectionHypothesisType ClonePDH(ProteinDetectionHypothesisType pdh)
        {
            ProteinDetectionHypothesisType clon = new ProteinDetectionHypothesisType();

            clon.id                = pdh.id;
            clon.name              = pdh.name;
            clon.dBSequence_ref    = pdh.dBSequence_ref;
            clon.passThreshold     = pdh.passThreshold;
            clon.PeptideHypothesis = pdh.PeptideHypothesis;
            clon.Items             = pdh.Items;
            return(clon);
        }
Пример #2
0
        private void UpdatePdhCvs(ProteinDetectionHypothesisType pdh, Protein.EvidenceType evidence)
        {
            List <AbstractParamType> list = new List <AbstractParamType>();

            foreach (AbstractParamType item in pdh.Items)
            {
                if (!item.name.Contains("PAnalyzer") && !item.name.Contains("leading"))
                {
                    list.Add(item);
                }
            }
            CVParamType ev = new CVParamType(), ld = new CVParamType();

            ev.cvRef = "PSI-MS";
            ld.cvRef = "PSI-MS";
            switch (evidence)
            {
            case Protein.EvidenceType.Conclusive:
                ev.accession = "MS:1002213";
                ev.name      = "PAnalyzer:conclusive protein";
                ld.accession = "MS:1002401";
                ld.name      = "leading protein";
                break;

            case Protein.EvidenceType.Indistinguishable:
                ev.accession = "MS:1002214";
                ev.name      = "PAnalyzer:indistinguishable protein";
                ld.accession = "MS:1002401";
                ld.name      = "leading protein";
                break;

            case Protein.EvidenceType.Group:
                ev.accession = "MS:1002216";
                ev.name      = "PAnalyzer:ambiguous group member";
                ld.accession = "MS:1002401";
                ld.name      = "leading protein";
                break;

            case Protein.EvidenceType.NonConclusive:
                ev.accession = "MS:1002215";
                ev.name      = "PAnalyzer:non-conclusive protein";
                ld.accession = "MS:1002402";
                ld.name      = "non-leading protein";
                break;

            default:                    // filtered
                return;
            }
            list.Add(ld);
            list.Add(ev);
            pdh.Items = list.ToArray();
        }
        /// <summary>
        /// Create an object using the contents of the corresponding MzIdentML object
        /// </summary>
        /// <param name="pdh"></param>
        /// <param name="idata"></param>
        public ProteinDetectionHypothesisObj(ProteinDetectionHypothesisType pdh, IdentDataObj idata)
            : base(pdh, idata)
        {
            Id            = pdh.id;
            Name          = pdh.name;
            DBSequenceRef = pdh.dBSequence_ref;
            PassThreshold = pdh.passThreshold;

            PeptideHypotheses = new IdentDataList <PeptideHypothesisObj>(1);

            if (pdh.PeptideHypothesis?.Count > 0)
            {
                PeptideHypotheses.AddRange(pdh.PeptideHypothesis, ph => new PeptideHypothesisObj(ph, IdentData));
            }
        }
Пример #4
0
	// TODO: Support empty PDH in input mzid
	protected virtual List<ProteinAmbiguityGroupType> BuildProteinDetectionList() {
		int gid = 1;
		SortedList<string,ProteinDetectionHypothesisType> list = new SortedList<string, ProteinDetectionHypothesisType>();
		List<ProteinAmbiguityGroupType> groups = new List<ProteinAmbiguityGroupType>();
		
		foreach( ProteinAmbiguityGroupType grp in m_mzid.Data.DataCollection.AnalysisData.ProteinDetectionList.ProteinAmbiguityGroup )
			foreach( ProteinDetectionHypothesisType pdh in grp.ProteinDetectionHypothesis )
				list.Add( pdh.dBSequence_ref, pdh );
		
		foreach( Protein p in Proteins ) {
			ProteinAmbiguityGroupType g = new ProteinAmbiguityGroupType();
			CVParamType ev = new CVParamType();
			ev.accession = "MS:1001600";
			ev.cvRef = "PSI-MS";
			ev.name = "Protein Inference Confidence Category";
			switch( p.Evidence ) {
				case Protein.EvidenceType.Conclusive:
					ev.value = "conclusive"; break;
				case Protein.EvidenceType.Indistinguishable:
					ev.value = "indistinguishable"; break;
				case Protein.EvidenceType.Group:
					ev.value = "ambiguous group"; break;
				case Protein.EvidenceType.NonConclusive:
					ev.value = "non conclusive"; break;
				default:
					continue;
			}
			g.id = "PAG_" + gid; gid++;
			if( p.Subset.Count == 0 ) {
				//g.ProteinDetectionHypothesis.Add(list[p.DBRef]);
				g.ProteinDetectionHypothesis = new ProteinDetectionHypothesisType[]{list[p.DBRef]};
				g.Items = new CVParamType[]{ev};
			} else {
				List<ProteinDetectionHypothesisType> listpdh = new List<ProteinDetectionHypothesisType>();
				foreach( Protein p2 in p.Subset ) {
					ProteinDetectionHypothesisType pdh = list[p2.DBRef];
					pdh.Items = new CVParamType[]{ev};
					listpdh.Add( pdh );
				}
				g.ProteinDetectionHypothesis = listpdh.ToArray();
			}
			groups.Add( g );
		}
		
		return groups;
	}
Пример #5
0
        /// <summary>
        /// Create an object using the contents of the corresponding MzIdentML object
        /// </summary>
        /// <param name="pdh"></param>
        /// <param name="idata"></param>
        public ProteinDetectionHypothesisObj(ProteinDetectionHypothesisType pdh, IdentDataObj idata)
            : base(pdh, idata)
        {
            this._id            = pdh.id;
            this._name          = pdh.name;
            this.DBSequenceRef  = pdh.dBSequence_ref;
            this._passThreshold = pdh.passThreshold;

            this._peptideHypotheses = null;

            if (pdh.PeptideHypothesis != null && pdh.PeptideHypothesis.Count > 0)
            {
                this.PeptideHypotheses = new IdentDataList <PeptideHypothesisObj>();
                foreach (var ph in pdh.PeptideHypothesis)
                {
                    this.PeptideHypotheses.Add(new PeptideHypothesisObj(ph, this.IdentData));
                }
            }
        }
Пример #6
0
        private List <ProteinAmbiguityGroupType> BuildPags()
        {
            int gid = 1;
            SortedList <string, ProteinDetectionHypothesisType> listPdh = new SortedList <string, ProteinDetectionHypothesisType>();
            SortedList <string, ProteinAmbiguityGroupType>      listPag = new SortedList <string, ProteinAmbiguityGroupType>();
            List <ProteinAmbiguityGroupType> groups = new List <ProteinAmbiguityGroupType>();

            // Collect existing PDHs
            foreach (ProteinAmbiguityGroupType grp in m_mzid.Data.DataCollection.AnalysisData.ProteinDetectionList.ProteinAmbiguityGroup)
            {
                foreach (ProteinDetectionHypothesisType pdh in grp.ProteinDetectionHypothesis)
                {
                    if (!listPdh.ContainsKey(pdh.dBSequence_ref))
                    {
                        listPdh.Add(pdh.dBSequence_ref, pdh);
                    }
                }
            }

            // Build PAGs for every group except non-conclusive proteins
            foreach (Protein p in Proteins)
            {
                if (p.Evidence == Protein.EvidenceType.NonConclusive || p.Evidence == Protein.EvidenceType.Filtered)
                {
                    continue;
                }
                ProteinAmbiguityGroupType g = new ProteinAmbiguityGroupType();
                g.id = "PAG_" + gid++;
                if (p.Subset.Count == 0)
                {
                    g.ProteinDetectionHypothesis = new ProteinDetectionHypothesisType[] { listPdh[p.DBRef] };
                    UpdatePdhCvs(g.ProteinDetectionHypothesis[0], p.Evidence);
                    listPag.Add(g.ProteinDetectionHypothesis[0].dBSequence_ref, g);
                }
                else
                {
                    List <ProteinDetectionHypothesisType> tmp = new List <ProteinDetectionHypothesisType>();
                    foreach (Protein p2 in p.Subset)
                    {
                        ProteinDetectionHypothesisType pdh = listPdh[p2.DBRef];
                        UpdatePdhCvs(pdh, p2.Evidence);
                        tmp.Add(pdh);
                        listPag.Add(pdh.dBSequence_ref, g);
                    }
                    g.ProteinDetectionHypothesis = tmp.ToArray();
                }
                groups.Add(g);
            }

            // Include non-conclusive proteins in existing PAGs
            bool include;

            foreach (Protein p in Proteins)
            {
                if (p.Evidence != Protein.EvidenceType.NonConclusive)
                {
                    continue;
                }
                ProteinDetectionHypothesisType pdh = listPdh[p.DBRef];
                UpdatePdhCvs(pdh, Protein.EvidenceType.NonConclusive);
                foreach (Peptide f in p.Peptides)
                {
                    foreach (Protein t in f.Proteins)
                    {
                        include = true;
                        if (!listPag.ContainsKey(t.DBRef))
                        {
                            continue;
                        }
                        ProteinAmbiguityGroupType g = listPag[t.DBRef];
                        foreach (ProteinDetectionHypothesisType h in g.ProteinDetectionHypothesis)
                        {
                            if (GetBaseId(h) == GetBaseId(pdh))
                            {
                                include = false;
                                break;
                            }
                        }
                        if (include)
                        {
                            ProteinDetectionHypothesisType clon = ClonePDH(pdh);
                            clon.id = GetBaseId(clon) + "@" + g.id;
                            List <ProteinDetectionHypothesisType> tmp =
                                new List <ProteinDetectionHypothesisType>(g.ProteinDetectionHypothesis);
                            tmp.Add(clon);
                            g.ProteinDetectionHypothesis = tmp.ToArray();
                        }
                    }
                }
            }

            return(groups);
        }
Пример #7
0
        private String GetBaseId(ProteinDetectionHypothesisType pdh)
        {
            int i = pdh.id.IndexOf('@');

            return(i < 0 ? pdh.id : pdh.id.Substring(0, i));
        }