public List <IPeptide> PeptidesFilter(ISpectrum spectrum)
        {
            List <IPeptide> peptides     = new List <IPeptide>();
            List <double>   massList     = new List <double>();
            int             parentCharge = (spectrum as ISpectrumMSn).GetParentCharge();

            for (int i = 1; i <= parentCharge; i++)
            {
                foreach (IPeak peak in spectrum.GetPeaks())
                {
                    massList.Add(calcualtor.CalcChargeMass(peak.GetMZ(), i, option));
                }
            }
            if (massList.Count > 0)
            {
                massList.Sort();
            }

            foreach (IPeptide peptide in peptideDB)
            {
                double mass = calcualtor.CalcPeptideMass(peptide, option) + UtilMass.HexNAc;
                if (MassBinarySearch.FindPPM(mass, massList, matcher.GetTolerance()))
                {
                    peptides.Add(peptide);
                }
            }

            return(peptides);
        }
        public PrecursorMatcherByBinSearchOnPeptidesTemplate(List <IPeptide> peptides, List <IGlycan> glycans, double tol)
        {
            matcher   = new BinarySearch();
            parameter = new PrecursorParameter(tol);

            peptidePoints = new List <Point>();
            calculator    = UtilMass.Instance;
            option        = UtilMassOption.Instance;
            this.glycans  = glycans;


            // build points on peptides
            Dictionary <double, PrecursorPoint <IPeptide> > seen = new Dictionary <double, PrecursorPoint <IPeptide> >();

            foreach (IPeptide peptide in peptides)
            {
                double mass = calculator.CalcPeptideMass(peptide, option);
                if (!seen.ContainsKey(mass))
                {
                    PrecursorPoint <IPeptide> pt = new PrecursorPoint <IPeptide>(mass);
                    seen[mass] = pt;
                    peptidePoints.Add(pt);
                }
                seen[mass].Add(peptide);
            }
            matcher.SetPoints(peptidePoints);
        }
예제 #3
0
 public NGlycoPeptideNode(ITableNGlycan nGlycan, IPeptide peptide, IScore score)
 {
     glycan       = nGlycan.TableClone();
     this.peptide = peptide.Clone();
     this.score   = score.Clone();
     calculator   = UtilMass.Instance;
     option       = UtilMassOption.Instance;
     mass         = calculator.CalcGlycanMass(glycan, option) + calculator.CalcPeptideMass(peptide, option);
 }
예제 #4
0
        public void Run()
        {
            //AccumulatedStructBruteForceNGlycanCreator creator = new AccumulatedStructBruteForceNGlycanCreator();
            //creator.Generate();


            ////http://db.systemsbiology.net:8080/proteomicsToolkit/FragIonServlet.html
            IPeptide peptide = new GeneralPeptide("test", "VVLHPNYSQVD");
            //IPeptide peptide = new GeneralPeptide("test", "SRNLTK");
            //IPeptide peptide = new GeneralPeptide("test", "LCPDCPLLAPLNDSR");
            ICalcMass       calculator = UtilMass.Instance;
            ICalcMassOption option     = UtilMassOption.Instance;



            //double mass =  calculator.CalcPeptideMass(peptide, option); //1154.63213937
            //
            //double mass = calculator.CalcPeptideMass(peptide, option);
            //double mass = calculator.CalcPeptideIonMass("CHS", IonType.xIon, option);
            //Console.WriteLine(mass);
            //double mass = calculator.CalcPeptideIonMass("VVLHPNYSQV", IonType.cIon, option);
            //Console.WriteLine(mass);
            //mass = calculator.CalcPeptideIonMass("CHS", IonType.zIon, option);
            //Console.WriteLine(mass);

            //IGlycan glycan = new GeneralGlycan(6, 7, 2, 3, 0);



            IGlycan glycan = new GeneralGlycan(1, 0, 0, 0, 0);
            //option.SetPermethylation(true);

            double mass = calculator.CalcPeptideMass(peptide, option);

            mass += calculator.CalcGlycanMass(glycan, option);
            //mass = calculator.CalcGlycanYIonMass(glycan, option);
            //peptide = new GeneralPeptide("1", "EPTIDE");
            //mass = calculator.CalcPeptideIonMass(peptide, IonType.xIon, option);
            //Console.WriteLine((mass+Hydrogen)/1);

            //peptide = new GeneralPeptide("1", "TIDE");
            //mass = calculator.CalcPeptideIonMass(peptide, IonType.xIon, option);
            //Console.WriteLine((mass+Hydrogen)/1);
            //2322.82285937

            Console.WriteLine(mass);
            Console.WriteLine(mass / 1.0 + Hydrogen);
            //Console.WriteLine(calculator.CalcPPM(mass, 329.09256));

            Console.Read();
        }
        public void SetPeptides(List <IPeptide> peptides)
        {
            // build points on peptides
            Dictionary <double, PrecursorPoint <IPeptide> > seen = new Dictionary <double, PrecursorPoint <IPeptide> >();

            foreach (IPeptide peptide in peptides)
            {
                double mass = calculator.CalcPeptideMass(peptide, option);
                if (!seen.ContainsKey(mass))
                {
                    PrecursorPoint <IPeptide> pt = new PrecursorPoint <IPeptide>(mass);
                    seen[mass] = pt;
                    peptidePoints.Add(pt);
                }
                seen[mass].Add(peptide);
            }
            matcher.SetPoints(peptidePoints);
        }
예제 #6
0
        protected void MatchPrecursorMass(double precusorMass, List <T> glycoPeptides)
        {
            HashSet <string> seen    = new HashSet <string>();
            List <Point>     matches = new List <Point>();

            foreach (IPeptide peptide in peptides)
            {
                //search on glycans for a peptide
                double target = precusorMass - calculator.CalcPeptideMass(peptide, option);
                if (target <= 0)
                {
                    continue;
                }
                PrecursorPoint <IGlycan> p = new PrecursorPoint <IGlycan>(target);
                matches.AddRange(matcher.GetSearchResult(p, parameter));

                //build glycopeptide
                foreach (Point pt in matches)
                {
                    foreach (IGlycan glycan in (pt as PrecursorPoint <IGlycan>).GetObjects())
                    {
                        //check redundant
                        string s = glycan.GetName();
                        if (!seen.Contains(s))
                        {
                            //Console.WriteLine(glycan.GetName());
                            //Console.WriteLine(peptide.GetSequence());
                            glycoPeptides.AddRange(GenerateNewGlycoPeptide(peptide, glycan));
                            seen.Add(s);
                        }
                    }
                }

                matches.Clear();
                seen.Clear();
            }
        }
        public GeneralAccumulatedGlycoPeptideMassProxy(
            SpecialGlycoPeptide <IAccumulatedGlycanMassProxy> glycoPeptide)
        {
            calculator = UtilMass.Instance;
            option     = UtilMassOption.Instance;
            mass       = new HashSet <double>();


            this.glycoPeptide = glycoPeptide;
            foreach (double glycanMass in (glycoPeptide.GetGlycan()
                                           as IAccumulatedGlycanMassProxy).GetMass())
            {
                foreach (double peptideMass in CalcPTMPeptideMass.GetNGlycanPeptideMass(
                             GetPeptide().GetSequence(), GetPosition()))
                {
                    mass.Add(glycanMass + peptideMass);
                }
                mass.Add(glycanMass + calculator.CalcPeptideMass(glycoPeptide.GetPeptide(), option));
            }

            mass.UnionWith(CalcPTMPeptideMass.GetNonGlycanPeptideMass(GetPeptide().GetSequence(), GetPosition()));
            massList = mass.ToList();
            massList.Sort();
        }
        protected void InitMatcher(IGlycoPeptide glycoPeptide)
        {
            List <Point>         points  = new List <Point>();
            List <ITableNGlycan> glycans = glycansTable[
                glycoPeptide.GetGlycan().GetName()];
            IPeptide peptide = glycoPeptide.GetPeptide();
            string   seq     = peptide.GetSequence();
            int      pos     = glycoPeptide.GetPosition();
            Dictionary <double, BinSearchAnnotatedPoint> seen =
                new Dictionary <double, BinSearchAnnotatedPoint>();

            //glycanfrag
            foreach (ITableNGlycan g in glycans)
            {
                double glycanMass = calculator.CalcGlycanMass(g, option);
                double mass       = calculator.CalcPeptideMass(seq, option) + glycanMass;
                if (!seen.ContainsKey(mass))
                {
                    BinSearchAnnotatedPoint p = new BinSearchAnnotatedPoint(mass);
                    seen[mass] = p;
                    points.Add(p);
                }
                seen[mass].AddGlycoPeptide(
                    new GeneralPeptide(peptide.GetID(), seq), g, pos);


                //n-peptidefrag
                for (int i = 0; i < pos; i++)
                {
                    mass = calculator.CalcPeptideIonMass(
                        seq.Substring(0, i + 1), IonType.cIon, option) + glycanMass;
                    if (!seen.ContainsKey(mass))
                    {
                        BinSearchAnnotatedPoint p = new BinSearchAnnotatedPoint(mass);
                        seen[mass] = p;
                        points.Add(p);
                    }

                    seen[mass].AddGlycoPeptide(
                        new GeneralPeptide(peptide.GetID(), seq.Substring(0, i + 1)),
                        g, pos);
                }
                //c-peptidefrag
                for (int i = pos + 1; i < seq.Length; i++)
                {
                    mass = calculator.CalcPeptideIonMass(
                        seq.Substring(i, seq.Length - i), IonType.zIon, option) + glycanMass;
                    if (!seen.ContainsKey(mass))
                    {
                        BinSearchAnnotatedPoint p = new BinSearchAnnotatedPoint(mass);
                        seen[mass] = p;
                        points.Add(p);
                    }

                    seen[mass].AddGlycoPeptide(
                        new GeneralPeptide(peptide.GetID(), seq.Substring(i, seq.Length - i)),
                        g, pos);
                }
            }
            points.Sort();
            matcher.SetPoints(points);
        }