コード例 #1
0
ファイル: frmMain.cs プロジェクト: chpaul/COL_Lib
 private void btnGlycanDraw_Click(object sender, EventArgs e)
 {
     GlycansDrawer draw = new GlycansDrawer("HexNAc-(Hex-)HexNAc", false);
     picGlycan.Image = draw.GetImage();
     GlycansDrawer draw = new GlycansDrawer();
     picGlycan.Image = draw.GlycanCartoon(Glycan.Type.DeHex);
 }
コード例 #2
0
ファイル: frmSingle.cs プロジェクト: chpaul/GlycoSeq
        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);
        }
コード例 #3
0
        private void GenerateReportBody(List <GlycanSequencing> argGSequencing, StreamWriter argSW)
        {
            argSW.WriteLine("<h1>Scan number:" + argGSequencing[0].ScanInfo.ScanNo.ToString() + "[Precursor m/z:" + argGSequencing[0].ScanInfo.ParentMZ.ToString("0.000") + "]</h1>");
            argSW.WriteLine("<Table border=\"1\">");

            foreach (GlycanSequencing GS in argGSequencing)
            {
                List <GlycanStructure> ExportStructure;
                if (_CompletedOnly)
                {
                    ExportStructure = GS.FullSequencedStructures;
                }
                else
                {
                    ExportStructure = GS.GetTopRankScoreStructre(_GetTopRank);
                }

                argSW.WriteLine("<tr>");
                argSW.WriteLine("\t<td colspan=3>Peptide:" + GS.PeptideSeq + "</td></tr>");
                argSW.WriteLine("<tr>\n\t<td>Score</td>\n\t<td>Glycan  IUPAC</td>\n\t<td>IMG</td>\n</tr>");
                foreach (GlycanStructure gs in ExportStructure)
                {
                    string PicLocation = Path.GetDirectoryName(_exportFile) + "\\Pics\\" + gs.IUPACString.ToString() + ".png";
                    if (!File.Exists(PicLocation))
                    {
                        GlycansDrawer Draw = new GlycansDrawer(gs.IUPACString, false);
                        Image         Pic  = Draw.GetImage();

                        System.IO.MemoryStream mss = new System.IO.MemoryStream();
                        System.IO.FileStream   fs  = new System.IO.FileStream(PicLocation, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite);

                        Pic.Save(mss, System.Drawing.Imaging.ImageFormat.Png);
                        byte[] matriz = mss.ToArray();
                        fs.Write(matriz, 0, matriz.Length);

                        mss.Close();
                        fs.Close();
                        Pic.Dispose();
                        Pic  = null;
                        Draw = null;
                    }
                    argSW.WriteLine("<tr>\n\t<td>" + gs.Score.ToString("0.00") + "</td>\n\t<td>" + gs.IUPACString + "</td>\n\t<td><img src=\".\\Pics\\" + gs.IUPACString.ToString() + ".png\"/></td>\n</tr>");
                }
            }
            argSW.WriteLine("</table>\n<br><br>");
            argSW.Flush();
        }
コード例 #4
0
ファイル: frmSingle.cs プロジェクト: chpaul/GlycoSeq
        private void ListIDPeak(GlycanStructure argStructure)
        {
            DataTable  dtIDPeak    = new DataTable();
            DataColumn dcMass      = new DataColumn("Glycopeptide m/z", Type.GetType("System.Single"));
            DataColumn dcScore     = new DataColumn("Score", Type.GetType("System.Single"));
            DataColumn dcStructure = new DataColumn("Structure", typeof(Image));

            dtIDPeak.Columns.Add(dcMass);
            dtIDPeak.Columns.Add(dcScore);
            dtIDPeak.Columns.Add(dcStructure);
            dgIDPeak.DataSource       = dtIDPeak;
            dgIDPeak.Columns[0].Width = 70;
            dgIDPeak.Columns[1].Width = 50;
            dgIDPeak.Columns[2].Width = 315;

            dtIDPeak.DefaultView.Sort = "Glycopeptide m/z";

            GlycansDrawer GDraw;

            foreach (GlycanTreeNode GT in argStructure.Root.FetchAllGlycanNode())
            {
                DataRow row = dtIDPeak.NewRow();
                row[0] = GT.IDMass;
                row[1] = GT.IDIntensity;
                string tmp = argStructure.GetSequqncedIUPACwNodeID(GT.NodeID);
                GDraw  = new GlycansDrawer(tmp);
                row[2] = GDraw.GetImage();
                dtIDPeak.Rows.Add(row);
                GT.GetIUPACString();
            }
            dgIDPeak.Sort(dgIDPeak.Columns[0], ListSortDirection.Descending);
            for (int i = 0; i < dtIDPeak.Rows.Count; i++)
            {
                this.dgIDPeak.AutoResizeRow(i);
            }
            this.dgIDPeak.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;
        }
コード例 #5
0
        private void btnConvert_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
                {
                    if (!Directory.Exists(folderBrowserDialog1.SelectedPath))
                    {
                        Directory.CreateDirectory(folderBrowserDialog1.SelectedPath);
                    }
                    if (!Directory.Exists(folderBrowserDialog1.SelectedPath + "\\Pics"))
                    {
                        Directory.CreateDirectory(folderBrowserDialog1.SelectedPath + "\\Pics");
                    }
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">");
                    sb.AppendLine("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
                    sb.AppendLine("<head>");
                    sb.AppendLine("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />");
                    sb.AppendLine("<title>GlycoSeq</title>\n</head>\n<body>");
                    GlycansDrawer Draw;
                    StreamReader  SR = new StreamReader(openFileDialog1.FileName);
                    sb.AppendLine("<table  border=\"1\">");
                    sb.AppendLine("<tr><td>ID</td><td>Orignal Glycan</td><td>Add Glycan</td><td>Result</td></tr>");
                    int idx = 1;
                    do
                    {
                        string[] tmp = SR.ReadLine().Split(',');
                        sb.AppendLine("<tr>");
                        sb.AppendLine("<td>");
                        sb.AppendLine(idx.ToString());
                        sb.AppendLine("</td>");

                        Draw = new GlycansDrawer(tmp[0], false);
                        Image tmpImg = Draw.GetImage();
                        tmpImg.Save(folderBrowserDialog1.SelectedPath + "\\Pics\\PreStructure_" + idx.ToString("000") + ".png");
                        tmpImg.Dispose();
                        tmpImg = null;
                        sb.AppendLine("<td><img src=\".\\Pics\\PreStructure_" + idx.ToString("000") + ".png\"/><br>" + tmp[0] + "</td>");

                        Draw   = new GlycansDrawer(tmp[1], false);
                        tmpImg = Draw.GetImage();
                        tmpImg.Save(folderBrowserDialog1.SelectedPath + "\\Pics\\AddStructure_" + idx.ToString("000") + ".png");
                        tmpImg.Dispose();
                        tmpImg = null;
                        sb.AppendLine("<td><img src=\".\\Pics\\AddStructure_" + idx.ToString("000") + ".png\"/><br>" + tmp[1] + "</td>");

                        sb.AppendLine("<td>");

                        for (int i = 2; i < tmp.Length; i++)
                        {
                            Draw   = new GlycansDrawer(tmp[i], false);
                            tmpImg = Draw.GetImage();
                            tmpImg.Save(folderBrowserDialog1.SelectedPath + "\\Pics\\AddedStructure_" + idx.ToString("000") + "-" + (i - 1).ToString("000") + ".png");
                            tmpImg.Dispose();
                            tmpImg = null;
                            sb.AppendLine("<img src=\".\\Pics\\AddedStructure_" + idx.ToString("000") + "-" + (i - 1).ToString("000") + ".png\"/>");
                        }
                        sb.AppendLine("</td>");
                        sb.AppendLine("</tr>");
                        idx++;
                    } while (!SR.EndOfStream);
                    sb.AppendLine("</table><br>-----------------------------------------------------------<br>");
                    sb.AppendLine("</body>\n</html>");
                    StreamWriter Sw = new StreamWriter(folderBrowserDialog1.SelectedPath + "\\Result.htm");
                    Sw.Write(sb.ToString());
                    Sw.Flush();
                    Sw.Close();
                    MessageBox.Show("Done");
                }
            }
        }
コード例 #6
0
ファイル: frmSingle.cs プロジェクト: chpaul/GlycoSeq
        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;
                    }
                }
            }
        }
コード例 #7
0
ファイル: frmSingle.cs プロジェクト: chpaul/GlycoSeq
        public void DrawsequencingGraph(GlycanStructure argStructure)
        {
            zedSequence.GraphPane.GraphObjList.Clear();
            zedSequence.GraphPane.Legend.IsVisible = false;
            List <String> tmp = argStructure.Root.GetSequencingMapList();

            if (tmp.Count == 0)
            {
                return;
            }
            float Xmin = Convert.ToSingle(tmp[0].Split('-')[0]);
            float Xmax = Convert.ToSingle(tmp[tmp.Count - 1].Split('-')[2]);

            if (Xmax == 0.0f)
            {
                Xmax = scan.MSPeaks[scan.MSPeaks.Count - 1].MonoMass;
            }
            double YMax = 0.0;

            ZedGraph.PointPairList pplPeak = new ZedGraph.PointPairList();
            for (int i = 0; i < GS.FilteredPeaks.Count; i++)
            {
                if (GS.FilteredPeaks[i].Mass >= Xmin + 10.0f && GS.FilteredPeaks[i].Mass <= Xmax + 10.0f)
                {
                    if (GS.FilteredPeaks[i].Intensity > YMax)
                    {
                        YMax = GS.FilteredPeaks[i].Intensity;
                    }
                }
            }
            for (int i = 0; i < GS.FilteredPeaks.Count; i++)
            {
                if (GS.FilteredPeaks[i].Mass >= Xmin + 10.0f && GS.FilteredPeaks[i].Mass <= Xmax + 10.0f)
                {
                    pplPeak.Add(GS.FilteredPeaks[i].Mass, GS.FilteredPeaks[i].Intensity / YMax * 100.0f);
                }
            }

            ZedGraph.GraphPane Pane = zedSequence.GraphPane;


            Pane.XAxis.MajorTic.IsInside = false;
            Pane.XAxis.MinorTic.IsInside = false;
            Pane.CurveList.Clear();
            Pane.AddStick("Peaks", pplPeak, Color.Red);
            //Pane.XAxis.Scale.Min = Xmin - 10;
            //Pane.XAxis.Scale.Max = Xmax + 10;
            Pane.Title.Text = "No. " + txtScanNo.Text + "; Y1 m/z:" + argStructure.Y1.Mass.ToString("0.000");//+ "  Structure:" + Convert.ToString(dgView.Rows[e.RowIndex].Cells[0].Value);
            Pane.AxisChange();
            double YLevel = YMax;
            double outX, outY, outY2, diff;

            Pane.ReverseTransform(new Point(100, 100), out outX, out outY);
            Pane.ReverseTransform(new Point(100, 110), out outX, out outY2);
            diff = outY - outY2;
            GlycanTreeNode GT = argStructure.Root;//GS.GlycanTrees[e.RowIndex];

            //Peak Interval
            //List<string> SeqList = new List<string>();
            //for (int i = 0; i < GT.GetSequencingMapList().Count; i++)
            //{
            //    //Split the string
            //    string[] strArray = GT.GetSequencingMapList()[i].Split('-');
            //    ZedGraph.TextObj TxtObg = new ZedGraph.TextObj();
            //    TxtObg.Text = strArray[1];
            //    double Start = Convert.ToDouble(strArray[0]);
            //    double End = Convert.ToDouble(strArray[2]);

            //    System.Drawing.Drawing2D.DashStyle LineStyle = DashStyle.Solid;
            //    if (Start == 0)
            //    {
            //        if (strArray[1] == "HexNAc")
            //        {
            //            Start = End - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.HexNAc, GT.Charge);
            //        }
            //        else if (strArray[1] == "DeHex")
            //        {
            //            Start = End - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.DeHex, GT.Charge);
            //        }
            //        else if (strArray[1] == "Hex")
            //        {
            //            Start = End - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.Hex, GT.Charge);
            //        }
            //        else if (strArray[1] == "NeuAc")
            //        {
            //            Start = End - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.NeuAc, GT.Charge);
            //        }
            //        else
            //        {
            //            Start = End - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.NeuGc, GT.Charge);
            //        }
            //        TxtObg.Text = TxtObg.Text + "?";
            //        LineStyle = DashStyle.Dash;
            //    }
            //    else
            //    {
            //        if (strArray[1] == "HexNAc")
            //        {
            //            Start = End - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.HexNAc, GT.Charge);
            //        }
            //        else if (strArray[1] == "DeHex")
            //        {
            //            Start = End - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.DeHex, GT.Charge);
            //        }
            //        else if (strArray[1] == "Hex")
            //        {
            //            Start = End - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.Hex, GT.Charge);
            //        }
            //        else if (strArray[1] == "NeuAc")
            //        {
            //            Start = End - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.NeuAc, GT.Charge);
            //        }
            //        else
            //        {
            //            Start = End - GlycanMass.GetGlycanMasswithCharge(Glycan.Type.NeuGc, GT.Charge);
            //        }
            //    }
            //    if (End == 0)
            //    {
            //        if (strArray[1] == "HexNAc")
            //        {
            //            End = Start + GlycanMass.GetGlycanMasswithCharge(Glycan.Type.HexNAc, GT.Charge);
            //        }
            //        else if (strArray[1] == "DeHex")
            //        {
            //            End = Start + GlycanMass.GetGlycanMasswithCharge(Glycan.Type.DeHex, GT.Charge);
            //        }
            //        else if (strArray[1] == "Hex")
            //        {
            //            End = Start + GlycanMass.GetGlycanMasswithCharge(Glycan.Type.Hex, GT.Charge);
            //        }
            //        else if (strArray[1] == "NeuAc")
            //        {
            //            End = Start + GlycanMass.GetGlycanMasswithCharge(Glycan.Type.NeuAc, GT.Charge);
            //        }
            //        else
            //        {
            //            End = Start + GlycanMass.GetGlycanMasswithCharge(Glycan.Type.NeuGc, GT.Charge);
            //        }
            //        TxtObg.Text = TxtObg.Text + "?";
            //        LineStyle = DashStyle.Dash;
            //    }
            //    //Determine the Y level
            //    int Ylevel = 0;
            //    if (SeqList.Count == 0)
            //    {
            //        SeqList.Add(Start.ToString() + "," + End.ToString() + ",0");
            //    }
            //    else
            //    {

            //        for (int j = i - 1; j >= 0; j--)
            //        {
            //            double PreStart = Convert.ToDouble(SeqList[j].Split(',')[0]);
            //            double PreEnd = Convert.ToDouble(SeqList[j].Split(',')[1]);
            //            int Prelevel = Convert.ToInt32(SeqList[j].Split(',')[2]);
            //            if ((PreStart <= Start && Start <= PreEnd))
            //            {
            //                if (Math.Abs(PreEnd - Start) <= 10.0)
            //                {
            //                    Ylevel = Prelevel;
            //                    break;
            //                }
            //                else
            //                {
            //                    Ylevel = Prelevel + 1;
            //                    break;
            //                }
            //            }
            //        }
            //        SeqList.Add(Start.ToString() + "," + End.ToString() + "," + Ylevel.ToString());
            //    }
            //    TxtObg.FontSpec.Size = TxtObg.FontSpec.Size * 0.8f;
            //    YLevel = YMax + diff * Ylevel;
            //    ZedGraph.LineObj Lne = new ZedGraph.LineObj(Start, YLevel + diff, Start, YLevel - diff); //Left V Line
            //    Pane.GraphObjList.Add(Lne);

            //    Lne = new ZedGraph.LineObj(End, YLevel + diff, End, YLevel - diff); //Right V Line
            //    Pane.GraphObjList.Add(Lne);

            //    Lne = new ZedGraph.LineObj(Start, YLevel, End, YLevel);  //Add Line
            //    Lne.Line.Style = LineStyle;
            //    Pane.GraphObjList.Add(Lne);

            //    //ZedGraph.ArrowObj arr= new ZedGraph.ArrowObj(Start, YLevel, End, YLevel);
            //    //arr.IsArrowHead = true;
            //    //arr.Line.Style = LineStyle;
            //    //Pane.GraphObjList.Add(arr);

            //    TxtObg.Location = new ZedGraph.Location(((Start + End) / 2), (double)YLevel, ZedGraph.CoordType.AxisXYScale);
            //    TxtObg.FontSpec.Border.IsVisible = false;
            //    TxtObg.Location.AlignH = ZedGraph.AlignH.Center;
            //    TxtObg.Location.AlignV = ZedGraph.AlignV.Center;
            //    Pane.GraphObjList.Insert(0, TxtObg);
            //}


            /////Annotation
            GlycansDrawer GDraw;
            double        previousX2 = 0;

            List <GlycanTreeNode> Fragements = argStructure.Root.FetchAllGlycanNode();

            Fragements.Sort(delegate(GlycanTreeNode T1, GlycanTreeNode T2) { return(Comparer <float> .Default.Compare(T1.IDMass, T2.IDMass)); });
            foreach (GlycanTreeNode FGS in Fragements)
            {
                string Exp = argStructure.GetIUPACfromParentToNodeID(FGS.NodeID);
                //Queue<string> tmpQue = new Queue<string>();
                //for (int i = 0; i < Exp.Length; i++)
                //{
                //    int NodeID = 0;
                //    if (Exp[i].StartsWith("(") || Exp[i].StartsWith(")"))
                //    {
                //        NodeID = Convert.ToInt32(Exp[i].Split(',')[0].Substring(1));
                //    }
                //    else
                //    {
                //        NodeID = Convert.ToInt32(Exp[i].Split(',')[0]);
                //    }
                //    if (NodeID > FGS.NodeID)
                //    {
                //        if (Exp[i].StartsWith("(") || Exp[i].StartsWith(")"))
                //        {
                //            tmpQue.Enqueue(Exp[i].Substring(0, 1));  //
                //        }
                //    }
                //    else
                //    {
                //        tmpQue.Enqueue(Exp[i]);
                //    }
                //}
                //string IUPAC = "";

                //do
                //{
                //    string tmp =tmpQue.Dequeue();
                //    if(tmp == "(" && tmpQue.Peek() == ")" )
                //    {
                //    }



                //}while(tmpQue.Count!=0)

                string tmpIUPAC = argStructure.GetSequqncedIUPACwNodeID(FGS.NodeID);
                GDraw = new GlycansDrawer(tmpIUPAC);
                float glycopeptideMZ = FGS.IDMass;
                if (double.IsNaN(glycopeptideMZ))
                {
                    continue;
                }
                Image imgStructure = RotateImage(GDraw.GetImage(), 270);

                double PositionX = glycopeptideMZ;
                if (previousX2 >= PositionX)
                {
                    PositionX = previousX2 + 20;
                }

                ZedGraph.ImageObj glycan = new ZedGraph.ImageObj(imgStructure, PositionX, 130, imgStructure.Width * 0.3f, imgStructure.Height * 0.3f);

                glycan.IsScaled        = true;
                glycan.Location.AlignV = ZedGraph.AlignV.Bottom;
                Pane.GraphObjList.Add(glycan);

                ZedGraph.TextObj txtGlycanMz = new ZedGraph.TextObj(glycopeptideMZ.ToString("0.000"), 100, 140);
                txtGlycanMz.Location.X                = Pane.GraphObjList[Pane.GraphObjList.Count - 1].Location.X1 + (Pane.GraphObjList[Pane.GraphObjList.Count - 1].Location.X2 - Pane.GraphObjList[Pane.GraphObjList.Count - 1].Location.X1) / 2;
                txtGlycanMz.FontSpec.Size             = txtGlycanMz.FontSpec.Size * 0.5f;
                txtGlycanMz.FontSpec.Border.IsVisible = false;
                Pane.GraphObjList.Add(txtGlycanMz);

                if (Pane.GraphObjList[Pane.GraphObjList.Count - 1].Location.X2 > Pane.GraphObjList[Pane.GraphObjList.Count - 2].Location.X2)
                {
                    previousX2 = Pane.GraphObjList[Pane.GraphObjList.Count - 1].Location.X2;
                }
                else
                {
                    previousX2 = Pane.GraphObjList[Pane.GraphObjList.Count - 2].Location.X2;
                }
            }
            Pane.AxisChange();

            Pane.YAxis.Scale.Max = 145;
            Pane.XAxis.Scale.Min = Convert.ToInt32(argStructure.Y1.Mass - 100);
            Pane.XAxis.Scale.Max = pplPeak[pplPeak.Count - 1].X + 100;


            ////////////
            //Glycan Structure on the Right Top Header
            ////////////
            GDraw = new GlycansDrawer(argStructure.IUPACString, false);
            Image imgStruc = GDraw.GetImage();

            ZedGraph.ImageObj fullStructure = new ZedGraph.ImageObj(imgStruc, 0.01f, 0.01f, imgStruc.Width, imgStruc.Height);

            fullStructure.IsScaled = false;
            Pane.GraphObjList.Add(fullStructure);

            Pane.GraphObjList[Pane.GraphObjList.Count - 1].Location.CoordinateFrame = ZedGraph.CoordType.PaneFraction;
            zedSequence.AxisChange();
            zedSequence.Refresh();
        }