private float?GetValue(TransitionGroupChromInfo chromInfo)
            {
                if (chromInfo == null)
                {
                    return(null);
                }

                return(chromInfo.MassError);
            }
        private TransitionGroupChromInfo GetTransitionGroupChromInfo(int chromIndex, int pepIndex)
        {
            TransitionGroupChromInfo result = null;

            RunUI(() =>
            {
                var nodePep   = SkylineWindow.DocumentUI.Peptides.ElementAt(pepIndex);
                var nodeGroup = nodePep.TransitionGroups.First();
                result        = nodeGroup.ChromInfos.ToArray()[chromIndex];
            });
            return(result);
        }
Esempio n. 3
0
 public static RetentionTimeValues?GetValues(TransitionGroupChromInfo transitionGroupChromInfo)
 {
     if (null == transitionGroupChromInfo ||
         !transitionGroupChromInfo.RetentionTime.HasValue ||
         !transitionGroupChromInfo.StartRetentionTime.HasValue ||
         !transitionGroupChromInfo.EndRetentionTime.HasValue)
     {
         return(null);
     }
     return(new RetentionTimeValues(transitionGroupChromInfo.RetentionTime.Value,
                                    transitionGroupChromInfo.StartRetentionTime.Value, transitionGroupChromInfo.EndRetentionTime.Value,
                                    transitionGroupChromInfo.Fwhm));
 }
            private float?GetValue(TransitionGroupChromInfo chromInfo)
            {
                if (chromInfo == null)
                {
                    return(null);
                }
                if (_ratioIndex == RATIO_INDEX_NONE)
                {
                    return(chromInfo.Area);
                }
                var ratioValue = chromInfo.GetRatio(_ratioIndex);

                return(ratioValue == null ? (float?)null : ratioValue.Ratio);
            }
Esempio n. 5
0
 protected override FindMatch MatchTransitionGroup(TransitionGroupChromInfo transitionGroupChromInfo)
 {
     int truncatedCount = transitionGroupChromInfo.Truncated.GetValueOrDefault(0);
     if (truncatedCount > 0)
     {
         if (truncatedCount == 1)
         {
             return new FindMatch(Resources.TruncatedPeakFinder_MatchTransitionGroup__1_truncated_peak);
         }
         return new FindMatch(string.Format(Resources.TruncatedPeakFinder_MatchTransitionGroup__0__truncated_peaks,
                                            truncatedCount));
     }
     return null;
 }
Esempio n. 6
0
        protected override FindMatch MatchTransitionGroup(TransitionGroupChromInfo transitionGroupChromInfo)
        {
            int truncatedCount = transitionGroupChromInfo.Truncated.GetValueOrDefault(0);

            if (truncatedCount > 0)
            {
                if (truncatedCount == 1)
                {
                    return(new FindMatch(Resources.TruncatedPeakFinder_MatchTransitionGroup__1_truncated_peak));
                }
                return(new FindMatch(string.Format(Resources.TruncatedPeakFinder_MatchTransitionGroup__0__truncated_peaks,
                                                   truncatedCount)));
            }
            return(null);
        }
Esempio n. 7
0
        public PeakBoundsMatch(TransitionGroupChromInfo chromInfoTrue,
                               TransitionGroupChromInfo chromInfoPicked,
                               MatchKey key,
                               ChromatogramSet chromSet,
                               MsDataFileUri filePath,
                               TransitionGroupDocNode nodeGroup,
                               PeptideDocNode nodePep,
                               bool hasNoQValues,
                               bool hasNoScores,
                               bool apexPresent)
        {
            _chromatogramSet = chromSet;

            ChromInfoTrue   = chromInfoTrue;
            ChromInfoPicked = chromInfoPicked;
            Key             = key;
            FilePath        = filePath;
            NodeGroup       = nodeGroup;
            NodePep         = nodePep;
            // Read apex
            if (apexPresent)
            {
                PickedApex          = ParsePickedTimeAnnotation(ComparePeakBoundaries.APEX_ANNOTATION);
                PickedStartBoundary = ParsePickedTimeAnnotation(ComparePeakBoundaries.START_TIME_ANNOTATION);
                PickedEndBoundary   = ParsePickedTimeAnnotation(ComparePeakBoundaries.END_TIME_ANNOTATION);
            }
            else
            {
                PickedApex          = ChromInfoPicked.RetentionTime;
                PickedStartBoundary = ChromInfoPicked.StartRetentionTime;
                PickedEndBoundary   = ChromInfoPicked.EndRetentionTime;
            }
            QValue = GetScoreValue(ChromInfoPicked, MProphetResultsHandler.AnnotationName, ci => ci.QValue);
            if (QValue == null && !IsMissingPickedPeak && !hasNoQValues)
            {
                throw new IOException(string.Format(
                                          Resources.PeakBoundsMatch_QValue_Unable_to_read_q_value_annotation_for_peptide__0__of_file__1_,
                                          ModifiedSequence, FileName));
            }
            Score = GetScoreValue(ChromInfoPicked, MProphetResultsHandler.MAnnotationName, ci => ci.ZScore);
            if (Score == null && !IsMissingPickedPeak && !hasNoScores)
            {
                throw new IOException(string.Format(
                                          Resources.PeakBoundsMatch_PeakBoundsMatch_Unable_to_read_a_score_annotation_for_peptide__0__of_file__1_,
                                          ModifiedSequence, FileName));
            }
        }
Esempio n. 8
0
 public static double?GetArea(bool treatMissingAsZero, double?qValueCutoff, TransitionGroupDocNode transitionGroup,
                              TransitionDocNode transition, int replicateIndex, TransitionChromInfo chromInfo)
 {
     if (treatMissingAsZero && chromInfo.IsEmpty)
     {
         return(0);
     }
     if (chromInfo.IsEmpty || chromInfo.IsTruncated.GetValueOrDefault())
     {
         return(null);
     }
     if (qValueCutoff.HasValue)
     {
         TransitionGroupChromInfo transitionGroupChromInfo = FindTransitionGroupChromInfo(transitionGroup,
                                                                                          replicateIndex, chromInfo.FileId);
         if (transitionGroupChromInfo != null && transitionGroupChromInfo.QValue > qValueCutoff.Value)
         {
             return(treatMissingAsZero ? 0 : default(double?));
         }
     }
     return(chromInfo.Area);
 }
Esempio n. 9
0
            protected override double?GetValue(TransitionGroupChromInfo chromInfo)
            {
                var retentionTimeValues = RetentionTimeValues.FromTransitionGroupChromInfo(chromInfo);

                retentionTimeValues = ScaleRetentionTimeValues(chromInfo.FileId, retentionTimeValues);
                if (retentionTimeValues == null)
                {
                    return(null);
                }
                switch (RTValue)
                {
                case RTPeptideValue.Retention:
                    return(retentionTimeValues.RetentionTime);

                case RTPeptideValue.FWHM:
                    return(retentionTimeValues.Fwhm);

                case RTPeptideValue.FWB:
                    return(retentionTimeValues.Fwb);
                }
                return(null);
            }
Esempio n. 10
0
 protected override double?GetValue(TransitionGroupChromInfo chromInfo)
 {
     return(chromInfo.Area);
 }
Esempio n. 11
0
 protected override FindMatch MatchTransitionGroup(TransitionGroupChromInfo transitionGroupChromInfo)
 {
     return(transitionGroupChromInfo.IsUserSetManual
                ? new FindMatch(Resources.ManuallyIntegratedPeakFinder_DisplayName_Manually_integrated_peaks)
                : null);
 }
 protected override FindMatch MatchTransitionGroup(TransitionGroupChromInfo transitionGroupChromInfo)
 {
     return transitionGroupChromInfo.IsUserSetManual
                ? new FindMatch(Resources.ManuallyIntegratedPeakFinder_DisplayName_Manually_integrated_peaks)
                : null;
 }
Esempio n. 13
0
 public static RetentionTimeValues? GetValues(TransitionGroupChromInfo transitionGroupChromInfo)
 {
     if (null == transitionGroupChromInfo ||
         !transitionGroupChromInfo.RetentionTime.HasValue ||
         !transitionGroupChromInfo.StartRetentionTime.HasValue ||
         !transitionGroupChromInfo.EndRetentionTime.HasValue)
     {
         return null;
     }
     return new RetentionTimeValues(transitionGroupChromInfo.RetentionTime.Value,
         transitionGroupChromInfo.StartRetentionTime.Value, transitionGroupChromInfo.EndRetentionTime.Value,
         transitionGroupChromInfo.Fwhm);
 }
        public PeakBoundsMatch(TransitionGroupChromInfo chromInfoTrue,
                               TransitionGroupChromInfo chromInfoPicked,
                               MatchKey key,
                               MsDataFileUri filePath,
                               TransitionGroupDocNode nodeGroup,
                               bool hasNoQValues,
                               bool hasNoScores,
                               bool apexPresent)
        {
            ChromInfoTrue   = chromInfoTrue;
            ChromInfoPicked = chromInfoPicked;
            Key             = key;
            FilePath        = filePath;
            NodeGroup       = nodeGroup;
            // Read apex
            if (apexPresent)
            {
                string apexString = ChromInfoPicked.Annotations.GetAnnotation(ComparePeakBoundaries.APEX_ANNOTATION);
                double apexDouble;
                if (!double.TryParse(apexString, out apexDouble))
                {
                    if (apexString == null || apexString.Equals(TextUtil.EXCEL_NA))
                    {
                        PickedApex = null;
                    }
                    else
                    {
                        throw new IOException(string.Format(Resources.PeakBoundsMatch_PeakBoundsMatch_Unable_to_read_apex_retention_time_value_for_peptide__0__of_file__1__, Sequence, FileName));
                    }
                }
                else
                {
                    PickedApex = apexDouble;
                }
            }
            else
            {
                PickedApex = ChromInfoPicked.RetentionTime;
            }
            string qValueString = ChromInfoPicked.Annotations.GetAnnotation(MProphetResultsHandler.AnnotationName);
            double qValueDouble;

            // qValue MUST be present unless the peak is null or ALL q Values are absent
            if (!double.TryParse(qValueString, out qValueDouble))
            {
                if (!IsMissingPickedPeak && !hasNoQValues)
                {
                    throw new IOException(string.Format(Resources.PeakBoundsMatch_QValue_Unable_to_read_q_value_annotation_for_peptide__0__of_file__1_, Sequence, FileName));
                }
                QValue = null;
            }
            else
            {
                QValue = qValueDouble;
            }
            // Same for score
            string scoreString = ChromInfoPicked.Annotations.GetAnnotation(MProphetResultsHandler.MAnnotationName);
            double scoreDouble;

            if (!double.TryParse(scoreString, out scoreDouble))
            {
                if (!IsMissingPickedPeak && !hasNoScores)
                {
                    throw new IOException(string.Format(Resources.PeakBoundsMatch_QValue_Unable_to_read_q_value_annotation_for_peptide__0__of_file__1_, Sequence, FileName));
                }
                Score = null;
            }
            else
            {
                Score = scoreDouble;
            }
        }
Esempio n. 15
0
 protected override double? GetValue(TransitionGroupChromInfo chromInfo)
 {
     return chromInfo.Area;
 }
 public FinderChromFileKey(TransitionGroupChromInfo transitionGroupChromInfo)
 {
     ChromFileInfoId = transitionGroupChromInfo.FileId;
     OptStep = transitionGroupChromInfo.OptimizationStep;
 }
 protected abstract double? GetValue(TransitionGroupChromInfo chromInfo);
Esempio n. 18
0
        public void ChangeChromInfo(EditDescription editDescription, TransitionGroupChromInfo newChromInfo)
        {
            var newDocNode = Precursor.DocNode.ChangeResults(GetResultFile().ChangeChromInfo(Precursor.DocNode.Results, newChromInfo));

            Precursor.ChangeDocNode(editDescription, newDocNode);
        }
Esempio n. 19
0
 private TransitionGroupChromInfoData(MeasuredResults measuredResults, int replicateIndex, ChromFileInfo chromFileInfo, TransitionGroupChromInfo transitionGroupChromInfo)
     : base(measuredResults, replicateIndex, chromFileInfo, transitionGroupChromInfo)
 {
 }
Esempio n. 20
0
            // ReSharper restore UnusedParameter.Local
            // ReSharper disable UnusedParameter.Local
            public void AddChromInfo(TransitionGroupDocNode nodeGroup,
                TransitionGroupChromInfo info)
            {
                if (info == null)
                    return;

                Assume.IsTrue(FileId == null || ReferenceEquals(info.FileId, FileId));
                var fileIdPrevious = FileId;
                FileId = info.FileId;
                FileOrder = Settings.MeasuredResults.Chromatograms[ResultsIndex].IndexOfId(FileId);

                // First time through calculate the global standard area for this file
                if (fileIdPrevious == null)
                    GlobalStandardArea = Settings.CalcGlobalStandardArea(ResultsIndex, FileId);

                ResultsCount++;
                PeakCountRatioTotal += info.PeakCountRatio;
                if (info.RetentionTime.HasValue)
                {
                    RetentionTimesMeasured++;
                    RetentionTimeTotal += info.RetentionTime.Value;
                }

                if (info.UserSet == UserSet.MATCHED)
                    IsSetMatching = true;
            }
Esempio n. 21
0
        private float? GetPeakCenterTime(TransitionGroupChromInfo chromInfo)
        {
            if (!chromInfo.StartRetentionTime.HasValue || !chromInfo.EndRetentionTime.HasValue)
                return null;

            return (chromInfo.StartRetentionTime.Value + chromInfo.EndRetentionTime.Value) / 2;
        }
Esempio n. 22
0
 public void ChangeChromInfo(EditDescription editDescription, TransitionGroupChromInfo newChromInfo)
 {
     var newDocNode = Precursor.DocNode.ChangeResults(GetResultFile().ChangeChromInfo(Precursor.DocNode.Results, newChromInfo));
     Precursor.ChangeDocNode(editDescription, newDocNode);
 }
Esempio n. 23
0
 protected override double? GetValue(TransitionGroupChromInfo chromInfo)
 {
     var retentionTimeValues = RetentionTimeValues.GetValues(chromInfo);
     if (!retentionTimeValues.HasValue)
     {
         return null;
     }
     retentionTimeValues = ScaleRetentionTimeValues(chromInfo.FileId, retentionTimeValues.Value);
     if (!retentionTimeValues.HasValue)
     {
         return null;
     }
     switch (RTValue)
     {
         case RTPeptideValue.Retention:
             return retentionTimeValues.Value.RetentionTime;
         case RTPeptideValue.FWHM:
             return retentionTimeValues.Value.Fwhm;
         case RTPeptideValue.FWB:
             return retentionTimeValues.Value.Fwb;
     }
     return null;
 }
Esempio n. 24
0
 protected abstract double?GetValue(TransitionGroupChromInfo chromInfo);
 private float? GetValue(TransitionGroupChromInfo chromInfo)
 {
     if (chromInfo == null)
         return null;
     if (_ratioIndex == RATIO_INDEX_NONE)
         return chromInfo.Area;
     var ratioValue = chromInfo.GetRatio(_ratioIndex);
     return ratioValue == null ? (float?)null : ratioValue.Ratio;
 }
 public FinderChromFileKey(TransitionGroupChromInfo transitionGroupChromInfo)
 {
     ChromFileInfoId = transitionGroupChromInfo.FileId;
     OptStep         = transitionGroupChromInfo.OptimizationStep;
 }
Esempio n. 27
0
 public PeakBoundsMatch(TransitionGroupChromInfo chromInfoTrue, 
     TransitionGroupChromInfo chromInfoPicked,
     MatchKey key,
     MsDataFileUri filePath,
     TransitionGroupDocNode nodeGroup,
     bool hasNoQValues,
     bool hasNoScores,
     bool apexPresent)
 {
     ChromInfoTrue = chromInfoTrue;
     ChromInfoPicked = chromInfoPicked;
     Key = key;
     FilePath = filePath;
     NodeGroup = nodeGroup;
     // Read apex
     if (apexPresent)
     {
         string apexString = ChromInfoPicked.Annotations.GetAnnotation(ComparePeakBoundaries.APEX_ANNOTATION);
         double apexDouble;
         if (!double.TryParse(apexString, out apexDouble))
         {
             if (apexString == null || apexString.Equals(TextUtil.EXCEL_NA))
             {
                 PickedApex = null;
             }
             else
             {
                 throw new IOException(string.Format(Resources.PeakBoundsMatch_PeakBoundsMatch_Unable_to_read_apex_retention_time_value_for_peptide__0__of_file__1__, Sequence, FileName));
             }
         }
         else
         {
             PickedApex = apexDouble;
         }
     }
     else
     {
         PickedApex = ChromInfoPicked.RetentionTime;
     }
     string qValueString = ChromInfoPicked.Annotations.GetAnnotation(MProphetResultsHandler.AnnotationName);
     double qValueDouble;
     // qValue MUST be present unless the peak is null or ALL q Values are absent
     if (!double.TryParse(qValueString, out qValueDouble))
     {
         if (!IsMissingPickedPeak && !hasNoQValues)
         {
             throw new IOException(string.Format(Resources.PeakBoundsMatch_QValue_Unable_to_read_q_value_annotation_for_peptide__0__of_file__1_, Sequence, FileName));
         }
         QValue = null;
     }
     else
     {
         QValue = qValueDouble;
     }
     // Same for score
     string scoreString = ChromInfoPicked.Annotations.GetAnnotation(MProphetResultsHandler.MAnnotationName);
     double scoreDouble;
     if (!double.TryParse(scoreString, out scoreDouble))
     {
         if (!IsMissingPickedPeak && !hasNoScores)
         {
             throw new IOException(string.Format(Resources.PeakBoundsMatch_QValue_Unable_to_read_q_value_annotation_for_peptide__0__of_file__1_, Sequence, FileName));
         }
         Score = null;
     }
     else
     {
         Score = scoreDouble;
     }
 }
 protected abstract FindMatch MatchTransitionGroup(TransitionGroupChromInfo transitionGroupChromInfo);
 protected abstract FindMatch MatchTransitionGroup(TransitionGroupChromInfo transitionGroupChromInfo);