Exemple #1
0
        public void TestBuild()
        {
            var pep1 = new IdentifiedPeptide(new IdentifiedSpectrum(new SequestFilename("A", 1, 1, 1, ".dta")))
            {
                Sequence = "A"
            };
            var pep2 = new IdentifiedPeptide(new IdentifiedSpectrum(new SequestFilename("B", 1, 1, 1, ".dta")))
            {
                Sequence = "B"
            };
            var pep3 = new IdentifiedPeptide(new IdentifiedSpectrum(new SequestFilename("C", 1, 1, 1, ".dta")))
            {
                Sequence = "C"
            };
            var pep4 = new IdentifiedPeptide(new IdentifiedSpectrum(new SequestFilename("D", 1, 1, 1, ".dta")))
            {
                Sequence = "D"
            };
            var pep5 = new IdentifiedPeptide(new IdentifiedSpectrum(new SequestFilename("E", 1, 1, 1, ".dta")))
            {
                Sequence = "E"
            };
            var pep6 = new IdentifiedPeptide(new IdentifiedSpectrum(new SequestFilename("F", 1, 1, 1, ".dta")))
            {
                Sequence = "F"
            };

            var protein1 = new IdentifiedProtein()
            {
                Peptides = new IIdentifiedPeptide[] { pep1, pep3, pep5, pep6 }.ToList()
            };

            var protein2 = new IdentifiedProtein()
            {
                Peptides = new IIdentifiedPeptide[] { pep2, pep3, pep4 }.ToList()
            };

            //should be removed from final result since all peptides has been included in protein1 and protein2, even one protein contains both peptides
            var protein3 = new IdentifiedProtein()
            {
                Peptides = new IIdentifiedPeptide[] { pep1, pep2 }.ToList()
            };

            //should be removed from final result since all peptides has been included in protein1
            var protein4 = new IdentifiedProtein()
            {
                Peptides = new IIdentifiedPeptide[] { pep1, pep5 }.ToList()
            };

            var actual = new IdentifiedProteinGroupBuilder().Build(new IIdentifiedProtein[] { protein1, protein2, protein3 }.ToList());

            Assert.AreEqual(2, actual.Count);
            Assert.AreSame(protein1, actual[0][0]);
            Assert.AreSame(protein2, actual[1][0]);
        }
        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);
        }
Exemple #3
0
        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));
        }
Exemple #4
0
        private void AssignPeptideValue(IIdentifiedSpectrum result, Dictionary <string, string> elements, string protein)
        {
            result.Query.FileScan.Scan = elements["file"];

            IIdentifiedPeptide sp = new IdentifiedPeptide(result);

            sp.Sequence = elements["sequence"];
            sp.AddProtein(protein);

            result.TheoreticalMH  = MyConvert.ToDouble(elements["mass"]);
            result.ExperimentalMH = result.TheoreticalMH - MyConvert.ToDouble(elements["deltamass"]);
            result.Query.Charge   = int.Parse(elements["charge"]);
            result.Score          = MyConvert.ToDouble(elements["xcorr"]);
            double DeltaScore = MyConvert.ToDouble(elements["deltacn"]);

            result.DeltaScore = Math.Min(1.0, DeltaScore);
            result.SpScore    = MyConvert.ToDouble(elements["sp"]);
            result.SpRank     = int.Parse(elements["rsp"]);
            result.Ions       = elements["ions"];
            return;
        }