Example #1
0
        private void ListFragementStructure(GlycanStructure argStructure)
        {
            //dgDetail
            DataTable  dtDetail    = new DataTable();
            DataColumn dcID        = new DataColumn("ID", Type.GetType("System.Int32"));
            DataColumn dcMass      = new DataColumn("Mass", Type.GetType("System.Single"));
            DataColumn dcScore     = new DataColumn("Score", Type.GetType("System.Single"));
            DataColumn dcStructure = new DataColumn("Structure", typeof(Image));

            dtDetail.Columns.Add(dcID);
            dtDetail.Columns.Add(dcMass);
            dtDetail.Columns.Add(dcScore);
            dtDetail.Columns.Add(dcStructure);

            //dgDetail.DataSource = dtDetail;
            //dgDetail.Columns[0].Width = 30;
            //dgDetail.Columns[1].Width = 70;
            //dgDetail.Columns[2].Width = 50;
            //dgDetail.Columns[3].Width = 315;

            dtDetail.DefaultView.Sort = "Mass";
            int           idx        = 0;
            float         TotalScore = 0.0f;
            GlycansDrawer GDRaw;

            foreach (GlycanTreeNode frm in argStructure.TheoreticalFragment)
            {
                DataRow row = dtDetail.NewRow();
                row[0] = idx;
                float glycanmass = COL.GlycoLib.GlycanMass.GetGlycanMasswithCharge(frm.GlycanType, argStructure.Charge) + argStructure.Y1.Mass - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.HexNAc, argStructure.Charge);

                int closepeakidx = MassUtility.GetClosestMassIdx(scan.MSPeaks, glycanmass);
                row[1] = glycanmass;

                if (MassUtility.GetMassPPM(glycanmass, scan.MSPeaks[closepeakidx].MonoisotopicMZ) < _torelance)
                {
                    row[2] = scan.MSPeaks[closepeakidx].MonoIntensity / scan.MaxIntensity;
                }
                else
                {
                    row[2] = 0.0f;
                }
                GDRaw  = new GlycansDrawer(frm.GetIUPACString(), false);
                row[3] = GDRaw.GetImage();
                idx++;
                dtDetail.Rows.Add(row);
                TotalScore = TotalScore + Convert.ToSingle(row[2]);
            }

            DataRow dtrow = dtDetail.NewRow();

            dtrow[0] = idx;
            dtrow[1] = GlycanMass.GetGlycanMasswithCharge(argStructure.Root.GlycanType, argStructure.Charge) + argStructure.Y1.Mass - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.HexNAc, argStructure.Charge);
            dtrow[2] = TotalScore;
            GDRaw    = new GlycansDrawer(argStructure.IUPACString, false);
            dtrow[3] = GDRaw.GetImage();
            dtDetail.Rows.Add(dtrow);
        }
Example #2
0
        /// <summary>
        /// Scan No,Charge,Peptide Seq, MaxMz,Y1Mz,Y1Intensity,Y2Mz,Y2Intensity,Y3Mz,Y3Intensity,Y4Mz,Y4Intensity
        /// </summary>
        /// <returns></returns>
        public List <string> Process(int argMissCleavage)
        {
            List <string> result = new List <string>();
            AminoAcidMass AAMW   = new AminoAcidMass();

            foreach (ProteinInfo p in _pInfo)
            {
                p.CreateCleavage(argMissCleavage);
                List <string> Glycopeptide = p.Glycopeptide(0);
                foreach (string Pep in Glycopeptide)
                {
                    for (int i = 0; i <= 2; i++)
                    {
                        float        PeptideMass  = AAMW.GetMonoMW(Pep, true);
                        List <float> Peakmz       = GetPeakCluster(PeptideMass, _scan.ParentCharge - i);
                        List <int>   ClosePeakIdx = new List <int>();
                        int          foundpeak    = 0;
                        double       MaxIntensity = 0.0;
                        double       MaxMz        = 0.0;
                        foreach (float peak in Peakmz)
                        {
                            int closepeakidx = MassUtility.GetClosestMassIdx(_scan.MSPeaks, peak);
                            ClosePeakIdx.Add(closepeakidx);
                            if (MassUtility.GetMassPPM(peak, _scan.MSPeaks[closepeakidx].MonoMass) < _torelance)
                            {
                                if (_scan.MSPeaks[closepeakidx].MonoIntensity > MaxIntensity)
                                {
                                    MaxIntensity = _scan.MSPeaks[closepeakidx].MonoIntensity;
                                    MaxMz        = _scan.MSPeaks[closepeakidx].MonoMass;
                                }
                                foundpeak++;
                            }
                        }
                        if (foundpeak >= 3)
                        {
                            string tmp = _scan.ScanNo + "," + Convert.ToString(_scan.ParentCharge - i) + "," + Pep + "," + MaxMz.ToString() + ",";
                            for (int j = 0; j < 4; j++)
                            {
                                if (MassUtility.GetMassPPM(_scan.MSPeaks[ClosePeakIdx[j]].MonoMass, Peakmz[j]) < _torelance)
                                {
                                    tmp = tmp + _scan.MSPeaks[ClosePeakIdx[j]].MonoMass + "," + (_scan.MSPeaks[ClosePeakIdx[j]].MonoIntensity / MaxIntensity) + ",";
                                }
                                else
                                {
                                    tmp = tmp + ",,";
                                }
                            }
                            result.Add(tmp);
                        }
                    }
                }
            }
            return(result);
        }
Example #3
0
        public YxFinder(List <MSPeak> argSpectrum, float argY1, int argCharge, float argTolerance)
        {
            _y1      = argY1;
            _YxCount = 0;
            _charge  = argCharge;
            GeneratedYxPeak();
            _YxMzIdx = new float[5];
            for (int i = 0; i <= 4; i++)
            {
                _YxMzIdx[i] = -1;
            }

            for (int i = 1; i <= 4; i++)
            {
                int idx = MassUtility.GetClosestMassIdx(argSpectrum, _YxMz[i]);
                if (MassUtility.GetMassPPM(argSpectrum[idx].MonoMass, _YxMz[i]) < argTolerance)
                {
                    _YxMzIdx[i] = idx;
                    _YxCount++;
                }
            }
        }
Example #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     MassUtility.GetMassPPM(697.006653, 697.0557);
 }
Example #5
0
        private List<int> FindPeakIdx(float[] argMZAry, int argTargetIdx, int argCharge, float argPPM)
        {
            List<int> Peak = new List<int>();
            float Interval = 1 / (float)argCharge;
            float FirstMZ = argMZAry[argTargetIdx];
            int CurrentIdx = argTargetIdx;
            Peak.Add(argTargetIdx);
            //Forward  Peak
            for (int i = argTargetIdx - 1; i >= 0; i--)
            {
                if (argMZAry[argTargetIdx] - argMZAry[i] >= Interval * 10)
                {
                    break;
                }
                List<int> ClosedPeaks = MassUtility.GetClosestMassIdxsWithinPPM(argMZAry, argMZAry[CurrentIdx] - Interval, argPPM);
                if (ClosedPeaks.Count == 1)
                {
                    CurrentIdx = ClosedPeaks[0];
                    Peak.Insert(0, ClosedPeaks[0]);
                }
                else if (ClosedPeaks.Count > 1)
                {
                    double minPPM = 100;
                    int minPPMIdx = 0;
                    for (int j = 0; j < ClosedPeaks.Count; j++)
                    {
                        if (MassUtility.GetMassPPM(argMZAry[ClosedPeaks[j]], argMZAry[CurrentIdx] - Interval) < minPPM)
                        {
                            minPPMIdx = ClosedPeaks[j];
                            minPPM = MassUtility.GetMassPPM(argMZAry[ClosedPeaks[j]], argMZAry[CurrentIdx] + Interval);
                        }
                    }
                    CurrentIdx = minPPMIdx;
                    Peak.Insert(0, CurrentIdx);
                }
            }
            //Backward  Peak
            CurrentIdx = argTargetIdx;
            for (int i = argTargetIdx + 1; i < argMZAry.Length; i++)
            {
                if (argMZAry[i] - argMZAry[argTargetIdx] >= Interval * 10)
                {
                    break;
                }
                List<int> ClosedPeaks = MassUtility.GetClosestMassIdxsWithinPPM(argMZAry, argMZAry[CurrentIdx] + Interval, argPPM);
                if (ClosedPeaks.Count == 1)
                {
                    CurrentIdx = ClosedPeaks[0];
                    Peak.Add(ClosedPeaks[0]);
                }
                else if (ClosedPeaks.Count > 1)
                {
                    double minPPM = 100;
                    int minPPMIdx = 0;
                    for (int j = 0; j < ClosedPeaks.Count; j++)
                    {
                        if (MassUtility.GetMassPPM(argMZAry[ClosedPeaks[j]], argMZAry[CurrentIdx] + Interval) < minPPM)
                        {
                            minPPMIdx = ClosedPeaks[j];
                            minPPM = MassUtility.GetMassPPM(argMZAry[ClosedPeaks[j]], argMZAry[CurrentIdx] + Interval);
                        }
                    }
                    CurrentIdx = minPPMIdx;
                    Peak.Add(CurrentIdx);
                }
            }

            return Peak;
        }
        public static void Processing(ref MultiGlycanESI argMultiGlycan)
        {
            try
            {
                List <string> identifiedGlycan = argMultiGlycan.IdentifiedGlycanCompounds.Select(x => x.GlycanKey).Distinct().ToList();
                Dictionary <string, List <int> > dictGlycanKeySearchRange = new Dictionary <string, List <int> >();


                int LastScan = argMultiGlycan.RawReader.NumberOfScans;
                foreach (string glycanKey in identifiedGlycan)
                {
                    List <int> identifedScans =
                        argMultiGlycan.MatchedPeakInScan.Where(x => x.GlycanComposition.GlycanKey == glycanKey)
                        .Select(y => y.ScanNum)
                        .ToList();
                    identifedScans.Sort();

                    int    frontEdge           = identifedScans[0];
                    double FirstIdentifiedTime = argMultiGlycan.RawReader.ReadScan(frontEdge).Time;
                    while (frontEdge > 1)
                    {
                        frontEdge -= 1;
                        if (argMultiGlycan.RawReader.GetMsLevel(frontEdge) != 1)
                        {
                            continue;
                        }
                        MSScan s = argMultiGlycan.RawReader.ReadScan(frontEdge);
                        if (FirstIdentifiedTime - s.Time > 5)
                        {
                            break;
                        }
                    }
                    int    backEdge          = identifedScans[identifedScans.Count - 1];
                    double LastIdentifedTime = argMultiGlycan.RawReader.ReadScan(backEdge).Time;

                    while (backEdge < LastScan)
                    {
                        backEdge += 1;
                        if (argMultiGlycan.RawReader.GetMsLevel(backEdge) != 1)
                        {
                            continue;
                        }
                        MSScan s = argMultiGlycan.RawReader.ReadScan(backEdge);
                        if (s.Time - LastIdentifedTime > 5)
                        {
                            break;
                        }
                    }
                    dictGlycanKeySearchRange.Add(glycanKey, new List <int>()
                    {
                        frontEdge, backEdge
                    });
                }

                List <MSScan> msScans           = new List <MSScan>();
                string        previousGlycanKey = "";
                foreach (GlycanCompound g in argMultiGlycan.GlycanList.OrderBy(x => x.GlycanKey))
                {
                    if (!identifiedGlycan.Contains(g.GlycanKey))
                    {
                        continue;
                    }
                    if (previousGlycanKey != g.GlycanKey)
                    {
                        msScans.Clear();
                        //Read Scans
                        int startScan = dictGlycanKeySearchRange[g.GlycanKey][0] >= 1 ? dictGlycanKeySearchRange[g.GlycanKey][0] : 1;
                        int endScan   = dictGlycanKeySearchRange[g.GlycanKey][1] <= LastScan ? dictGlycanKeySearchRange[g.GlycanKey][1] : LastScan;
                        msScans.AddRange(argMultiGlycan.RawReader.ReadScanWMSLevel(startScan, endScan, 1));
                        previousGlycanKey = g.GlycanKey;
                    }

                    //FindPeaks
                    int charge = g.Charge;
                    List <List <MSScan> > scanSectionsContainPeaks = new List <List <MSScan> >();
                    for (int i = 0; i < msScans.Count; i++)
                    {
                        MSScan scan      = msScans[i];
                        int    closedIdx = MassUtility.GetClosestMassIdx(scan.MZs, (float)g.MZ);
                        if (MassUtility.GetMassPPM(scan.MZs[closedIdx], g.MZ) <= argMultiGlycan.MassPPM)
                        {
                            List <int> peaks = FindPeakIdx(scan.MZs, closedIdx, charge, argMultiGlycan.IsotopePPM);
                            if (peaks.Count - peaks.IndexOf(closedIdx) < argMultiGlycan.MininumIsotopePeakCount)
                            {
                                continue;
                            }
                            //Found peaks
                            if (scanSectionsContainPeaks.Count > 0)
                            {
                                MSScan lastSectionLastScan = scanSectionsContainPeaks.Last().Last();
                                if (scan.Time - lastSectionLastScan.Time > 2.5)
                                {
                                    scanSectionsContainPeaks.Add(new List <MSScan>()
                                    {
                                        scan
                                    });
                                }
                                else
                                {
                                    scanSectionsContainPeaks.Last().Add(scan);
                                }
                            }
                            else
                            {
                                scanSectionsContainPeaks.Add(new List <MSScan>()
                                {
                                    scan
                                });
                            }
                        }
                    }

                    //If scans can form an elution profile add to identifed result;

                    foreach (List <MSScan> sectionScans in scanSectionsContainPeaks)
                    {
                        if (sectionScans.Count < 3)
                        {
                            continue;
                        }
                        else
                        {
                            //Add matched peak
                            foreach (MSScan s in sectionScans)
                            {
                                int PeakIdx             = MassUtility.GetClosestMassIdx(s.MZs, (float)g.MZ);
                                MatchedGlycanPeak mPeak = new MatchedGlycanPeak(s.ScanNo, s.Time, s.MSPeaks[PeakIdx], g);

                                List <int>     peaks       = FindPeakIdx(s.MZs, PeakIdx, charge, argMultiGlycan.IsotopePPM);
                                int            startIdx    = peaks.IndexOf(PeakIdx);
                                List <MSPoint> lstIsotopes = new List <MSPoint>();
                                for (int i = startIdx; i < peaks.Count; i++)
                                {
                                    lstIsotopes.Add(new MSPoint(s.MZs[peaks[i]], s.Intensities[peaks[i]]));
                                }
                                mPeak.MSPoints = lstIsotopes;
                                if (!argMultiGlycan.MatchedPeakInScan.Contains(mPeak))
                                {
                                    argMultiGlycan.MatchedPeakInScan.Add(mPeak);
                                }
                            }
                        }
                    }
                }



                //foreach (GlycanCompound g in argMultiGlycan.IdentifiedGlycanCompounds)
                //{
                //    processed = g;
                //    //Search Peak in front of the peak
                //    ThermoRawReader raw = (ThermoRawReader)argMultiGlycan.RawReader;
                //    List<int> identifedScans = argMultiGlycan.MatchedPeakInScan.Where(x => x.GlycanComposition == g).Select(y => y.ScanNum).ToList();
                //    for (int i = 0; i < identifedScans.Count; i++)
                //    {
                //        int identifiedScanNum = identifedScans[i];
                //        while (true)
                //        {
                //            identifiedScanNum -= 1;
                //            if (identifiedScanNum < 1 || raw.GetRetentionTime(identifedScans[i]) - raw.GetRetentionTime(identifiedScanNum) > argMultiGlycan.MaxLCFrontMin)
                //            {
                //                break;
                //            }
                //            if (raw.GetMsLevel((identifiedScanNum)) != 1)
                //            {
                //                continue;
                //            }
                //            MSScan scan = raw.ReadScan(identifiedScanNum);
                //            int PeakIdx = MassUtility.GetClosestMassIdx(scan.MZs, (float)g.MZ);
                //            if (MassUtility.GetMassPPM(scan.MZs[PeakIdx], g.MZ) > argMultiGlycan.MassPPM)
                //            {
                //                continue;
                //            }
                //            //Find isotope cluster
                //            List<MSPoint> lstIsotopes = new List<MSPoint>();
                //            lstIsotopes.Add(new MSPoint(scan.MZs[PeakIdx],scan.Intensities[PeakIdx]));
                //            float targetMZ = (float)g.MZ;
                //            do
                //            {
                //                targetMZ += 1.0f/g.Charge;
                //                PeakIdx = MassUtility.GetClosestMassIdx(scan.MZs, targetMZ);
                //                if (MassUtility.GetMassPPM(scan.MZs[PeakIdx], targetMZ) <= argMultiGlycan.MassPPM)
                //                {
                //                    lstIsotopes.Add(new MSPoint(scan.MZs[PeakIdx],scan.Intensities[PeakIdx]));
                //                }
                //                else
                //                {
                //                    break;
                //                }
                //            } while (true);
                //            if (lstIsotopes.Count < argMultiGlycan.MininumIsotopePeakCount)
                //            {
                //                continue;
                //            }
                //            MatchedGlycanPeak mPeak = new MatchedGlycanPeak(scan.ScanNo, scan.Time, scan.MSPeaks[PeakIdx], g);
                //            mPeak.MSPoints = lstIsotopes;
                //            if (!argMultiGlycan.MatchedPeakInScan.Contains(mPeak))
                //            {
                //                argMultiGlycan.MatchedPeakInScan.Add(mPeak);
                //            }
                //        }
                //        identifiedScanNum = identifedScans[i];
                //        while (true)
                //        {
                //            identifiedScanNum += 1;
                //            if (identifiedScanNum > raw.NumberOfScans || raw.GetRetentionTime(identifiedScanNum) - raw.GetRetentionTime(identifedScans[i]) > argMultiGlycan.MaxLCBackMin)
                //            {
                //                break;
                //            }
                //            if (raw.GetMsLevel((identifiedScanNum)) != 1)
                //            {
                //                continue;
                //            }
                //            MSScan scan = raw.ReadScan(identifiedScanNum);
                //            int PeakIdx = MassUtility.GetClosestMassIdx(scan.MZs, (float)g.MZ);
                //            if (MassUtility.GetMassPPM(scan.MZs[PeakIdx], g.MZ) > argMultiGlycan.MassPPM)
                //            {
                //                continue;
                //            }
                //            //Find isotope cluster
                //            List<MSPoint> lstIsotopes = new List<MSPoint>();
                //            lstIsotopes.Add(new MSPoint(scan.MZs[PeakIdx], scan.Intensities[PeakIdx]));
                //            float targetMZ = (float)g.MZ;
                //            do
                //            {
                //                targetMZ += 1.0f / g.Charge;
                //                PeakIdx = MassUtility.GetClosestMassIdx(scan.MZs, targetMZ);
                //                if (MassUtility.GetMassPPM(scan.MZs[PeakIdx], targetMZ) <= argMultiGlycan.MassPPM)
                //                {
                //                    lstIsotopes.Add(new MSPoint(scan.MZs[PeakIdx], scan.Intensities[PeakIdx]));
                //                }
                //                else
                //                {
                //                    break;
                //                }
                //            } while (true);
                //            if (lstIsotopes.Count < argMultiGlycan.MininumIsotopePeakCount)
                //            {
                //                continue;
                //            }
                //            MatchedGlycanPeak mPeak = new MatchedGlycanPeak(scan.ScanNo, scan.Time, scan.MSPeaks[PeakIdx], g);
                //            mPeak.MSPoints = lstIsotopes;
                //            if (!argMultiGlycan.MatchedPeakInScan.Contains(mPeak))
                //            {
                //                argMultiGlycan.MatchedPeakInScan.Add(mPeak);
                //            }
                //        }
                //    }
                //}
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #7
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter           = "Raw files (*.RAW,*.mzXML)|*.RAW;*.mzXML";
            openFileDialog1.RestoreDirectory = true;
            if (txtScanNo.Text == "" || txtPeptideSeq.Text == "")
            {
                MessageBox.Show("Please fill the information");
                return;
            }
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                _torelance          = Convert.ToSingle(txtPeaKTol.Text);
                _precursorTorelance = Convert.ToSingle(txtPrecusorTol.Text);
                dtTrees.Rows.Clear();
                int ScanNo = 0;
                if (Int32.TryParse(txtScanNo.Text, out ScanNo) == false)
                {
                    MessageBox.Show("Input Scan Number Error");
                    return;
                }

                if (Path.GetExtension(openFileDialog1.FileName).ToLower() == ".raw")
                {
                    ThermoRawReader RawReader = new COL.MassLib.ThermoRawReader(openFileDialog1.FileName);

                    /*GlypID.Peaks.clsPeakProcessorParameters clsParameters = new GlypID.Peaks.clsPeakProcessorParameters();
                     * clsParameters.SignalToNoiseThreshold = 0.0f;
                     * clsParameters.PeakBackgroundRatio = 0.01f;*/
                    //RawReader.SetPeakProcessorParameter(2, 2);
                    scan = RawReader.ReadScan(ScanNo);
                }
                else
                {
                    //scan = new mzXMLReader(openFileDialog1.FileName).ReadScan(ScanNo);
                }


                int NoNeuAc = 0;
                int NoNeuGc = 0;
                if (rdoNeuAc.Checked)
                {
                    NoNeuAc = Convert.ToInt32(txtSia.Text);
                }
                else
                {
                    NoNeuGc = Convert.ToInt32(txtSia.Text);
                }


                List <int> SequenceParameters = new List <int>();
                SequenceParameters.Add(Convert.ToInt32(txtTopPeaks_i.Text));
                SequenceParameters.Add(Convert.ToInt32(txtTopDiagPeaks_j.Text));
                SequenceParameters.Add(Convert.ToInt32(txtTopCorePeaks_k.Text));
                SequenceParameters.Add(Convert.ToInt32(txtTopBrancingPeaks_l.Text));
                SequenceParameters.Add(Convert.ToInt32(txtMaxGlycansToCompleteStruct_m.Text));


                GS = new GlycanSequencing_MultipleScoring(scan, scan.ParentCharge, Convert.ToInt32(txtHex.Text), Convert.ToInt32(txtHexNAc.Text), Convert.ToInt32(txtdeHex.Text), NoNeuAc, NoNeuGc, @"D:\tmp", true, 0.8f, 10, SequenceParameters, Peptides.ReadFastaFile(txtPeptideSeq.Text));
                GS.NumbersOfPeaksForSequencing = 140;
                GS.UseAVGMass = true;
                //GS.DebugMode(@"E:\temp\SeqTmp\");
                GS.CreatePrecursotMZ          = true;
                GS.RewardForCompleteStructure = 3;
                GS.StartSequencing();
                GS.GetTopRankScoreStructre(1);



                //lstPeak.Items.Add("Top " + GS.FilteredPeaks.Count.ToString() + "  peaks");
                //lstPeak.Items.Add("m/z / normailzed intensity ");
                //foreach (MSPoint p in GS.FilteredPeaks)
                //{
                //    lstPeak.Items.Add(p.Mass.ToString("0.0000") +"/" + p.Intensity.ToString("0.0000"));
                //}

                bool isFullSeq = false;
                ReportStructure = GS.SequencedStructures;
                if (ReportStructure.Count == 0)
                {
                    MessageBox.Show("No Structure Found");
                    return;
                }
                if (GS.FullSequencedStructures.Count != 0)
                {
                    ReportStructure = GS.FullSequencedStructures;
                    isFullSeq       = true;
                }
                AminoAcidMass AA = new AminoAcidMass();
                for (int i = 0; i < ReportStructure.Count; i++)
                {
                    GlycanStructure gt  = ReportStructure[i];
                    DataRow         row = dtTrees.NewRow();
                    //row.Add(new Object[] (gt.Mass.ToString("0.0000"), gt.Score.ToString("0.0000"),gt.GetIUPACString()));
                    row["ID"]                  = i.ToString();
                    row["Glycan Mass"]         = gt.GlycanAVGMonoMass.ToString("0.0000");
                    row["Y1"]                  = gt.Y1.Mass.ToString("0.0000");;
                    row["Core Score"]          = Convert.ToSingle((gt.CoreScore).ToString("0.00"));
                    row["Branch Score"]        = Convert.ToSingle((gt.BranchScore).ToString("0.00"));
                    row["Append Glycan Score"] = Convert.ToSingle((gt.InCompleteScore).ToString("0.00"));
                    if (gt.IsCompleteByPrecursorDifference)
                    {
                        row["PPM"] =
                            Convert.ToSingle(
                                MassUtility.GetMassPPM(
                                    gt.GlycanMonoMass + AA.GetMonoMW(gt.PeptideSequence, true) +
                                    GetGlycanMassByGlycanString(gt.RestGlycanString), GS.PrecusorMonoMass)
                                .ToString("0.00"));
                    }
                    else
                    {
                        row["PPM"] =
                            Convert.ToSingle(
                                MassUtility.GetMassPPM(
                                    gt.GlycanMonoMass + AA.GetMonoMW(gt.PeptideSequence, true), GS.PrecusorMonoMass).ToString("0.00"));
                    }
                    row["Peptide"]       = gt.PeptideSequence;
                    row["Append Glycan"] = gt.RestGlycanString;
                    row["IUPAC"]         = gt.IUPACString;

                    GlycansDrawer GDRaw  = new GlycansDrawer(gt.IUPACString, false);
                    Image         tmpImg = GDRaw.GetImage();
                    row["Structure"] = tmpImg;
                    dtTrees.Rows.Add(row);
                }
                ////GS.SequencStructures[0].TheoreticalFragment
                dtTrees.DefaultView.Sort = "Glycan Mass DESC";


                for (int i = 0; i < dgView.Rows.Count; i++)
                {
                    this.dgView.AutoResizeRow(i);
                    if (Convert.ToSingle(dgView.Rows[i].Cells["PPM"].Value) <= Convert.ToSingle(txtPrecusorTol.Text))
                    {
                        dgView.Rows[i].DefaultCellStyle.BackColor = Color.Red;
                    }
                }
            }
        }