public void TestBuildNonredundantProteinGroup() { List <IIdentifiedProtein> proteins = InitProteins(); List <IIdentifiedProteinGroup> mpgs = MascotUtils.BuildNonredundantProteinGroups(proteins); Assert.AreEqual(1, mpgs.Count); Assert.AreEqual("Protein1", mpgs[0][0].Name); }
public void TestBuildProteins() { var mph1 = new IdentifiedSpectrum(); mph1.Query.FileScan.Experimental = "EXP1"; var mp1 = new IdentifiedPeptide(mph1); mp1.AddProtein("Protein1"); mp1.AddProtein("Protein2"); var mph2 = new IdentifiedSpectrum(); mph2.Query.FileScan.Experimental = "EXP2"; var mp2 = new IdentifiedPeptide(mph2); mp2.AddProtein("Protein1"); mp2.AddProtein("Protein3"); var mphs = new List <IIdentifiedSpectrum>(); mphs.Add(mph1); mphs.Add(mph2); List <IIdentifiedProtein> proteins = MascotUtils.BuildProteins(mphs); Assert.AreEqual(3, proteins.Count); foreach (IdentifiedProtein mp in proteins) { if (mp.Name.Equals("Protein1")) { Assert.AreEqual(2, mp.Peptides.Count); continue; } if (mp.Name.Equals("Protein2")) { Assert.AreEqual(1, mp.Peptides.Count); Assert.AreEqual(mp1, mp.Peptides[0]); continue; } if (mp.Name.Equals("Protein3")) { Assert.AreEqual(1, mp.Peptides.Count); Assert.AreEqual(mp2, mp.Peptides[0]); continue; } } }
public void TestParseTitle() { SequestFilename sf = MascotUtils.ParseTitle(" Cmpd. 6612. 6612. 1. dta", 1); Assert.AreEqual("Cmpd.6612.6612.1.dta", sf.LongFileName); sf = MascotUtils.ParseTitle(" FIT_PPN_SAX_Online_1mg_060909_01, Cmpd 7736, +MSn(600.4082), 51.88 min", 1); Assert.AreEqual("FIT_PPN_SAX_Online_1mg_060909_01.7736.7736.1.dta", sf.LongFileName); sf = MascotUtils.ParseTitle( "spectrumId=6085 Polarity=Positive ScanMode=ProductIon TimeInMinutes=61.875 acqNumber=3712494", 1); Assert.AreEqual(".6085.6085.1.dta", sf.LongFileName); sf = MascotUtils.ParseTitle( "Elution from: 40.798 to 40.798 period: 0 experiment: 1 cycles: 1 precIntensity: 355220.0 FinneganScanNumber: 6070 MStype: enumIsNormalMS rawFile: KR_mix_lc_090115.raw", 1); Assert.AreEqual("KR_mix_lc_090115.6070.6070.1.dta", sf.LongFileName); }
public void TestParseTitleException() { MascotUtils.ParseTitle("dfajdskfjalsdjfa", 1); }
protected IdentifiedProtein ParseProtein(String proteinContent) { IdentifiedProtein result = GetProtein(proteinContent); List <String> peptideInfoContentList = GetPeptideInfoContentList(proteinContent); foreach (String peptideInfoContent in peptideInfoContentList) { List <String> peptideInfo = GetPeptideInfo(peptideInfoContent); if (0 == peptideInfo.Count) { continue; } IIdentifiedSpectrum mphit = new IdentifiedSpectrum(); // Group 0 : peptide mass from observed m/z double experimentalPeptideMass = MyConvert.ToDouble(peptideInfo[0]); mphit.ExperimentalMass = experimentalPeptideMass; // Group 1 : observed m/z double observed = MyConvert.ToDouble(peptideInfo[1]); mphit.Query.ObservedMz = observed; // Group 2 : charge int charge = int.Parse(peptideInfo[2]); mphit.Query.Charge = charge; // Group 3 : title String title = Uri.UnescapeDataString(peptideInfo[3]).Trim(); mphit.Query.Title = title; SequestFilename sf = MascotUtils.ParseTitle(title, charge); if (sf != null) { mphit.Query.FileScan.LongFileName = sf.LongFileName; } // Group 4 : query mphit.Query.QueryId = int.Parse(peptideInfo[4]); // Group 5 equals Group 1 // Group 6 equals Group 0 // Group 7 : calculated peptide mass mphit.TheoreticalMass = MyConvert.ToDouble(peptideInfo[7]); // Group 8 : different between observed peptide mass and calculated // peptide mass // Group 9 : miss cleavage mphit.NumMissedCleavages = int.Parse(peptideInfo[9]); // Group 10: score mphit.Score = int.Parse(peptideInfo[10]); // Group 11: expect p value mphit.ExpectValue = MyConvert.ToDouble(peptideInfo[11]); // Group 12: rank mphit.Rank = int.Parse(peptideInfo[12]); // Group 13: peptide sequence // K.YEINVLR<u>.</u>N + Label:18O(2) (C-term) String seq = peptideInfo[13].Replace(" ", ""); var mpep = new IdentifiedPeptide(mphit); string[] parts = Regex.Split(seq, "\\+"); if (parts.Length > 1) { seq = parts[0].Trim(); mphit.Modifications = parts[1].Trim(); string[] mods = parts[1].Trim().Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (string mod in mods) { Match m = this.modificationReg.Match(mod.Trim()); if (!this.modifications.ContainsKey(m.Groups[1].Value)) { this.modifications[m.Groups[1].Value] = ' '; } } } mpep.Sequence = seq; if (GetPeptideFilter().Accept(mphit)) { mpep.AddProtein(result.Name); result.Peptides.Add(mpep); } } return(result); }