protected bool Criteria(IGlycan glycan)
 {
     int[] composition = glycan.GetStructure();
     return(composition[0] <= HexNAcBound && composition[1] <= HexBound &&
            composition[2] <= FucBound && composition[3] <= NeuAcBound &&
            composition[4] <= NeuGcBound);
 }
        public IGlycoPeptideProxy Generate(IGlycan glycan, IPeptide peptide, int modifySite)
        {
            if (glycan is ITableNGlycanMassProxy)
            {
                IGlycoPeptide          glycoPeptide          = new GeneralGlycoPeptide(glycan, peptide, modifySite);
                IGlycoPeptideMassProxy glycoPeptideMassProxy = new GeneralGlycoPeptideMassProxy(glycoPeptide);
                foreach (double glycanMass in (glycan as ITableNGlycanMassProxy).GetMass())
                {
                    glycoPeptideMassProxy.AddMass(glycanMass +
                                                  PeptideCalcMass.Instance.Compute(glycoPeptide.GetPeptide()), MassType.Branch);
                }

                foreach (double glycanMass in (glycan as ITableNGlycanMassProxy).GetCoreMass())
                {
                    glycoPeptideMassProxy.AddMass(glycanMass +
                                                  PeptideCalcMass.Instance.Compute(glycoPeptide.GetPeptide()), MassType.Core);
                }

                glycoPeptideMassProxy.AddRangeMass(SingaturePeakCalcMass.Instance.ComputeComplex(glycan), MassType.Glycan);

                double mass = GlycanCalcMass.Instance.Compute(glycan);
                foreach (double peptideMass in PTMPeptideCalcMass.Compute(peptide.GetSequence(), modifySite))
                {
                    glycoPeptideMassProxy.AddMass(mass + peptideMass, MassType.Peptide);
                }



                return(glycoPeptideMassProxy);
            }
            else
            {
                throw new InvalidCastException("Can not cast to ITableNGlycanMassProxy");
            }
        }
Пример #3
0
 public double Compute(IGlycan glycan)
 {
     if (permethylation)
     {
         return(PermethylatedGlycanMass(glycan));
     }
     return(NativeGlycanMass(glycan));
 }
Пример #4
0
 public double Compute(IGlycan glycan)
 {
     if (permethylation)
     {
         return(CalcPermGlycanMass(glycan));
     }
     return(CalcSingleGlycanMass(glycan));
 }
Пример #5
0
 public double CalcGlycanMass(IGlycan glycan, ICalcMassOption option)
 {
     if (option.ExistsPermethylation())
     {
         return(CalcPermGlycanMass(glycan, option));
     }
     return(CalcSingleGlycanMass(glycan, option));
 }
Пример #6
0
        public NGlycanPeak(bool permethylated = true, int HexNAc = 2, int Hex = 3,
                           int Fuc            = 0, int NeuAc = 0, int NeuGc = 0)
        {
            glycan  = new NGlycan(permethylated, HexNAc, Hex, Fuc, NeuAc, NeuGc);
            distrib = Brain.Run.Distribute(glycan.Formula(), order);
            int extra = distrib.IndexOf(distrib.Max());

            peak = glycan.Mass() + neutron * extra;
        }
Пример #7
0
        public double Compute(IGlycan glycan, IonType type)
        {
            double mass = GlycanCalcMass.Instance.Compute(glycan);

            switch (type)
            {
            case IonType.yIon:
                break;
            }
            return(mass);
        }
Пример #8
0
        public List <IGlycoPeptide> Create(IGlycan glycan, IPeptide peptide)
        {
            List <IGlycoPeptide> glycoPeptides = new List <IGlycoPeptide>();

            foreach (int pos in FindPTMPosition.FindNGlycanSite(peptide.GetSequence()))
            {
                glycoPeptides.Add(new GeneralGlycoPeptide(peptide, glycan, pos));
            }

            return(glycoPeptides);
        }
Пример #9
0
        GenerateNewGlycoPeptide(IPeptide peptide, IGlycan glycan)
        {
            List <IAccumulatedGlycoPeptideMassProxy> glycos = new List <IAccumulatedGlycoPeptideMassProxy>();

            foreach (int pos in FindPTMPosition.FindNGlycanSite(peptide.GetSequence()))
            {
                SpecialGlycoPeptide <IAccumulatedGlycanMassProxy> g =
                    new SpecialGlycoPeptide <IAccumulatedGlycanMassProxy>(peptide, glycan as IAccumulatedGlycanMassProxy, pos);
                glycos.Add(new GeneralAccumulatedGlycoPeptideMassProxy(g));
            }
            return(glycos);
        }
        public List <double> ComputeComplex(IGlycan glycan)
        {
            List <double> massList = new List <double>();
            ITableNGlycan nglycan  = glycan as ITableNGlycan;

            int[] table = nglycan.GetNGlycanTable();

            double mass = table[4] * HexNAc + table[8] * Hex + table[12] * Fuc + table[16] * NeuAc + table[20] * NeuGc;

            massList.Add(mass);
            massList.Add(mass + Hex);
            massList.Add(mass + Hex * 2);
            massList.Add(mass + Hex * 2 + HexNAc);
            massList.Add(mass + Hex * 2 + HexNAc * 2);
            return(massList);
        }
        public List <IGlycoPeptide> Create(IGlycan glycan, IPeptide peptide)
        {
            List <IGlycoPeptide> glycoPeptides = new List <IGlycoPeptide>();

            foreach (int pos in FindPTMPosition.FindNGlycanSite(peptide.GetSequence()))
            {
                try
                {
                    IGlycoPeptideProxy glycoPeptideProxy = generator.Generate(glycan, peptide, pos);
                    glycoPeptides.Add(glycoPeptideProxy);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            return(glycoPeptides);
        }
Пример #12
0
        bool Satisify(string identified_glycan_id, IGlycan glycan)
        {
            int[] identified_glycan_table = glycans_map_[identified_glycan_id].Table();
            int[] candidate_glycan_table  = glycan.Table();
            if (identified_glycan_table.Count() != candidate_glycan_table.Count())
            {
                return(false);
            }
            for (int i = 0; i < identified_glycan_table.Length; i++)
            {
                if (candidate_glycan_table[i] < identified_glycan_table[i])
                {
                    return(false);
                }
            }

            // check terminal
            if (identified_glycan_table.Count() == 24)
            {
                for (int i = 0; i < 4; i++)
                {
                    if ((identified_glycan_table[12 + i] > 0 || identified_glycan_table[16 + i] > 0
                         ) && identified_glycan_table[4 + i] != candidate_glycan_table[4 + i])
                    {
                        return(false);
                    }
                }
            }
            else if (identified_glycan_table.Count() == 16)
            {
                for (int i = 0; i < 2; i++)
                {
                    if ((identified_glycan_table[10 + i] > 0 || identified_glycan_table[12 + i] > 0
                         ) && identified_glycan_table[6 + i] != candidate_glycan_table[6 + i])
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Пример #13
0
        bool SatisfyCriteria(IGlycan glycan)
        {
            int hexNAc = 0, hex = 0, fuc = 0, neuAc = 0, neuGc = 0;
            SortedDictionary <Monosaccharide, int> composite = glycan.Composition();

            foreach (var key in composite.Keys)
            {
                switch (key)
                {
                case Monosaccharide.GlcNAc:
                    hexNAc += composite[key];
                    break;

                case Monosaccharide.Gal:
                    hex += composite[key];
                    break;

                case Monosaccharide.Man:
                    hex += composite[key];
                    break;

                case Monosaccharide.Fuc:
                    fuc += composite[key];
                    break;

                case Monosaccharide.NeuAc:
                    neuAc += composite[key];
                    break;

                case Monosaccharide.NeuGc:
                    neuGc += composite[key];
                    break;

                default:
                    break;
                }
            }
            return(hexNAc <= hexNAc_ && hex <= hex_ && fuc <= fuc_ &&
                   neuAc <= neuAc_ && neuGc <= neuGc_);
        }
Пример #14
0
        private double PermethylatedGlycanMass(IGlycan glycan)
        {
            double mass = 0;
            SortedDictionary <Monosaccharide, int> composite = glycan.Composition();

            foreach (var monosaccharide in composite.Keys)
            {
                switch (monosaccharide)
                {
                case Monosaccharide.GlcNAc:
                    mass += kPermHexNAc * composite[monosaccharide];
                    break;

                case Monosaccharide.Gal:
                    mass += kPermHex * composite[monosaccharide];
                    break;

                case Monosaccharide.Man:
                    mass += kPermHex * composite[monosaccharide];
                    break;

                case Monosaccharide.Fuc:
                    mass += kPermFuc * composite[monosaccharide];
                    break;

                case Monosaccharide.NeuAc:
                    mass += kPermNeuAc * composite[monosaccharide];
                    break;

                case Monosaccharide.NeuGc:
                    mass += kPermNeuGc * composite[monosaccharide];
                    break;

                default:
                    break;
                }
            }
            return(mass);
        }
Пример #15
0
 protected abstract List <T> GenerateNewGlycoPeptide(IPeptide peptide, IGlycan glycan);
Пример #16
0
 private double CalcPermGlycanMass(IGlycan glycan)
 {
     int[] compos = glycan.GetStructure();
     return(compos[0] * PermHexNAc + compos[1] * PermHex +
            compos[2] * PermFuc + compos[3] * PermNeuAc + compos[4] * PermNeuGc);
 }
Пример #17
0
 private double CalcSingleGlycanMass(IGlycan glycan)
 {
     int[] compos = glycan.GetStructure();
     return(compos[0] * HexNAc + compos[1] * Hex +
            compos[2] * Fuc + compos[3] * NeuAc + compos[4] * NeuGc);
 }
        protected override List <IGlycoPeptide> GenerateNewGlycoPeptide(IPeptide peptide, IGlycan glycan)
        {
            List <IGlycoPeptide> glycos = new List <IGlycoPeptide>();

            glycos.Add(new GeneralGlycoPeptide(peptide, glycan, -1));
            return(glycos);
        }
Пример #19
0
 public GlycoPeptideTemplate(IPeptide peptide, IGlycan glycan, int pos)
 {
     this.peptide  = peptide;
     this.glycan   = glycan;
     this.position = pos;
 }
Пример #20
0
 public GeneralGlycanMassProxy(IGlycan glycan)
 {
     this.glycan = glycan;
 }
Пример #21
0
        public void Build()
        {
            Queue <IGlycan> queue = new Queue <IGlycan>();
            IGlycan         root;

            if (ComplexInclude)
            {
                root = new NGlycanComplex();
                queue.Enqueue(root);
            }

            if (HybridInclude)
            {
                root = new NGlycanHybrid();
                queue.Enqueue(root);
            }

            if (HighMannoseInclude)
            {
                root = new NHighMannose();
                queue.Enqueue(root);
            }

            while (queue.Count > 0)
            {
                IGlycan node = queue.Peek();
                queue.Dequeue();

                // update table id
                double mass     = util.mass.Glycan.To.Compute(node);
                string table_id = node.ID();
                node.SetMass(mass);
                if (!glycans_.ContainsKey(mass))
                {
                    glycans_[mass] = new List <string>();
                }
                glycans_[mass].Add(table_id);

                // next
                foreach (var it in candidates_)
                {
                    List <IGlycan> res = node.Grow(it);

                    foreach (var g in res)
                    {
                        if (SatisfyCriteria(g))
                        {
                            string id = g.ID();
                            if (!glycans_map_.ContainsKey(id))
                            {
                                node.Add(g);
                                glycans_map_[id] = g;
                                queue.Enqueue(glycans_map_[id]);
                            }
                            else
                            {
                                node.Add(glycans_map_[id]);
                            }
                        }
                    }
                }
            }
        }
Пример #22
0
        List <PeakNode> DynamicProgramming(List <IPeak> peaks,
                                           Dictionary <double, PeakNode> peak_nodes_map, PriorityQueue <PeakNode> queue)
        {
            List <PeakNode> matched_nodes = new List <PeakNode>();

            while (queue.Count > 0)
            {
                // get node
                PeakNode node = queue.Dequeue();

                // // match peaks
                double     target  = node.Mass();
                List <int> matched = searcher_.Search(target);

                // max if matched a peak
                node.Max(peaks);

                // update matches
                if (matched.Count > 0)
                {
                    node.Add(matched);
                    node.set_miss(0);
                    matched_nodes.Add(node);
                }

                if (node.Missing() > kMissing)
                {
                    continue;
                }

                // extending queue
                Dictionary <string, Dictionary <string, HashSet <int> > > peakMatch = node.Matches();
                foreach (var peptide in peakMatch.Keys.ToList())
                {
                    foreach (var glycan_id in peakMatch[peptide].Keys.ToList())
                    {
                        List <int> peak_indexes = peakMatch[peptide][glycan_id].ToList();

                        IGlycan glycan = glycans_map_[glycan_id];
                        foreach (var g in glycan.Children())
                        {
                            double mass = g.Mass() + util.mass.Peptide.To.Compute(peptide);
                            if (!peak_nodes_map.ContainsKey(mass))
                            {
                                PeakNode next = new PeakNode();
                                // set mass
                                next.set_mass(mass);
                                // set matches
                                next.Add(peptide, g.ID(), peak_indexes);
                                // set missing
                                next.set_miss(node.Missing() + 1);
                                // add node
                                peak_nodes_map[mass] = next;
                                // enqueue
                                queue.Enqueue(mass, peak_nodes_map[mass]);
                            }
                            else
                            {
                                // std::cout << "here" << std::endl;
                                PeakNode next = peak_nodes_map[mass];
                                // set missing
                                next.set_miss(Math.Min(next.Missing(), node.Missing() + 1));
                                // set matches
                                next.Add(peptide, g.ID(), peak_indexes);
                            }
                        }
                    }
                }
            }
            return(matched_nodes);
        }
 public void SetGlycan(IGlycan glycan)
 {
     glycoPeptide.SetGlycan(glycan);
 }
Пример #24
0
 public GeneralGlycoPeptide(IPeptide peptide, IGlycan glycan, int pos)
 {
     this.peptide  = peptide;
     this.glycan   = glycan;
     this.position = pos;
 }
Пример #25
0
 public double CalcGlycanYIonMass(IGlycan glycan, ICalcMassOption option)
 {
     return(CalcGlycanMass(glycan, option) + Oxygen + Hydrogen * 2);
 }
Пример #26
0
 public void AddGlycoPeptide(IPeptide peptide, IGlycan glycan, int pos)
 {
     glycoPeptides.Add(new GeneralGlycoPeptide(peptide, glycan, pos));
 }
Пример #27
0
 public void Add(IGlycan glycan)
 {
     glycans.Add(glycan);
 }
Пример #28
0
 protected double CalcPermGlycanMass(IGlycan glycan, ICalcMassOption option)
 {
     int[] compos = glycan.GetStructure();
     return(compos[0] * PermHexNAc + compos[1] * PermHex +
            compos[2] * PermFuc + compos[3] * PermNeuAc + compos[4] * PermNeuGc);
 }
Пример #29
0
 public void SetGlycan(IGlycan glycan)
 {
     this.glycan = (T)glycan;
 }
Пример #30
0
 public GlycanPoint(IGlycan glycan)
 {
     this.glycan = glycan;
     mass        = GlycanCalcMass.Instance.Compute(glycan);
 }