示例#1
0
        public static string GetResultsText(DisplaySettings displaySettings, TransitionGroupDocNode nodeGroup)
        {
            float?     libraryProduct = nodeGroup.GetLibraryDotProduct(displaySettings.ResultsIndex);
            float?     isotopeProduct = nodeGroup.GetIsotopeDotProduct(displaySettings.ResultsIndex);
            RatioValue ratio          = null;

            if (displaySettings.NormalizationMethod is NormalizationMethod.RatioToLabel ratioToLabel)
            {
                ratio = displaySettings.NormalizedValueCalculator.GetTransitionGroupRatioValue(ratioToLabel,
                                                                                               displaySettings.NodePep, nodeGroup, nodeGroup.GetChromInfoEntry(displaySettings.ResultsIndex));
            }
            if (null == ratio && !isotopeProduct.HasValue && !libraryProduct.HasValue)
            {
                return(string.Empty);
            }
            StringBuilder sb  = new StringBuilder(@" (");
            int           len = sb.Length;

            if (isotopeProduct.HasValue)
            {
                sb.Append(string.Format(@"idotp {0}", isotopeProduct.Value.ToString(DOTP_FORMAT)));
            }
            if (libraryProduct.HasValue)
            {
                if (sb.Length > len)
                {
                    sb.Append(CS_SEPARATOR);
                }
                sb.Append(string.Format(@"dotp {0}", libraryProduct.Value.ToString(DOTP_FORMAT)));
            }
            if (ratio != null)
            {
                if (sb.Length > len)
                {
                    sb.Append(CS_SEPARATOR);
                }
                if (!double.IsNaN(ratio.StdDev))
                {
                    sb.Append(string.Format(@"rdotp {0}", ratio.DotProduct.ToString(DOTP_FORMAT)));
                    sb.Append(CS_SEPARATOR);
                }

                sb.Append(string.Format(Resources.TransitionGroupTreeNode_GetResultsText_total_ratio__0__,
                                        MathEx.RoundAboveZero(ratio.Ratio, 2, 4)));
            }
            sb.Append(@")");
            return(sb.ToString());
        }