Ejemplo n.º 1
0
        // peptide seq, glycan*
        public Dictionary <string, HashSet <int> > Search(List <IPeak> peaks, int max_charge,
                                                          Dictionary <string, List <model.glycan.IGlycan> > candidate)
        {
            InitSearch(candidate);
            Dictionary <string, HashSet <int> > results = new Dictionary <string, HashSet <int> >();

            // search peaks
            for (int i = 0; i < peaks.Count; i++)
            {
                IPeak peak = peaks[i];
                for (int charge = 1; charge < max_charge; charge++)
                {
                    double        target          = util.mass.Spectrum.To.Compute(peak.GetMZ(), charge);
                    List <string> glyco_sequences = searcher_.Search(target);
                    foreach (string seq in glyco_sequences)
                    {
                        if (!results.ContainsKey(seq))
                        {
                            results[seq] = new HashSet <int>();
                        }
                        results[seq].Add(i);
                    }
                }
            }
            return(results);
        }
Ejemplo n.º 2
0
        public Dictionary <string, List <model.glycan.IGlycan> > Match(double precursor, int charge)
        {
            Dictionary <string, List <model.glycan.IGlycan> > results =
                new Dictionary <string, List <model.glycan.IGlycan> >();
            double mass = util.mass.Spectrum.To.Compute(precursor, charge);

            foreach (var glycan in glycans_)
            {
                double target = mass - glycan.Mass();
                if (target <= 0)
                {
                    continue;
                }

                List <string> peptides = searcher_.Search(target, mass);
                if (peptides_.Count == 0)
                {
                    continue;
                }

                // check pentacore
                var composition = glycan.Composition();
                if (!composition.ContainsKey(model.glycan.Monosaccharide.GlcNAc) ||
                    composition[model.glycan.Monosaccharide.GlcNAc] < 3)
                {
                    continue;
                }

                foreach (var seq in peptides)
                {
                    if (!results.ContainsKey(seq))
                    {
                        results[seq] = new List <model.glycan.IGlycan>();
                    }
                    results[seq].Add(glycan);
                }
            }
            return(results);
        }