public void TestUniqueCount() { var protein = new IdentifiedProtein(); var spectrum = new IdentifiedSpectrum(); var peptides = new List <IIdentifiedPeptide>(); peptides.Add(new IdentifiedPeptide(spectrum) { Sequence = "ILLLAR" }); peptides.Add(new IdentifiedPeptide(spectrum) { Sequence = "LILIAR" }); Assert.AreEqual(1, IdentifiedPeptideUtils.GetUniquePeptideCount(peptides)); peptides.Add(new IdentifiedPeptide(new IdentifiedSpectrum()) { Sequence = "LIIIAR" }); Assert.AreEqual(1, IdentifiedPeptideUtils.GetUniquePeptideCount(peptides)); }
private IIdentifiedSpectrum ReadIndividualPeptide(XmlTextReader reader, string protein) { IIdentifiedSpectrum result = new IdentifiedSpectrum(); Dictionary <string, string> elements = new Dictionary <string, string>(); String nodeName = ""; while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: nodeName = reader.Name; break; case XmlNodeType.Text: elements.Add(nodeName, reader.Value); break; case XmlNodeType.EndElement: if (reader.Name.Equals(peptideTag)) { AssignPeptideValue(result, elements, protein); return(result); } break; } } return(result); }
public void TestFilter2() { var spectrum = new IdentifiedSpectrum(); spectrum.Query.FileScan.LongFileName = "ABDCDD.12.123.2.dat"; var pro1 = new IdentifiedProtein("P1"); pro1.Peptides.Add(new IdentifiedPeptide(spectrum) { Sequence = "AAAAAAA" }); var pro2 = new IdentifiedProtein("P2"); pro2.Peptides.Add(new IdentifiedPeptide(spectrum) { Sequence = "BBBBBBB" }); var g1 = new IdentifiedProteinGroup(); g1.Add(pro1); g1.Add(pro2); IdentifiedResult ir = new IdentifiedResult(); ir.Add(g1); Assert.AreEqual(1, ir.Count); Assert.AreEqual(2, ir[0].Count); Assert.AreEqual(1, ir.GetSpectra().Count); ir.Filter(m => { return(m.Sequence.Contains('A')); }); Assert.AreEqual(1, ir.Count); Assert.AreEqual(1, ir[0].Count); Assert.AreEqual(1, ir.GetSpectra().Count); Assert.AreSame(pro1, ir[0][0]); ir.Filter(m => { return(m.Sequence.Contains('C')); }); Assert.AreEqual(0, ir.Count); }
public void TestDistinctPeptides() { IdentifiedProtein protein = new IdentifiedProtein(); IdentifiedSpectrum sp1 = new IdentifiedSpectrum(); IdentifiedSpectrum sp2 = new IdentifiedSpectrum(); protein.Peptides.Add(new IdentifiedPeptide(sp1)); protein.Peptides.Add(new IdentifiedPeptide(sp1)); protein.Peptides.Add(new IdentifiedPeptide(sp2)); Assert.AreEqual(3, protein.Peptides.Count); Assert.AreEqual(2, protein.GetSpectra().Count); Assert.AreEqual(2, protein.GetDistinctPeptides().Count()); }
public void TestSort() { IdentifiedSpectrum sp1 = new IdentifiedSpectrum(); sp1.Query.FileScan.LongFileName = "YEAST_0612_G1_SAX_080806_09.17702.17702.2.out"; new IdentifiedPeptide(sp1) { Sequence = "K.GFFSFATQK.L" }; IdentifiedSpectrum sp2 = new IdentifiedSpectrum(); sp2.Query.FileScan.LongFileName = "YEAST_0612_G1_SAX_080806_09.17707.17708.1.out"; new IdentifiedPeptide(sp2) { Sequence = "K.GFFSFATQK.L" }; IdentifiedSpectrum sp3 = new IdentifiedSpectrum(); sp3.Query.FileScan.LongFileName = "YEAST_0612_G1_SAX_080806_09.7707.7708.2.out"; new IdentifiedPeptide(sp3) { Sequence = "K.GFFSFATQK.L" }; IdentifiedSpectrum sp4 = new IdentifiedSpectrum(); sp4.Query.FileScan.LongFileName = "YEAST_0612_G1_SAX_080806_09.7707.7708.2.out"; new IdentifiedPeptide(sp4) { Sequence = "K.AAAAAAAK.L" }; List <IIdentifiedSpectrum> spectra = new List <IIdentifiedSpectrum>(); spectra.Add(sp2); spectra.Add(sp1); spectra.Add(sp3); spectra.Add(sp4); spectra.Sort(); Assert.AreSame(sp4, spectra[0]); Assert.AreSame(sp3, spectra[1]); Assert.AreSame(sp1, spectra[2]); Assert.AreSame(sp2, spectra[3]); }
public void TestCalculateCoverage() { IdentifiedProtein protein = new IdentifiedProtein(); //total 30 amino acids protein.Sequence = "ABCDEDFDEFDSESLKJFDJLSLGFGDDGD"; IdentifiedSpectrum s1 = new IdentifiedSpectrum(); IdentifiedPeptide p1 = new IdentifiedPeptide(s1); p1.Sequence = "B.CDEDF.D"; protein.Peptides.Add(p1); protein.CalculateCoverage(); Assert.AreEqual(16.67, protein.Coverage, 0.01); IdentifiedSpectrum s2 = new IdentifiedSpectrum(); IdentifiedPeptide p2 = new IdentifiedPeptide(s2); p2.Sequence = "F.DSESL.K"; protein.Peptides.Add(p2); protein.CalculateCoverage(); Assert.AreEqual(33.33, protein.Coverage, 0.01); IdentifiedSpectrum s3 = new IdentifiedSpectrum(); IdentifiedPeptide p3 = new IdentifiedPeptide(s3); p3.Sequence = "L.SLGF.G"; protein.Peptides.Add(p3); protein.CalculateCoverage(); Assert.AreEqual(46.67, protein.Coverage, 0.01); IdentifiedSpectrum s4 = new IdentifiedSpectrum(); IdentifiedPeptide p4 = new IdentifiedPeptide(s4); p4.Sequence = "L.SLGFG.D"; protein.Peptides.Add(p4); protein.CalculateCoverage(); Assert.AreEqual(50.00, protein.Coverage, 0.01); }
public void TestNoredundant() { string header = "\t\"File, Scan(s)\"\tSequence\tMH+\tDiff(MH+)\tCharge\tRank\tScore\tDeltaScore\tExpectValue\tQuery\tIons\tReference\tDIFF_MODIFIED_CANDIDATE\tPI\tMissCleavage\tModification"; IPropertyConverter <IIdentifiedSpectrum> converter = IdentifiedSpectrumPropertyConverterFactory.GetInstance().GetConverters(header, '\t'); Assert.AreEqual(header, converter.Name); IIdentifiedSpectrum mphit = new IdentifiedSpectrum(); mphit.Query.FileScan.ShortFileName = "AAA,1-2"; IdentifiedPeptide mp1 = new IdentifiedPeptide(mphit); mp1.Sequence = "AAAAA"; mp1.AddProtein("PROTEIN1"); mp1.AddProtein("PROTEIN2"); IdentifiedPeptide mp2 = new IdentifiedPeptide(mphit); mp2.Sequence = "BBBBB"; mp2.AddProtein("PROTEIN3"); mphit.TheoreticalMH = 1000.00102; mphit.ExperimentalMH = 1000.0; mphit.Query.Charge = 2; mphit.Rank = 1; mphit.Score = 100.2; mphit.DeltaScore = 0.5; mphit.ExpectValue = 1.1e-2; mphit.Query.QueryId = 10; mphit.NumMissedCleavages = 1; mphit.Modifications = "O18(1)"; string expect = " AAA,1 - 2 AAAAA ! BBBBB 1000.00102 0.00102 2 1 100.2 0.5 1.10E-002 10 0|0 PROTEIN1/PROTEIN2 ! PROTEIN3 0.00 1 O18(1)"; Assert.AreEqual(expect, converter.GetProperty(mphit)); string expectNew = " BBB,2 - 3 BBBBB 1002.00783 -0.00200 3 2 200.2 0.6 1.20E-003 20 0|0 PROTEIN2/PROTEIN4 0.00 2 O18(2)"; converter.SetProperty(mphit, expectNew); Assert.AreEqual(expectNew, converter.GetProperty(mphit)); }
public void SetUp() { s1 = new IdentifiedSpectrum(); s1.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11110"; s1.Query.Charge = 2; s1.Score = 3.0; s1.AddPeptide(new IdentifiedPeptide(s1) { Sequence = "R.#VK*PDR.T" }); s2 = new IdentifiedSpectrum(); s2.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11110"; s2.Query.Charge = 2; s2.Score = 2.0; s2.AddPeptide(new IdentifiedPeptide(s2) { Sequence = "R.#VK*PDR.T" }); s3 = new IdentifiedSpectrum(); s3.Score = 1.0; s3.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11110"; s3.Query.Charge = 3; s3.AddPeptide(new IdentifiedPeptide(s3) { Sequence = "R.#VK*PDDEFER.T" }); s4 = new IdentifiedSpectrum(); s4.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11111"; s4.Query.Charge = 3; s4.Score = 5.0; s4.AddPeptide(new IdentifiedPeptide(s4) { Sequence = "R.#VK*PDDSKEIEFER.T" }); s5 = new IdentifiedSpectrum(); s5.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11111"; s5.Query.Charge = 3; s5.Score = 4.0; s5.AddPeptide(new IdentifiedPeptide(s5) { Sequence = "R.#VK*PEESKEIEFER.T" }); s6 = new IdentifiedSpectrum(); s6.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11111"; s6.Query.Charge = 2; s6.Score = 3.0; s6.AddPeptide(new IdentifiedPeptide(s6) { Sequence = "R.#VK*PEESEFER.T" }); s7 = new IdentifiedSpectrum(); s7.Query.FileScan.ShortFileName = "YEAST_0610_G1_SAX_080811_01,11111"; s7.Query.Charge = 2; s7.Score = 3.0; s7.AddPeptide(new IdentifiedPeptide(s7) { Sequence = "R.#VKPEESEFER*.T" }); }