Beispiel #1
0
 public PeptideLabelRatio(IsotopeLabelType labelType, IsotopeLabelType standardType,
                          RatioValue ratio) : this()
 {
     LabelType    = labelType;
     StandardType = standardType;
     Ratio        = ratio;
 }
Beispiel #2
0
 public static float? GetRatio(RatioValue ratioValue)
 {
     return ratioValue == null ? (float?) null : ratioValue.Ratio;
 }
Beispiel #3
0
 protected bool Equals(RatioValue other)
 {
     return Ratio.Equals(other.Ratio) && StdDev.Equals(other.StdDev) && DotProduct.Equals(other.DotProduct);
 }
Beispiel #4
0
 private IList<PeptideLabelRatio> AddPeptideRatio(IList<PeptideLabelRatio> listRatios, int i,
     IsotopeLabelType labelType, IsotopeLabelType standardType, RatioValue ratio)
 {
     if (_emptyPeptideRatios == null)
     {
         listRatios.Add(new PeptideLabelRatio(labelType, standardType, ratio));
     }
     else if (ratio != null)
     {
         if (listRatios == null)
             listRatios = _emptyPeptideRatios.ToArray();
         listRatios[i] = new PeptideLabelRatio(labelType, standardType, ratio);
     }
     return listRatios;
 }
Beispiel #5
0
 public static float? GetDotProduct(RatioValue ratioValue)
 {
     return ratioValue == null ? (float?) null : ratioValue.DotProduct;
 }
Beispiel #6
0
            public IList<TransitionGroupChromInfo> UpdateTransitonGroupRatios(TransitionGroupDocNode nodeGroup,
                IList<TransitionGroupChromInfo> listInfo,
                bool isMatching)
            {
                if (Calculators.Count == 0 || listInfo == null)
                    return null;

                var listInfoNew = new List<TransitionGroupChromInfo>();
                var standardTypes = Settings.PeptideSettings.Modifications.RatioInternalStandardTypes;
                foreach (var info in listInfo)
                {
                    PeptideChromInfoCalculator calc;
                    if (!Calculators.TryGetValue(info.FileIndex, out calc))
                        Assume.Fail();    // Should never happen
                    else
                    {
                        var infoNew = info;
                        var labelType = nodeGroup.TransitionGroup.LabelType;

                        int count = standardTypes.Count;
                        if (calc.HasGlobalArea)
                            count++;
                        var ratios = new RatioValue[count];
                        for (int i = 0; i < standardTypes.Count; i++)
                        {
                            ratios[i] = calc.CalcTransitionGroupRatio(nodeGroup, labelType, standardTypes[i]);
                        }
                        if (calc.HasGlobalArea)
                            ratios[count - 1] = calc.CalcTransitionGroupGlobalRatio(nodeGroup, labelType);
                        if (!ArrayUtil.EqualsDeep(ratios, info.Ratios))
                            infoNew = infoNew.ChangeRatios(ratios);

                        if (isMatching && calc.IsSetMatching && !infoNew.IsUserSetMatched)
                            infoNew = infoNew.ChangeUserSet(UserSet.MATCHED);

                        listInfoNew.Add(infoNew);
                    }
                }
                if (ArrayUtil.ReferencesEqual(listInfo, listInfoNew))
                    return listInfo;
                return listInfoNew;
            }
Beispiel #7
0
 protected bool Equals(RatioValue other)
 {
     return(Ratio.Equals(other.Ratio) && StdDev.Equals(other.StdDev) && DotProduct.Equals(other.DotProduct));
 }
Beispiel #8
0
 public static float?GetDotProduct(RatioValue ratioValue)
 {
     return(ratioValue == null ? (float?)null : ratioValue.DotProduct);
 }
Beispiel #9
0
 public static float?GetRatio(RatioValue ratioValue)
 {
     return(ratioValue == null ? (float?)null : ratioValue.Ratio);
 }
        public RatioValue GetTransitionGroupRatioValue(NormalizationMethod.RatioToLabel ratioToLabel,
                                                       PeptideDocNode peptideDocNode,
                                                       TransitionGroupDocNode transitionGroupDocNode, TransitionGroupChromInfo transitionGroupChromInfo)
        {
            if (peptideDocNode == null || transitionGroupChromInfo == null)
            {
                return(null);
            }
            if (transitionGroupDocNode.LabelType.Name == ratioToLabel.IsotopeLabelTypeName)
            {
                return(null);
            }
            var otherTransitionGroup =
                FindMatchingTransitionGroup(ratioToLabel, peptideDocNode, transitionGroupDocNode);

            if (otherTransitionGroup == null)
            {
                return(null);
            }

            var numerators   = new List <double>();
            var denominators = new List <double>();

            if (SimpleRatios)
            {
                foreach (var tran in transitionGroupDocNode.Transitions.Where(tran =>
                                                                              tran.IsQuantitative(Document.Settings)))
                {
                    var chromInfo = FindMatchingTransitionChromInfo(transitionGroupChromInfo.FileId,
                                                                    transitionGroupChromInfo.OptimizationStep, tran);
                    if (chromInfo != null)
                    {
                        numerators.Add(chromInfo.Area);
                    }
                }
                foreach (var tran in otherTransitionGroup.Transitions.Where(tran =>
                                                                            tran.IsQuantitative(Document.Settings)))
                {
                    var chromInfo = FindMatchingTransitionChromInfo(transitionGroupChromInfo.FileId,
                                                                    transitionGroupChromInfo.OptimizationStep, tran);
                    if (chromInfo != null)
                    {
                        denominators.Add(chromInfo.Area);
                    }
                }

                if (numerators.Count == 0 || denominators.Count == 0)
                {
                    return(null);
                }

                return(RatioValue.ValueOf(numerators.Sum() / denominators.Sum()));
            }

            var transitionMap = GetTransitionMap(otherTransitionGroup);

            foreach (var transition in transitionGroupDocNode.Transitions)
            {
                if (!transition.IsQuantitative(Document.Settings))
                {
                    continue;
                }
                var targetKey = new PeptideDocNode.TransitionKey(transitionGroupDocNode, new TransitionLossKey(transitionGroupDocNode, transition, transition.Losses), otherTransitionGroup.LabelType);
                if (!transitionMap.TryGetValue(
                        targetKey,
                        out TransitionDocNode otherTransition))
                {
                    continue;
                }

                if (!otherTransition.IsQuantitative(Document.Settings))
                {
                    continue;
                }

                var transitionChromInfo = FindMatchingTransitionChromInfo(transitionGroupChromInfo.FileId,
                                                                          transitionGroupChromInfo.OptimizationStep, transition);
                var otherTransitionChromInfo = FindMatchingTransitionChromInfo(transitionGroupChromInfo.FileId,
                                                                               transitionGroupChromInfo.OptimizationStep, otherTransition);
                if (transitionChromInfo == null || transitionChromInfo.IsEmpty || otherTransitionChromInfo == null || otherTransitionChromInfo.IsEmpty)
                {
                    continue;
                }
                numerators.Add(transitionChromInfo.Area);
                denominators.Add(otherTransitionChromInfo.Area);
            }

            return(RatioValue.Calculate(numerators, denominators));
        }