Esempio n. 1
0
        public static void TestCompIons_MatchIonsScore()
        {
            TestDataFile t = new TestDataFile();
            Tolerance    productMassTolerance = new AbsoluteTolerance(0.01);
            double       precursorMass        = 300;

            //The below theoretical does not accurately represent B-Y ions
            double[]       sorted_theoretical_product_masses_for_this_peptide = new double[] { precursorMass + (2 * Constants.ProtonMass) - 275.1350, precursorMass + (2 * Constants.ProtonMass) - 258.127, precursorMass + (2 * Constants.ProtonMass) - 257.1244, 50, 60, 70, 147.0764, precursorMass + (2 * Constants.ProtonMass) - 147.0764, precursorMass + (2 * Constants.ProtonMass) - 70, precursorMass + (2 * Constants.ProtonMass) - 60, precursorMass + (2 * Constants.ProtonMass) - 50, 257.1244, 258.127, 275.1350 }; //{ 50, 60, 70, 147.0764, 257.1244, 258.127, 275.1350 }
            List <Product> productsWithLocalizedMassDiff = new List <Product>();

            foreach (double d in sorted_theoretical_product_masses_for_this_peptide)
            {
                productsWithLocalizedMassDiff.Add(new Product(ProductType.b, FragmentationTerminus.Both, d, 1, 1, 0));
            }
            CommonParameters commonParametersNoComp = new CommonParameters {
                ProductMassTolerance = new AbsoluteTolerance(0.01)
            };
            CommonParameters commonParametersWithComp = new CommonParameters(productMassTolerance: new AbsoluteTolerance(0.01), addCompIons: true);

            MsDataScan scan         = t.GetOneBasedScan(2);
            var        scanWithMass = new Ms2ScanWithSpecificMass(scan, precursorMass.ToMz(1), 1, "", new CommonParameters());
            List <MatchedFragmentIon> matchedIons = MetaMorpheusEngine.MatchFragmentIons(scanWithMass, productsWithLocalizedMassDiff, commonParametersNoComp);

            List <MatchedFragmentIon> matchedCompIons = MetaMorpheusEngine.MatchFragmentIons(scanWithMass, productsWithLocalizedMassDiff, commonParametersWithComp);

            matchedCompIons.AddRange(matchedIons);

            // score when the mass-diff is on this residue
            double localizedScore = MetaMorpheusEngine.CalculatePeptideScore(scan, matchedIons);
            double scoreNormal    = MetaMorpheusEngine.CalculatePeptideScore(scan, matchedIons);
            double scoreComp      = MetaMorpheusEngine.CalculatePeptideScore(scan, matchedCompIons);

            Assert.IsTrue(scoreNormal * 2 == scoreComp && scoreComp > scoreNormal + 1);
        }
Esempio n. 2
0
        public static void TestCompIons_MatchIonsScore()
        {
            TestDataFile t = new TestDataFile();
            Tolerance    productMassTolerance = new AbsoluteTolerance(0.01);
            double       precursorMass        = 300;

            //The below theoretical does not accurately represent B-Y ions
            double[]           sorted_theoretical_product_masses_for_this_peptide = new double[] { precursorMass + (2 * Constants.protonMass) - 275.1350, precursorMass + (2 * Constants.protonMass) - 258.127, precursorMass + (2 * Constants.protonMass) - 257.1244, 50, 60, 70, 147.0764, precursorMass + (2 * Constants.protonMass) - 147.0764, precursorMass + (2 * Constants.protonMass) - 70, precursorMass + (2 * Constants.protonMass) - 60, precursorMass + (2 * Constants.protonMass) - 50, 257.1244, 258.127, 275.1350 }; //{ 50, 60, 70, 147.0764, 257.1244, 258.127, 275.1350 }
            List <ProductType> lp = new List <ProductType> {
                ProductType.B, ProductType.Y
            };
            double scoreT = MetaMorpheusEngine.CalculatePeptideScore(t.GetOneBasedScan(2), productMassTolerance, sorted_theoretical_product_masses_for_this_peptide, precursorMass, new List <DissociationType> {
                DissociationType.HCD
            }, true, 0);
            double scoreF = MetaMorpheusEngine.CalculatePeptideScore(t.GetOneBasedScan(2), productMassTolerance, sorted_theoretical_product_masses_for_this_peptide, precursorMass, new List <DissociationType> {
                DissociationType.HCD
            }, false, 0);

            Assert.IsTrue(scoreT == scoreF * 2 && scoreT > scoreF + 1);
        }
Esempio n. 3
0
        public static Tuple <int, double, double>[] MatchBestGlycan(Ms2ScanWithSpecificMass theScan, Glycan[] glycans, CommonParameters commonParameters)
        {
            Tuple <int, double, double>[] tuples = new Tuple <int, double, double> [glycans.Length]; //Tuple<id, Yion matched score, glycan mass>
            //TO DO: Parallel this?
            for (int i = 0; i < glycans.Length; i++)
            {
                if (theScan.PrecursorMass - (double)glycans[i].Mass / 1E5 < 350) //Filter large glycans
                {
                    continue;
                }
                List <Product>            YIons = GetGlycanYIons(theScan.PrecursorMass, glycans[i]);
                List <MatchedFragmentIon> matchedFragmentIons = MetaMorpheusEngine.MatchFragmentIons(theScan, YIons, commonParameters);
                if (ScanTrimannosylCoreFilter(matchedFragmentIons, glycans[i]))
                {
                    var score = MetaMorpheusEngine.CalculatePeptideScore(theScan.TheScan, matchedFragmentIons);
                    tuples[i] = new Tuple <int, double, double>(i, score, (double)glycans[i].Mass / 1E5);
                }
            }

            return(tuples);
        }