コード例 #1
0
        public TransitionResultSummary(Transition transition, IEnumerable <TransitionResult> results)
            : base(transition.DataSchema)
        {
#pragma warning disable 612
            Transition = transition;
#pragma warning restore 612
            var retentionTimes  = new List <double>();
            var fwhms           = new List <double>();
            var areas           = new List <double>();
            var areasRatio      = new List <double>();
            var areasNormalized = new List <double>();

            foreach (var result in results)
            {
                if (result.RetentionTime.HasValue)
                {
                    retentionTimes.Add(result.RetentionTime.Value);
                }
                if (result.Fwhm.HasValue)
                {
                    fwhms.Add(result.Fwhm.Value);
                }
                if (result.Area.HasValue)
                {
                    areas.Add(result.Area.Value);
                }
                if (result.AreaNormalized.HasValue)
                {
                    areasNormalized.Add(result.AreaNormalized.Value);
                }
                if (result.AreaRatio.HasValue)
                {
                    areasRatio.Add(result.AreaRatio.Value);
                }
            }
            if (retentionTimes.Count > 0)
            {
                RetentionTime = new RetentionTimeSummary(new Statistics(retentionTimes));
            }
            if (fwhms.Count > 0)
            {
                Fwhm = new FwhmSummary(new Statistics(fwhms));
            }
            if (areas.Count > 0)
            {
                Area = new AreaSummary(new Statistics(areas));
            }
            if (areasNormalized.Count > 0)
            {
                AreaNormalized = new AreaNormalizedSummary(new Statistics(areasNormalized));
            }
            if (areasRatio.Count > 0)
            {
                AreaRatio = new AreaRatioSummary(new Statistics(areasRatio));
            }
        }
コード例 #2
0
ファイル: Precursor.cs プロジェクト: laeubisoft/pwiz
        public PrecursorResultSummary(Precursor precursor, IEnumerable <PrecursorResult> results)
            : base(precursor.DataSchema)
        {
#pragma warning disable 612
            Precursor = precursor;
#pragma warning restore 612
            var bestRetentionTimes   = new List <double>();
            var maxFhwms             = new List <double>();
            var totalAreas           = new List <double>();
            var totalAreasNormalized = new List <double>();
            var totalAreasRatio      = new List <double>();
            var maxHeights           = new List <double>();
            var detectionQValues     = new List <double>();
            foreach (var result in results)
            {
                if (result.BestRetentionTime.HasValue)
                {
                    bestRetentionTimes.Add(result.BestRetentionTime.Value);
                }
                if (result.MaxFwhm.HasValue)
                {
                    maxFhwms.Add(result.MaxFwhm.Value);
                }
                if (result.TotalArea.HasValue)
                {
                    totalAreas.Add(result.TotalArea.Value);
                }
                if (result.TotalAreaNormalized.HasValue)
                {
                    totalAreasNormalized.Add(result.TotalAreaNormalized.Value);
                }
                if (result.TotalAreaRatio.HasValue)
                {
                    totalAreasRatio.Add(result.TotalAreaRatio.Value);
                }
                if (result.MaxHeight.HasValue)
                {
                    maxHeights.Add(result.MaxHeight.Value);
                }
                if (result.DetectionQValue.HasValue)
                {
                    detectionQValues.Add(result.DetectionQValue.Value);
                }
            }
            if (bestRetentionTimes.Count > 0)
            {
                BestRetentionTime = new RetentionTimeSummary(new Statistics(bestRetentionTimes));
            }
            if (detectionQValues.Count > 0)
            {
                DetectionQValue = new DetectionQValueSummary(new Statistics(detectionQValues));
            }
            if (maxFhwms.Count > 0)
            {
                MaxFwhm = new FwhmSummary(new Statistics(maxFhwms));
            }
            if (totalAreas.Count > 0)
            {
                TotalArea = new AreaSummary(new Statistics(totalAreas));
            }
            if (totalAreasNormalized.Count > 0)
            {
                TotalAreaNormalized = new AreaNormalizedSummary(new Statistics(totalAreasNormalized));
            }
            if (totalAreasRatio.Count > 0)
            {
                TotalAreaRatio = new AreaRatioSummary(new Statistics(totalAreasRatio));
            }
            if (maxHeights.Count > 0)
            {
                MaxHeight = new AreaSummary(new Statistics(maxHeights));
            }
        }