示例#1
0
        /// <summary>
        /// Get a list of data points for a collection of features.
        /// </summary>
        /// <param name="features">List of features for one dataset.</param>
        /// <returns>
        /// Collection of datapoints for features.
        /// Item 1: LCMS feature datapoints. Item2: MS Feature datapoints.
        /// </returns>
        private IEnumerable <DataPoint> GetLcmsScatterPoints(FeaturePoint feature)
        {
            var lcmsDataPoints = new List <DataPoint> {
                Capacity = 3
            };

            lcmsDataPoints.Add(new DataPoint(feature.Rectangle.X, feature.UMCLight.MassMonoisotopic));
            lcmsDataPoints.Add(new DataPoint(feature.Rectangle.X + feature.Rectangle.Width, feature.UMCLight.MassMonoisotopic));

            // Insert NaN point to cause broken line series
            lcmsDataPoints.Add(new DataPoint(double.NaN, feature.UMCLight.MassMonoisotopic));

            return(lcmsDataPoints);
        }
示例#2
0
        /// <summary>Get scatter points for MS features and a rectangle annotation for the LCMS feature.</summary>
        /// <param name="feature">An LCMS feature.</param>
        /// <param name="dataset">The dataset that the LCMS feature comes from.</param>
        /// <returns>The tuple containing the LCMS feature annotation and the MS feature scatter points..</returns>
        private Tuple <RectangleAnnotation, IEnumerable <ScatterPoint> > GetMsFeaturesAndAnnotations(FeaturePoint feature, DatasetInformation dataset)
        {
            var msdataPoints = new List <ScatterPoint> {
                Capacity = feature.UMCLight.MsFeatures.Count
            };

            var minNet  = double.PositiveInfinity;
            var maxNet  = 0.0;
            var minMass = double.PositiveInfinity;
            var maxMass = 0.0;

            foreach (var msfeature in feature.UMCLight.MsFeatures)
            {
                var net = this.GetNet(dataset, msfeature.Scan);
                minNet  = Math.Min(minNet, net);
                maxNet  = Math.Max(maxNet, net);
                minMass = Math.Min(minMass, msfeature.MassMonoisotopic);
                maxMass = Math.Max(maxMass, msfeature.MassMonoisotopic);
                msdataPoints.Add(new ScatterPoint(net, msfeature.MassMonoisotopic, 0.8));
            }

            var netRange = maxNet - minNet;

            netRange = netRange.Equals(0.0) ? 0.01 : netRange;
            var massRange = maxMass - minMass;

            massRange = Math.Max(1.0, massRange);

            minNet  = minNet - (0.25 * netRange);
            maxNet  = maxNet + (0.25 * netRange);
            minMass = Math.Max(minMass - (massRange * 0.5), 0);
            maxMass = maxMass + (massRange * 0.5);

            var annotation = new RectangleAnnotation
            {
                MinimumX        = minNet,
                MaximumX        = maxNet,
                MinimumY        = minMass,
                MaximumY        = maxMass,
                Fill            = OxyColors.Transparent,
                StrokeThickness = 1.0,
            };

            return(new Tuple <RectangleAnnotation, IEnumerable <ScatterPoint> >(annotation, msdataPoints));
        }