public GlycanStructure(Glycan argGlycan, MSPoint argPeak) { _tree = new GlycanTreeNode(argGlycan.GlycanType, _nextID); _nextID++; _y1 = argPeak; _IUPAC = _tree.GetIUPACString(); }
public GlycanStructure(Glycan argGlycan, float argY1) { _tree = new GlycanTreeNode(argGlycan.GlycanType, _nextID); _nextID++; _y1 = new MSPoint(argY1, 0.0f); _IUPAC = _tree.GetIUPACString(); }
public void AddGlycanToStructure(GlycanTreeNode argAddTree, int argParentID) { GlycanTreeNode Parent = GetGlycanTreeByID(argParentID); if (Parent != null) { foreach (GlycanTreeNode GT in argAddTree.FetchAllGlycanNode()) { GT.NodeID = _nextID; _nextID++; } argAddTree.Parent = Parent; Parent.AddGlycanSubTree(argAddTree); // Parent.UpdateGlycans(); Parent.SortSubTree(); _IUPAC = _tree.GetIUPACString(); } }
public static TreeNode Convert2TreeView(GlycanTreeNode argRoot) { Stack <GlycanTreeNode> NodeStack = new Stack <GlycanTreeNode>(); NodeStack.Push(argRoot); TreeNode root = new TreeNode(argRoot.NodeID + "-" + argRoot.GlycanType.ToString()); foreach (GlycanTreeNode GN in argRoot.TravelGlycanTreeBFS()) { if (GN.Parent == null) { continue; } string PID = GN.Parent.NodeID + "-" + GN.Parent.GlycanType.ToString(); TreeNode ParentNode = FindNode(root, PID); ParentNode.Nodes.Add(GN.NodeID + "-" + GN.GlycanType.ToString()); } return(root); }
public StructureRule(string argIUPAC, int argDistance, string argOperator,FiltereTypes argType) { _structure = GlycanTreeNode.IUPACToGlycanTree(argIUPAC); _type = argType; _distanceOperator = argOperator; _distanceToRoot = argDistance; //if(argDistance.Contains("=") || argDistance.Contains("<") || argDistance.Contains(">")) //{ // _distanceOperator = argDistance.Substring(0,1); // _distanceToRoot = Convert.ToInt32(argDistance.Substring(1)); //} //else if (argDistance.Contains("*")) //{ // _distanceOperator = ""; // _distanceToRoot = -999; //} //else //{ // _distanceOperator = ""; // _distanceToRoot = Convert.ToInt32(argDistance); //} }
public StructureRule(string argIUPAC, int argDistance, string argOperator, FiltereTypes argType) { _structure = GlycanTreeNode.IUPACToGlycanTree(argIUPAC); _type = argType; _distanceOperator = argOperator; _distanceToRoot = argDistance; //if(argDistance.Contains("=") || argDistance.Contains("<") || argDistance.Contains(">")) //{ // _distanceOperator = argDistance.Substring(0,1); // _distanceToRoot = Convert.ToInt32(argDistance.Substring(1)); //} //else if (argDistance.Contains("*")) //{ // _distanceOperator = ""; // _distanceToRoot = -999; //} //else //{ // _distanceOperator = ""; // _distanceToRoot = Convert.ToInt32(argDistance); //} }
public void RemoveSubtree(GlycanTreeNode argTree, GlycanTreeNode argRemoveTree) { int TargetLevel = argRemoveTree.DistanceRoot; GlycanTreeNode CurrentTree = argTree; Queue ChildQuene = new Queue(); do { if (CurrentTree.DistanceRoot < TargetLevel) { if (CurrentTree.GetChildren() == null) //Other Branch { CurrentTree = (GlycanTreeNode)ChildQuene.Dequeue(); } else { if (CurrentTree.GetChildren().Count > 1) { for (int i = 1; i < CurrentTree.GetChildren().Count; i++) { ChildQuene.Enqueue(CurrentTree.GetChildren()[i]); } } CurrentTree = CurrentTree.GetChildren()[0]; } } else { if (CurrentTree.GetIUPACString() == argRemoveTree.GetIUPACString()) { CurrentTree = CurrentTree.Parent; CurrentTree.GetChildren().Remove(argRemoveTree); } } } while (true); }
public static List <GlycanTreeNode> FragementGlycanTree(GlycanTreeNode argTree) { List <GlycanTreeNode> _fragment = new List <GlycanTreeNode>(); Queue ChildQueue = new Queue(); GlycanTreeNode CurrentTree = argTree; do { GlycanTreeNode tmpTree = (GlycanTreeNode)argTree.Clone(); if (CurrentTree.GetChildren() != null) { if (CurrentTree.GetChildren().Count == 1) { tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); _fragment.Add(tmpTree); CurrentTree = CurrentTree.GetChildren()[0]; } else if (CurrentTree.GetChildren().Count == 2) { tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[1]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[1]); _fragment.Add(tmpTree); ChildQueue.Enqueue(CurrentTree.GetChildren()[1]); CurrentTree = CurrentTree.GetChildren()[0]; } else if (CurrentTree.GetChildren().Count == 3) { tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[1]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[2]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[1]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[2]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[1]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[2]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[1]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[2]); _fragment.Add(tmpTree); ChildQueue.Enqueue(CurrentTree.GetChildren()[1]); ChildQueue.Enqueue(CurrentTree.GetChildren()[2]); CurrentTree = CurrentTree.GetChildren()[0]; } else if (CurrentTree.GetChildren().Count == 4) { tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[1]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[2]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[3]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[1]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[2]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[3]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[1]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[2]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[1]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[3]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[2]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[3]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[1]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[2]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[1]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[3]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[0]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[2]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[3]); _fragment.Add(tmpTree); tmpTree = (GlycanTreeNode)argTree.Clone(); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[1]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[2]); tmpTree.RemoveGlycan(CurrentTree.GetChildren()[3]); _fragment.Add(tmpTree); ChildQueue.Enqueue(CurrentTree.GetChildren()[1]); ChildQueue.Enqueue(CurrentTree.GetChildren()[2]); ChildQueue.Enqueue(CurrentTree.GetChildren()[3]); CurrentTree = CurrentTree.GetChildren()[0]; } } else { if (ChildQueue.Count != 0) { CurrentTree = (GlycanTreeNode)ChildQueue.Dequeue(); } else { break; } } } while (true); //Filter out duplicate tree List <GlycanTreeNode> tmpGlycanTree = new List <GlycanTreeNode>(); foreach (GlycanTreeNode t in _fragment) { if (!tmpGlycanTree.Contains(t)) { tmpGlycanTree.Add(t); } } tmpGlycanTree.Sort(delegate(GlycanTreeNode T1, GlycanTreeNode T2) { return(GlycanMass.GetGlycanMasswithCharge(new GlycanCompound(T1.NoOfHexNac, T1.NoOfHex, T1.NoOfDeHex, T1.NoOfNeuAc), argTree.Charge).CompareTo( GlycanMass.GetGlycanMasswithCharge(new GlycanCompound(T2.NoOfHexNac, T2.NoOfHex, T2.NoOfDeHex, T2.NoOfNeuAc), argTree.Charge))); }); return(tmpGlycanTree); }
public GlycanStructure(GlycanTreeNode argGlycan) { _tree = argGlycan; _nextID = argGlycan.NoOfTotalGlycan + 1; _IUPAC = _tree.GetIUPACString(); }
/// <summary> /// Check if this tree obey N-Linked Core rules: 2 HexNex + 3 Hex, Branching is high man, complex. hybrid /// </summary> /// <returns></returns> public bool isObyeNLinkedCore() { //Node 1 GlycanTreeNode CheckNode = _tree; int NoOfHexNac = 0; int NoOfHex = 0; int NoOfDeHex = 0; if (CheckNode.GlycanType != Glycan.Type.HexNAc) //1st Node Only can be HexNac { return(false); } if (CheckNode.Subtrees != null) //1st Node can only link to one HexNac and multiple DeHex { foreach (GlycanTreeNode SubTree in CheckNode.Subtrees) { if (SubTree.GlycanType == Glycan.Type.HexNAc) { NoOfHexNac++; } else if (SubTree.GlycanType == Glycan.Type.DeHex) { NoOfDeHex++; } } if (NoOfHexNac > 1 || (NoOfHexNac + NoOfDeHex != CheckNode.Subtrees.Count)) { return(false); } } if (CheckNode.Subtrees.Count == NoOfDeHex) { return(true); } //Node 2 CheckNode = CheckNode.Subtrees[0]; //DeHex will be sort to the end of list NoOfHexNac = 0; NoOfHex = 0; NoOfDeHex = 0; if (CheckNode.GlycanType != Glycan.Type.HexNAc)//2nd Node Only can be HexNac { return(false); } if (CheckNode.Subtrees != null) //2nd Node can only link to one Hex and multiple DeHex { foreach (GlycanTreeNode SubTree in CheckNode.Subtrees) { if (SubTree.GlycanType == Glycan.Type.Hex) { NoOfHex++; } else if (SubTree.GlycanType == Glycan.Type.DeHex) { NoOfDeHex++; } } if (NoOfDeHex == CheckNode.Subtrees.Count) { return(true); } if (NoOfHex != 1 || (NoOfHex + NoOfDeHex != CheckNode.Subtrees.Count)) { return(false); } } else { return(true); } //Node 3 CheckNode = CheckNode.Subtrees[0]; //DeHex will be sort to the end of list NoOfHexNac = 0; NoOfHex = 0; NoOfDeHex = 0; if (CheckNode.GlycanType != Glycan.Type.Hex)//3rd Node Only can be Hex { return(false); } if (CheckNode.Subtrees != null) //3rd Node can only link to one HexNac and up to two Hex { foreach (GlycanTreeNode SubTree in CheckNode.Subtrees) { if (SubTree.GlycanType == Glycan.Type.Hex) { NoOfHex++; } else if (SubTree.GlycanType == Glycan.Type.HexNAc) { NoOfHexNac++; } } if (NoOfHex > 2 || NoOfHexNac > 1) { return(false); } if (NoOfHexNac + NoOfHex != CheckNode.Subtrees.Count) { return(false); } if (CheckNode.Subtrees.Count == 1) { if (!(NoOfHex == 1 || NoOfHexNac == 1)) { return(false); } if (NoOfHexNac == 1 && CheckNode.Subtrees[0].Subtrees != null) //bisecting no child { return(false); } foreach (GlycanTreeNode ChildTree in CheckNode.FetchAllGlycanNode()) { if (ChildTree.Subtrees != null && ChildTree.Subtrees.Count > 1) { return(false); } } } else { if (CheckNode.Subtrees.Count != NoOfHex + NoOfHexNac) { return(false); } } } else { return(true); } ////check branch can be either high man, hybrid or complex foreach (GlycanTreeNode SubTree in CheckNode.Subtrees) { if (SubTree.GlycanType == Glycan.Type.Hex) { if (SubTree.NoOfTotalGlycan - SubTree.NoOfHex > 0 && SubTree.NoOfHexNac == 0) { return(false); } } else if (SubTree.GlycanType == Glycan.Type.HexNAc) //Bisecting { if (SubTree.Subtrees != null) { return(false); } } else { return(false); } } return(true); }
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(); }