Пример #1
0
            private static PointPair CreatePointPair(int iGroup,
                                                     ICollection <double> listTimes,
                                                     IEnumerable <double> listStarts,
                                                     IEnumerable <double> listEnds,
                                                     IEnumerable <double> listFwhms,
                                                     ref double maxY,
                                                     ref double minY)
            {
                if (listTimes.Count == 0)
                {
                    return(RTPointPairMissing(iGroup));
                }

                var statTimes  = new Statistics(listTimes);
                var statStarts = new Statistics(listStarts);
                var statEnds   = new Statistics(listEnds);
                var statFwhms  = new Statistics(listFwhms);

                double endY   = statEnds.Mean();
                double startY = statStarts.Mean();

                var pointPair = HiLowMiddleErrorBarItem.MakePointPair(iGroup,
                                                                      endY, startY, statTimes.Mean(), statFwhms.Mean());

                maxY = Math.Max(maxY, endY);
                minY = Math.Min(minY, startY);

                return(pointPair);
            }
Пример #2
0
            private PointPair CalculatePointPair <TChromInfoData>(int iResult, IEnumerable <TChromInfoData> chromInfoDatas, Func <TChromInfoData, RetentionTimeValues?> getRetentionTimeValues)
                where TChromInfoData : ChromInfoData
            {
                var startTimes     = new List <double>();
                var endTimes       = new List <double>();
                var retentionTimes = new List <double>();
                var fwhms          = new List <double>();

                foreach (var chromInfoData in chromInfoDatas)
                {
                    var retentionTimeValues = getRetentionTimeValues(chromInfoData).GetValueOrDefault();
                    IRegressionFunction regressionFunction = null;
                    if (null != RetentionTimeTransform.RtTransformOp)
                    {
                        RetentionTimeTransform.RtTransformOp.TryGetRegressionFunction(chromInfoData.ChromFileInfo.FileId, out regressionFunction);
                    }
                    if (regressionFunction == null)
                    {
                        startTimes.Add(retentionTimeValues.StartRetentionTime);
                        endTimes.Add(retentionTimeValues.EndRetentionTime);
                        retentionTimes.Add(retentionTimeValues.RetentionTime);
                        fwhms.Add(retentionTimeValues.Fwhm ?? 0);
                    }
                    else
                    {
                        startTimes.Add(regressionFunction.GetY(retentionTimeValues.StartRetentionTime));
                        endTimes.Add(regressionFunction.GetY(retentionTimeValues.EndRetentionTime));
                        retentionTimes.Add(regressionFunction.GetY(retentionTimeValues.RetentionTime));
                        if (retentionTimeValues.Fwhm.HasValue)
                        {
                            fwhms.Add(regressionFunction.GetY(retentionTimeValues.RetentionTime +
                                                              retentionTimeValues.Fwhm.Value / 2)
                                      -
                                      regressionFunction.GetY(retentionTimeValues.RetentionTime -
                                                              retentionTimeValues.Fwhm.Value / 2));
                        }
                        else
                        {
                            fwhms.Add(0);
                        }
                    }
                }
                if (RTPeptideValue.All == RTPeptideGraphPane.RTValue)
                {
                    var point = HiLowMiddleErrorBarItem.MakePointPair(iResult,
                                                                      new Statistics(endTimes).Mean(),
                                                                      new Statistics(startTimes).Mean(),
                                                                      new Statistics(retentionTimes).Mean(),
                                                                      new Statistics(fwhms).Mean());
                    return(point.IsInvalid ? PointPairMissing(iResult) : point);
                }
                IEnumerable <double> values;

                switch (RTPeptideGraphPane.RTValue)
                {
                case RTPeptideValue.FWB:
                    values = startTimes.Select((startTime, index) => endTimes[index] - startTime);
                    break;

                case RTPeptideValue.FWHM:
                    values = fwhms;
                    break;

                default:
                    values = retentionTimes;
                    break;
                }
                return(RetentionTimeTransform.AggregateOp.MakeBarValue(iResult, values));
            }
Пример #3
0
 public static PointPair RTPointPairMissing(int xValue)
 {
     return(HiLowMiddleErrorBarItem.MakePointPair(xValue,
                                                  PointPairBase.Missing, PointPairBase.Missing, PointPairBase.Missing, 0));
 }