Пример #1
0
        private int findPointWithTolerance(pwiz.MSGraph.MSPointList points, double mz, MZTolerance tolerance, bool scaled = false)
        {
            double lowestMatchMz = mz - tolerance;
            double highestMatchMz = mz + tolerance;

            var pointPairList = scaled ? points.ScaledList : points.FullList;
            int index = scaled ? points.ScaledLowerBound(mz) : points.FullLowerBound(mz);

            // if index is below the tolerance threshold, bump it to the next one or set to -1 if doing so would exceed the list size
            if (index > -1 && pointPairList[index].X < lowestMatchMz)
                index = index + 1 == pointPairList.Count ? -1 : index + 1;

            if (index == -1 || pointPairList[index].X > highestMatchMz)
                return -1;

            return index;
        }
Пример #2
0
        private void addFragment(GraphObjList list, pwiz.MSGraph.MSPointList points, string series, int length, int charge, double mz)
        {
            ///<summary>
            /// IMPORTANT: INORDER TO ADAPT TO ORBI-ORBI DATA, I NEED TO CHANGE THE TOLERANCE TO 30PPM!
            ///</summary>
            double basePeakIntensity = 0;
            double cutoff = 0;
            foreach (var pointlist in points)
            {
                if (basePeakIntensity < pointlist.Y)
                    basePeakIntensity = pointlist.Y;
            }
            cutoff = basePeakIntensity * basePeakPercentage * 0.01;
            double tolerance = mz * 30 * Math.Pow(10.0, -6);

            //define the max of scaled list
            //double maxScaledIntensity = 0;
            //foreach (var pointlist in points.ScaledList)
            //{
            //    if (maxScaledIntensity < pointlist.Y)
            //        maxScaledIntensity = pointlist.Y;
            //}

            //test neutral loss
            string label = String.Format("{0}{1}{2}", series, length, (charge > 1 ? "+" + charge.ToString() : ""));

            Color color;
            double offset;
            switch (series)
            {
                default: color = Color.Gray; offset = 0.1; break;
                case "a": color = Color.YellowGreen; offset = 0.1; break;
                case "x": color = Color.Green; offset = 0.12; break;
                case "b": color = Color.Red; offset = 0.14; break;
                case "y": color = Color.Blue; offset = 0.16; break;
                case "c": color = Color.Orange; offset = 0.18; break;
                case "z": color = Color.OrangeRed; offset = 0.2; break;
                case "z*": color = Color.Crimson; offset = 0.4; break;
                //test neutral loss
                case "a-water": color = Color.YellowGreen; offset = 0.1; label = String.Format("{0}{1}{2}{3}", "a", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H2O"); break;
                case "x-water": color = Color.Green; offset = 0.12; label = String.Format("{0}{1}{2}{3}", "x", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H2O"); break;
                case "b-water": color = Color.Red; offset = 0.14; label = String.Format("{0}{1}{2}{3}", "b", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H2O"); break;
                case "y-water": color = Color.Blue; offset = 0.16; label = String.Format("{0}{1}{2}{3}", "y", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H2O"); break;
                case "c-water": color = Color.Orange; offset = 0.18; label = String.Format("{0}{1}{2}{3}", "c", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H2O"); break;
                case "z-water": color = Color.OrangeRed; offset = 0.2; label = String.Format("{0}{1}{2}{3}", "z", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H2O"); break;
                case "z*-water": color = Color.Crimson; offset = 0.4; label = String.Format("{0}{1}{2}{3}", "z*", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H2O"); break;
                //test neutral loss
                case "a-ammonium": color = Color.YellowGreen; offset = 0.1; label = String.Format("{0}{1}{2}{3}", "a", length, (charge > 1 ? "+" + charge.ToString() : ""), "-NH3"); break;
                case "x-ammonium": color = Color.Green; offset = 0.12; label = String.Format("{0}{1}{2}{3}", "x", length, (charge > 1 ? "+" + charge.ToString() : ""), "-NH3"); break;
                case "b-ammonium": color = Color.Red; offset = 0.14; label = String.Format("{0}{1}{2}{3}", "b", length, (charge > 1 ? "+" + charge.ToString() : ""), "-NH3"); break;
                case "y-ammonium": color = Color.Blue; offset = 0.16; label = String.Format("{0}{1}{2}{3}", "y", length, (charge > 1 ? "+" + charge.ToString() : ""), "-NH3"); break;
                case "c-ammonium": color = Color.Orange; offset = 0.18; label = String.Format("{0}{1}{2}{3}", "c", length, (charge > 1 ? "+" + charge.ToString() : ""), "-NH3"); break;
                case "z-ammonium": color = Color.OrangeRed; offset = 0.2; label = String.Format("{0}{1}{2}{3}", "z", length, (charge > 1 ? "+" + charge.ToString() : ""), "-NH3"); break;
                case "z*-ammonium": color = Color.Crimson; offset = 0.4; label = String.Format("{0}{1}{2}{3}", "z*", length, (charge > 1 ? "+" + charge.ToString() : ""), "-NH3"); break;

                case "a-1phos": color = Color.YellowGreen; offset = 0.1; label = String.Format("{0}{1}{2}{3}", "a", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H3PO4"); break;
                case "x-1phos": color = Color.Green; offset = 0.12; label = String.Format("{0}{1}{2}{3}", "x", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H3PO4"); break;
                case "b-1phos": color = Color.Red; offset = 0.14; label = String.Format("{0}{1}{2}{3}", "b", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H3PO4"); break;
                case "y-1phos": color = Color.Blue; offset = 0.16; label = String.Format("{0}{1}{2}{3}", "y", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H3PO4"); break;
                case "c-1phos": color = Color.Orange; offset = 0.18; label = String.Format("{0}{1}{2}{3}", "c", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H3PO4"); break;
                case "z-1phos": color = Color.OrangeRed; offset = 0.2; label = String.Format("{0}{1}{2}{3}", "z", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H3PO4"); break;
                case "z*-1phos": color = Color.Crimson; offset = 0.4; label = String.Format("{0}{1}{2}{3}", "z*", length, (charge > 1 ? "+" + charge.ToString() : ""), "-H3PO4"); break;

                case "a-2phos": color = Color.YellowGreen; offset = 0.1; label = String.Format("{0}{1}{2}{3}", "a", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)2"); break;
                case "x-2phos": color = Color.Green; offset = 0.12; label = String.Format("{0}{1}{2}{3}", "x", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)2"); break;
                case "b-2phos": color = Color.Red; offset = 0.14; label = String.Format("{0}{1}{2}{3}", "b", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)2"); break;
                case "y-2phos": color = Color.Blue; offset = 0.16; label = String.Format("{0}{1}{2}{3}", "y", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)2"); break;
                case "c-2phos": color = Color.Orange; offset = 0.18; label = String.Format("{0}{1}{2}{3}", "c", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)2"); break;
                case "z-2phos": color = Color.OrangeRed; offset = 0.2; label = String.Format("{0}{1}{2}{3}", "z", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)2"); break;
                case "z*-2phos": color = Color.Crimson; offset = 0.4; label = String.Format("{0}{1}{2}{3}", "z*", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)2"); break;

                case "a-3phos": color = Color.YellowGreen; offset = 0.1; label = String.Format("{0}{1}{2}{3}", "a", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)3"); break;
                case "x-3phos": color = Color.Green; offset = 0.12; label = String.Format("{0}{1}{2}{3}", "x", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)3"); break;
                case "b-3phos": color = Color.Red; offset = 0.14; label = String.Format("{0}{1}{2}{3}", "b", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)3"); break;
                case "y-3phos": color = Color.Blue; offset = 0.16; label = String.Format("{0}{1}{2}{3}", "y", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)3"); break;
                case "c-3phos": color = Color.Orange; offset = 0.18; label = String.Format("{0}{1}{2}{3}", "c", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)3"); break;
                case "z-3phos": color = Color.OrangeRed; offset = 0.2; label = String.Format("{0}{1}{2}{3}", "z", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)3"); break;
                case "z*-3phos": color = Color.Crimson; offset = 0.4; label = String.Format("{0}{1}{2}{3}", "z*", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)3"); break;

                case "a-4phos": color = Color.YellowGreen; offset = 0.1; label = String.Format("{0}{1}{2}{3}", "a", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)4"); break;
                case "x-4phos": color = Color.Green; offset = 0.12; label = String.Format("{0}{1}{2}{3}", "x", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)4"); break;
                case "b-4phos": color = Color.Red; offset = 0.14; label = String.Format("{0}{1}{2}{3}", "b", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)4"); break;
                case "y-4phos": color = Color.Blue; offset = 0.16; label = String.Format("{0}{1}{2}{3}", "y", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)4"); break;
                case "c-4phos": color = Color.Orange; offset = 0.18; label = String.Format("{0}{1}{2}{3}", "c", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)4"); break;
                case "z-4phos": color = Color.OrangeRed; offset = 0.2; label = String.Format("{0}{1}{2}{3}", "z", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)4"); break;
                case "z*-4phos": color = Color.Crimson; offset = 0.4; label = String.Format("{0}{1}{2}{3}", "z*", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)4"); break;

                case "a-5phos": color = Color.YellowGreen; offset = 0.1; label = String.Format("{0}{1}{2}{3}", "a", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)5"); break;
                case "x-5phos": color = Color.Green; offset = 0.12; label = String.Format("{0}{1}{2}{3}", "x", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)5"); break;
                case "b-5phos": color = Color.Red; offset = 0.14; label = String.Format("{0}{1}{2}{3}", "b", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)5"); break;
                case "y-5phos": color = Color.Blue; offset = 0.16; label = String.Format("{0}{1}{2}{3}", "y", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)5"); break;
                case "c-5phos": color = Color.Orange; offset = 0.18; label = String.Format("{0}{1}{2}{3}", "c", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)5"); break;
                case "z-5phos": color = Color.OrangeRed; offset = 0.2; label = String.Format("{0}{1}{2}{3}", "z", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)5"); break;
                case "z*-5phos": color = Color.Crimson; offset = 0.4; label = String.Format("{0}{1}{2}{3}", "z*", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)5"); break;

                case "a-6phos": color = Color.YellowGreen; offset = 0.1; label = String.Format("{0}{1}{2}{3}", "a", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)6"); break;
                case "x-6phos": color = Color.Green; offset = 0.12; label = String.Format("{0}{1}{2}{3}", "x", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)6"); break;
                case "b-6phos": color = Color.Red; offset = 0.14; label = String.Format("{0}{1}{2}{3}", "b", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)6"); break;
                case "y-6phos": color = Color.Blue; offset = 0.16; label = String.Format("{0}{1}{2}{3}", "y", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)6"); break;
                case "c-6phos": color = Color.Orange; offset = 0.18; label = String.Format("{0}{1}{2}{3}", "c", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)6"); break;
                case "z-6phos": color = Color.OrangeRed; offset = 0.2; label = String.Format("{0}{1}{2}{3}", "z", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)6"); break;
                case "z*-6phos": color = Color.Crimson; offset = 0.4; label = String.Format("{0}{1}{2}{3}", "z*", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)6"); break;

                case "a-7phos": color = Color.YellowGreen; offset = 0.1; label = String.Format("{0}{1}{2}{3}", "a", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)7"); break;
                case "x-7phos": color = Color.Green; offset = 0.12; label = String.Format("{0}{1}{2}{3}", "x", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)7"); break;
                case "b-7phos": color = Color.Red; offset = 0.14; label = String.Format("{0}{1}{2}{3}", "b", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)7"); break;
                case "y-7phos": color = Color.Blue; offset = 0.16; label = String.Format("{0}{1}{2}{3}", "y", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)7"); break;
                case "c-7phos": color = Color.Orange; offset = 0.18; label = String.Format("{0}{1}{2}{3}", "c", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)7"); break;
                case "z-7phos": color = Color.OrangeRed; offset = 0.2; label = String.Format("{0}{1}{2}{3}", "z", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)7"); break;
                case "z*-7phos": color = Color.Crimson; offset = 0.4; label = String.Format("{0}{1}{2}{3}", "z*", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)7"); break;

                case "a-8phos": color = Color.YellowGreen; offset = 0.1; label = String.Format("{0}{1}{2}{3}", "a", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)8"); break;
                case "x-8phos": color = Color.Green; offset = 0.12; label = String.Format("{0}{1}{2}{3}", "x", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)8"); break;
                case "b-8phos": color = Color.Red; offset = 0.14; label = String.Format("{0}{1}{2}{3}", "b", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)8"); break;
                case "y-8phos": color = Color.Blue; offset = 0.16; label = String.Format("{0}{1}{2}{3}", "y", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)8"); break;
                case "c-8phos": color = Color.Orange; offset = 0.18; label = String.Format("{0}{1}{2}{3}", "c", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)8"); break;
                case "z-8phos": color = Color.OrangeRed; offset = 0.2; label = String.Format("{0}{1}{2}{3}", "z", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)8"); break;
                case "z*-8phos": color = Color.Crimson; offset = 0.4; label = String.Format("{0}{1}{2}{3}", "z*", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)8"); break;

                case "a-9phos": color = Color.YellowGreen; offset = 0.1; label = String.Format("{0}{1}{2}{3}", "a", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)9"); break;
                case "x-9phos": color = Color.Green; offset = 0.12; label = String.Format("{0}{1}{2}{3}", "x", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)9"); break;
                case "b-9phos": color = Color.Red; offset = 0.14; label = String.Format("{0}{1}{2}{3}", "b", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)9"); break;
                case "y-9phos": color = Color.Blue; offset = 0.16; label = String.Format("{0}{1}{2}{3}", "y", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)9"); break;
                case "c-9phos": color = Color.Orange; offset = 0.18; label = String.Format("{0}{1}{2}{3}", "c", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)9"); break;
                case "z-9phos": color = Color.OrangeRed; offset = 0.2; label = String.Format("{0}{1}{2}{3}", "z", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)9"); break;
                case "z*-9phos": color = Color.Crimson; offset = 0.4; label = String.Format("{0}{1}{2}{3}", "z*", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)9"); break;

                case "a-10phos": color = Color.YellowGreen; offset = 0.1; label = String.Format("{0}{1}{2}{3}", "a", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)10"); break;
                case "x-10phos": color = Color.Green; offset = 0.12; label = String.Format("{0}{1}{2}{3}", "x", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)10"); break;
                case "b-10phos": color = Color.Red; offset = 0.14; label = String.Format("{0}{1}{2}{3}", "b", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)10"); break;
                case "y-10phos": color = Color.Blue; offset = 0.16; label = String.Format("{0}{1}{2}{3}", "y", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)10"); break;
                case "c-10phos": color = Color.Orange; offset = 0.18; label = String.Format("{0}{1}{2}{3}", "c", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)10"); break;
                case "z-10phos": color = Color.OrangeRed; offset = 0.2; label = String.Format("{0}{1}{2}{3}", "z", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)10"); break;
                case "z*-10phos": color = Color.Crimson; offset = 0.4; label = String.Format("{0}{1}{2}{3}", "z*", length, (charge > 1 ? "+" + charge.ToString() : ""), "-(H3PO4)10"); break;

            }

            int index = -1;
            if (points != null)
                index = points.ScaledLowerBound(mz - tolerance);

            ///
            #region regular ion series a/b/c/x/y/z/z* keep unchanged
            if (series == "a" || series == "b" || series == "c" || series == "x" || series == "y" || series == "z" || series == "z*")
            {

                if (index == -1 || points.ScaledList[index].X > (mz + tolerance))
                // no matching point: present a "missed" fragment annotation
                {
                    if (!showMisses)
                        return;

                    color = Color.FromArgb(115, color); // transparent to emphasize miss

                    LineObj stick = new LineObj(color, mz, offset, mz, 1);
                    stick.Location.CoordinateFrame = CoordType.XScaleYChartFraction;
                    stick.Line.Width = 2;
                    stick.Line.Style = System.Drawing.Drawing2D.DashStyle.Dot;
                    list.Add(stick);

                    if (showLabels)
                    {
                        TextObj text = new TextObj(label, mz, offset, CoordType.XScaleYChartFraction,
                                                    AlignH.Left, AlignV.Center);
                        text.ZOrder = ZOrder.A_InFront;
                        text.FontSpec = new FontSpec("Arial", 12, color, false, false, false);
                        text.FontSpec.Border.IsVisible = false;
                        text.FontSpec.Angle = 90;
                        //text.IsClippedToChartRect = true;
                        list.Add(text);
                    }
                }
                else
                // matching point found: present the point as the fragment
                {
                    LineObj stick = new LineObj(color, mz, points.ScaledList[index].Y, mz, 0);
                    stick.Location.CoordinateFrame = CoordType.AxisXYScale;
                    stick.Line.Width = 2;
                    list.Add(stick);

                    if (showLabels)
                    {
                        // use an existing text point annotation if possible
                        TextObj text = null;
                        foreach (GraphObj obj in list)
                        {
                            if (obj is TextObj &&
                                (obj.Location.CoordinateFrame == CoordType.AxisXYScale ||
                                  obj.Location.CoordinateFrame == CoordType.XScaleYChartFraction) &&
                                Math.Abs(obj.Location.X - mz) < tolerance)
                            {
                                text = obj as TextObj;
                                text.Text = String.Format("{0}\n{1}", label, text.Text);
                                break;
                            }
                        }

                        if (text == null)
                        {
                            text = new TextObj(label, mz, points.ScaledList[index].Y, CoordType.AxisXYScale,
                                                AlignH.Left, AlignV.Center);
                            list.Add(text);
                        }

                        text.ZOrder = ZOrder.A_InFront;
                        text.FontSpec = new FontSpec("Arial", 12, color, false, false, false);
                        text.FontSpec.Border.IsVisible = false;
                        text.FontSpec.Fill.IsVisible = false;
                        text.FontSpec.Angle = 90;
                        //SizeF size = text.LayoutArea;
                        //float width = size.Width;

                        //pwiz.MSGraph.MSGraphPane g = new pwiz.MSGraph.MSGraphPane();
                        //YAxis y = g.YAxis;
                        //double scaled2pixel = width + y.Scale.Transform(points.ScaledList[index].Y) ;
                        //double width2Scale = width / 0.75 * maxScaledIntensity*1.1;

                        //text.IsClippedToChartRect = true;
                        //if (charge > 1)
                        //{
                        //    //calculate the Y value to actual size in CharFraction
                        //    TextObj chargeLabel = new TextObj("+" + charge, mz, 1-scaled2pixel, CoordType.XScaleYChartFraction,
                        //                                        AlignH.Left, AlignV.Bottom);

                        //    chargeLabel.ZOrder = ZOrder.A_InFront;
                        //    chargeLabel.FontSpec = new FontSpec("Arial", 8, color, false, false, false);
                        //    chargeLabel.FontSpec.Border.IsVisible = false;
                        //    chargeLabel.FontSpec.Fill.IsVisible = false;
                        //    chargeLabel.FontSpec.Angle = 90;
                        //    list.Add(chargeLabel);
                        //}

                    }
                }
            }
            #endregion

            else //if neutral loss ion series
            {
                ///
                #region basepeakthresholding is false
                if (basePeakThresholding == false)
                {
                    if (index == -1 || points.ScaledList[index].X > (mz + 0.5))
                    // no matching point: present a "missed" fragment annotation
                    {
                        if (!showMisses)
                            return;

                        color = Color.FromArgb(115, color); // transparent to emphasize miss

                        LineObj stick = new LineObj(color, mz, offset, mz, 1);
                        stick.Location.CoordinateFrame = CoordType.XScaleYChartFraction;
                        stick.Line.Width = 2;
                        stick.Line.Style = System.Drawing.Drawing2D.DashStyle.Dot;
                        list.Add(stick);

                        if (showLabels)
                        {
                            TextObj text = new TextObj(label, mz, offset, CoordType.XScaleYChartFraction,
                                                        AlignH.Left, AlignV.Center);
                            text.ZOrder = ZOrder.A_InFront;
                            text.FontSpec = new FontSpec("Arial", 12, color, false, false, false);
                            text.FontSpec.Border.IsVisible = false;
                            text.FontSpec.Angle = 90;
                            //text.IsClippedToChartRect = true;
                            list.Add(text);
                        }
                    }

                    else
                    // matching point found: present the point as the fragment
                    {
                        LineObj stick = new LineObj(color, mz, points.ScaledList[index].Y, mz, 0);
                        stick.Location.CoordinateFrame = CoordType.AxisXYScale;
                        stick.Line.Width = 2;
                        list.Add(stick);

                        if (showLabels)
                        {
                            // use an existing text point annotation if possible
                            TextObj text = null;
                            foreach (GraphObj obj in list)
                            {
                                if (obj is TextObj &&
                                    (obj.Location.CoordinateFrame == CoordType.AxisXYScale ||
                                      obj.Location.CoordinateFrame == CoordType.XScaleYChartFraction) &&
                                    Math.Abs(obj.Location.X - mz) < 0.5)
                                {
                                    text = obj as TextObj;
                                    text.Text = String.Format("{0}\n{1}", label, text.Text);
                                    break;
                                }
                            }

                            if (text == null)
                            {
                                text = new TextObj(label, mz, points.ScaledList[index].Y, CoordType.AxisXYScale,
                                                    AlignH.Left, AlignV.Center);
                                list.Add(text);
                            }

                            text.ZOrder = ZOrder.A_InFront;
                            text.FontSpec = new FontSpec("Arial", 12, color, false, false, false);
                            text.FontSpec.Border.IsVisible = false;
                            text.FontSpec.Fill.IsVisible = false;
                            text.FontSpec.Angle = 90;
                            //text.IsClippedToChartRect = true;
                        }
                    }
                }
                #endregion

                ///
                #region basepeakthresholding is true
                else //if basepeakthresholding is true
                {
                    if (index == -1 || points.ScaledList[index].X > (mz + 0.5) || points.FullList[index].Y < cutoff)
                    // no matching point: present a "missed" fragment annotation
                    {
                        if (!showMisses)
                            return;

                        color = Color.FromArgb(115, color); // transparent to emphasize miss

                        LineObj stick = new LineObj(color, mz, offset, mz, 1);
                        stick.Location.CoordinateFrame = CoordType.XScaleYChartFraction;
                        stick.Line.Width = 2;
                        stick.Line.Style = System.Drawing.Drawing2D.DashStyle.Dot;
                        list.Add(stick);

                        if (showLabels)
                        {
                            TextObj text = new TextObj(label, mz, offset, CoordType.XScaleYChartFraction,
                                                        AlignH.Left, AlignV.Center);
                            text.ZOrder = ZOrder.A_InFront;
                            text.FontSpec = new FontSpec("Arial", 12, color, false, false, false);
                            text.FontSpec.Border.IsVisible = false;
                            text.FontSpec.Angle = 90;
                            //text.IsClippedToChartRect = true;
                            list.Add(text);
                        }
                    }
                    else
                    // matching point found: present the point as the fragment
                    {
                        LineObj stick = new LineObj(color, mz, points.ScaledList[index].Y, mz, 0);
                        stick.Location.CoordinateFrame = CoordType.AxisXYScale;
                        stick.Line.Width = 2;
                        list.Add(stick);

                        if (showLabels)
                        {
                            // use an existing text point annotation if possible
                            TextObj text = null;
                            foreach (GraphObj obj in list)
                            {
                                if (obj is TextObj &&
                                    (obj.Location.CoordinateFrame == CoordType.AxisXYScale ||
                                      obj.Location.CoordinateFrame == CoordType.XScaleYChartFraction) &&
                                    Math.Abs(obj.Location.X - mz) < 0.5)
                                {
                                    text = obj as TextObj;
                                    text.Text = String.Format("{0}\n{1}", label, text.Text);
                                    break;
                                }
                            }

                            if (text == null)
                            {
                                text = new TextObj(label, mz, points.ScaledList[index].Y, CoordType.AxisXYScale,
                                                    AlignH.Left, AlignV.Center);
                                list.Add(text);
                            }

                            text.ZOrder = ZOrder.A_InFront;
                            text.FontSpec = new FontSpec("Arial", 12, color, false, false, false);
                            text.FontSpec.Border.IsVisible = false;
                            text.FontSpec.Fill.IsVisible = false;
                            text.FontSpec.Angle = 90;
                            //text.IsClippedToChartRect = true;
                        }
                    }
                }
                #endregion
            }
        }