Exemplo n.º 1
0
        public void ProduceResult(IDataPoints data, ISpectrum spectrum, IGlycoPeptide glycoPeptide)
        {
            ITableNGlycan glycan                      = glycoPeptide.GetGlycan() as ITableNGlycan;
            Dictionary <string, IPeak> peaks          = new Dictionary <string, IPeak>();
            List <IAnnotatedPeak>      annotatedPeaks = new List <IAnnotatedPeak>();

            foreach (PeakPoint pt in data.GetPoints())
            {
                if (!peaks.ContainsKey(pt.GetID()))
                {
                    double mass = Double.Parse(pt.GetID());
                    peaks[pt.GetID()] = new GeneralPeak(mass, pt.GetIntensity());
                }

                List <IGlycoPeptide> glycoPeptides = new List <IGlycoPeptide>();

                foreach (NGlycoPeptideNode node in pt.GetMaxNode())
                {
                    if (IsGlycanMatch(node.GetNGlycan(), glycan))
                    {
                        glycoPeptides.Add(new GeneralGlycoPeptide(node.GetPeptide(), node.GetNGlycan(), -1));
                    }
                }

                if (glycoPeptides.Count > 0)
                {
                    IAnnotatedPeak p = new GeneralAnnotatedSpectrumPeak(peaks[pt.GetID()], glycoPeptides);
                    annotatedPeaks.Add(p);
                }
            }

            result = new GeneralAnnotatedSpectrumPeakResultProduct(spectrum,
                                                                   annotatedPeaks.OrderBy(x => x.GetMZ()).ToList());
        }
Exemplo n.º 2
0
        public void Annotate(ISpectrum spectrum, IGlycoPeptide glycoPeptide)
        {
            List <INode> roots = InitRoot(glycoPeptide);
            IDataPoints  data  = InitSpectrum(spectrum);

            dp.Search(roots, data, parameter as DPSpectrumCIDParameter);
            ProduceResult(data, spectrum, glycoPeptide);
        }
        public void Annotate(ISpectrum spectrum, IGlycoPeptide glycoPeptide)
        {
            InitMatcher(glycoPeptide);

            List <IAnnotatedPeak> peaks = GenerateMatcherResult(spectrum);

            result = new GeneralAnnotatedSpectrumPeakResultProduct(spectrum, peaks);
        }
Exemplo n.º 4
0
        public VectorScore(IGlycoPeptide glycoPeptide, double alpha, double beta,
                           Dictionary <MassType, double> weights)
        {
            this.glycoPeptide = glycoPeptide;

            this.alpha   = alpha;
            this.beta    = beta;
            this.weights = weights;
            peakSet      = new HashSet <IPeak>();
            matches      = new Dictionary <MassType, List <IPeak> >();
        }
Exemplo n.º 5
0
        protected List <INode> InitRoot(IGlycoPeptide glycoPeptide)
        {
            List <INode> rootList = new List <INode>();

            foreach (ITableNGlycan g in CreateInitNGlycan.Creator.Create())
            {
                rootList.Add(new NGlycoPeptideNode(g, glycoPeptide.GetPeptide(), new PeakScore()));
            }

            return(rootList);
        }
Exemplo n.º 6
0
        public List <IPoint> Create(IGlycoPeptide glycoPeptide, MassType type)
        {
            List <IPoint> points = new List <IPoint>();

            foreach (double mass in (glycoPeptide as IGlycoPeptideMassProxy).GetMass(type))
            {
                points.Add(new GeneralPoint(mass));
            }

            return(points);
        }
Exemplo n.º 7
0
        public WeightedScore(IGlycoPeptide glycoPeptide,
                             double alpha, double beta, Dictionary <MassType, double> weights)
        {
            this.glycoPeptide = glycoPeptide;

            this.alpha = alpha;
            this.beta  = beta;

            peakInclude  = new HashSet <double>();
            theory       = new Dictionary <MassType, int>();
            matches      = new Dictionary <MassType, List <double> >();
            this.weights = weights;

            foreach (MassType type in weights.Keys)
            {
                theory[type] = (glycoPeptide as IGlycoPeptideMassProxy).GetMass(type).Count;
            }
        }
Exemplo n.º 8
0
        public void ReportLines(ISpectrum spectrum, List <IScore> scores)
        {
            HashSet <string> seen = new HashSet <string>();


            Tuple <List <double[]>, double[]> predict = Predicting(scores);
            int idx = 0;

            foreach (IScore score in scores)
            {
                if (0 >= 0)
                {
                    // get glycan
                    IGlycoPeptide glycoPeptide = score.GetGlycoPeptide();

                    // remove redudant
                    string structure = string.Join("_", glycoPeptide.GetGlycan().GetStructure());
                    string seq       = glycoPeptide.GetPeptide().GetSequence();
                    if (!seen.Contains(structure + seq))
                    {
                        seen.Add(structure + seq);
                    }
                    else
                    {
                        continue;
                    }

                    writer.Write(spectrum.GetScanNum().ToString() + ", ");
                    writer.Write(seq + ", ");
                    writer.Write(structure + ", ");
                    writer.Write(score.GetScore(MassType.Core).ToString() + ", ");
                    writer.Write(score.GetScore(MassType.Branch).ToString() + ", ");
                    writer.Write(score.GetScore(MassType.Glycan).ToString() + ", ");
                    writer.Write(score.GetScore(MassType.Peptide).ToString() + ", ");
                    writer.Write((spectrum as ISpectrumMSn).GetParentMZ().ToString() + ", ");
                    writer.Write((spectrum as ISpectrumMSn).GetParentCharge().ToString() + ", ");
                    writer.Write(string.Join(".", predict.Item1[idx]) + ", ");
                    writer.Write(predict.Item2[idx].ToString() + ", ");
                    writer.WriteLine();
                }
                idx++;
            }
        }
Exemplo n.º 9
0
        public void ReportLines(List <IProbScoreProxy> scores, double cutoff)
        {
            HashSet <string> seen = new HashSet <string>();


            int idx = 0;

            foreach (IProbScoreProxy score in scores)
            {
                if (score.GetProbability() > cutoff)
                {
                    // get glycan
                    IGlycoPeptide glycoPeptide = score.GetGlycoPeptide();

                    // remove redudant
                    string structure = string.Join("_", glycoPeptide.GetGlycan().GetStructure());
                    string seq       = glycoPeptide.GetPeptide().GetSequence();
                    if (!seen.Contains(structure + seq))
                    {
                        seen.Add(structure + seq);
                    }
                    else
                    {
                        continue;
                    }

                    writer.Write(score.GetSpectrum().GetScanNum().ToString() + ", ");
                    writer.Write(seq + ", ");
                    writer.Write(structure + ", ");
                    writer.Write(score.GetScore(MassType.Core).ToString() + ", ");
                    writer.Write(score.GetScore(MassType.Branch).ToString() + ", ");
                    writer.Write(score.GetScore(MassType.Glycan).ToString() + ", ");
                    writer.Write(score.GetScore(MassType.Peptide).ToString() + ", ");
                    writer.Write((score.GetSpectrum() as ISpectrumMSn).GetParentMZ().ToString() + ", ");
                    writer.Write((score.GetSpectrum() as ISpectrumMSn).GetParentCharge().ToString() + ", ");
                    writer.Write(score.GetProbability().ToString() + ", ");
                    writer.Write(cutoff + ", ");
                    writer.Write(score.IsDecoy() + ", ");
                    writer.WriteLine();
                }
                idx++;
            }
        }
Exemplo n.º 10
0
        protected void ReportLines(ISpectrum spectrum, List <IScore> scores, double cutoff)
        {
            HashSet <string> seen = new HashSet <string>();

            foreach (IScore score in scores)
            {
                if (score.GetScore() > cutoff)
                {
                    // get glycan
                    IGlycoPeptide glycoPeptide = score.GetGlycoPeptide();

                    // remove redudant
                    string structure = string.Join("_", glycoPeptide.GetGlycan().GetStructure());
                    string seq       = glycoPeptide.GetPeptide().GetSequence();
                    if (!seen.Contains(structure + seq))
                    {
                        seen.Add(structure + seq);
                    }
                    else
                    {
                        continue;
                    }

                    writer.Write(spectrum.GetScanNum().ToString() + ", ");
                    writer.Write(seq + ", ");
                    writer.Write(structure + ", ");
                    writer.Write(score.GetScore(MassType.Branch).ToString() + ", ");
                    writer.Write(score.GetScore(MassType.Core).ToString() + ", ");
                    writer.Write(score.GetScore(MassType.Glycan).ToString() + ", ");
                    writer.Write(score.GetScore(MassType.Peptide).ToString() + ", ");
                    writer.Write((spectrum as ISpectrumMSn).GetParentMZ().ToString() + ", ");
                    writer.Write((spectrum as ISpectrumMSn).GetParentCharge().ToString() + ", ");

                    if (score is IFDRScoreProxy)
                    {
                        writer.Write((score as IFDRScoreProxy).IsDecoy());
                        writer.Write(", ");
                    }
                    writer.WriteLine();
                }
            }
        }
Exemplo n.º 11
0
 public IScore CreateScore(IGlycoPeptide glycoPeptide)
 {
     return(new VectorScore(glycoPeptide, alpha, beta, weights));
 }
Exemplo n.º 12
0
 public GeneralGlycoPeptideMassProxy(IGlycoPeptide glycoPeptide) : base(glycoPeptide)
 {
     massTable = new Dictionary <MassType, HashSet <double> >();
 }
Exemplo n.º 13
0
 public GeneralGlycoPeptideScore(IGlycoPeptide glycoPeptide, double score) :
     base(glycoPeptide.GetPeptide(), glycoPeptide.GetGlycan(), glycoPeptide.GetPosition())
 {
     this.glycoPeptide = glycoPeptide;
     this.score        = score;
 }
 public GlycoPeptideProxyTemplate(IGlycoPeptide glycoPeptide)
 {
     this.glycoPeptide = glycoPeptide;
 }
        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);
        }
 public void AddFragment(IGlycoPeptide glycoPeptide)
 {
     glycoPeptides.Add(glycoPeptide);
 }