Exemplo n.º 1
0
        public PrecursorMatcherByBinSearchOnGlycansTemplate(List <IPeptide> peptides, List <IGlycan> glycans, double tol)
        {
            matcher   = new BinarySearch();
            parameter = new PrecursorParameter(tol);

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


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

            foreach (IGlycan glycan in glycans)
            {
                double mass = calculator.CalcGlycanMass(glycan, option);
                if (!seen.ContainsKey(mass))
                {
                    PrecursorPoint <IGlycan> pt = new PrecursorPoint <IGlycan>(mass);
                    seen[mass] = pt;
                    glycanPoints.Add(pt);
                }
                seen[mass].Add(glycan);
            }
            matcher.SetPoints(glycanPoints);
        }
        protected void MatchPrecursorMass(double precusorMass, List <T> glycoPeptides)
        {
            HashSet <string> seen    = new HashSet <string>();
            List <Point>     matches = new List <Point>();

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

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

                matches.Clear();
                seen.Clear();
            }
        }
Exemplo n.º 3
0
 public TableNGlycanAccumulatedGlycanMassProxy(ITableNGlycan glycan)
 {
     this.glycan = glycan;
     calculator  = UtilMass.Instance;
     option      = UtilMassOption.Instance;
     massTable   = new HashSet <double>();
     massTable.Add(calculator.CalcGlycanMass(glycan, option));
 }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
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();
        }
        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);
        }