Beispiel #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());
        }
Beispiel #2
0
        public static string GetResultsText(TransitionGroupDocNode nodeGroup,
                                            PeptideDocNode nodePep, int indexResult, int indexRatio)
        {
            float?     libraryProduct = nodeGroup.GetLibraryDotProduct(indexResult);
            float?     isotopeProduct = nodeGroup.GetIsotopeDotProduct(indexResult);
            RatioValue ratio          = nodeGroup.GetPeakAreaRatio(indexResult, indexRatio);

            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());
        }
        private string GetDotProductResultsText(TransitionGroupDocNode nodeGroup, int indexResult)
        {
            var replicateIndices = IndexOfReplicate(indexResult);
            IEnumerable <float?> values;

            switch (ExpectedVisible)
            {
            case AreaExpectedValue.library:
                if (replicateIndices.IsEmpty)
                {
                    values = new[] { nodeGroup.GetLibraryDotProduct(-1) };
                }
                else
                {
                    values = replicateIndices.Select(nodeGroup.GetLibraryDotProduct);
                }
                break;

            case AreaExpectedValue.isotope_dist:
                if (replicateIndices.IsEmpty)
                {
                    values = new[] { nodeGroup.GetIsotopeDotProduct(-1) };
                }
                else
                {
                    values = replicateIndices.Select(nodeGroup.GetIsotopeDotProduct);
                }
                break;

            default:
                return(null);
            }
            var statistics = new Statistics(values
                                            .Select(value => value.HasValue ? (double?)value : null)
                                            .Where(value => value.HasValue)
                                            .Cast <double>());

            if (statistics.Length == 0)
            {
                return(null);
            }
            return(GetDotProductText((float)statistics.Mean()));
        }
 private string GetDotProductResultsText(TransitionGroupDocNode nodeGroup, int indexResult)
 {
     var replicateIndices = IndexOfReplicate(indexResult);
     IEnumerable<float?> values;
     switch (ExpectedVisible)
     {
         case AreaExpectedValue.library:
             if (replicateIndices.IsEmpty)
             {
                 values = new[] {nodeGroup.GetLibraryDotProduct(-1)};
             }
             else
             {
                 values = replicateIndices.Select(nodeGroup.GetLibraryDotProduct);
             }
             break;
         case AreaExpectedValue.isotope_dist:
             if (replicateIndices.IsEmpty)
             {
                 values = new[] {nodeGroup.GetIsotopeDotProduct(-1)};
             }
             else
             {
                 values = replicateIndices.Select(nodeGroup.GetIsotopeDotProduct);
             }
             break;
         default:
             return null;
     }
     var statistics = new Statistics(values
         .Select(value => value.HasValue ? (double?) value : null)
         .Where(value=>value.HasValue)
         .Cast<double>());
     if (statistics.Length == 0)
     {
         return null;
     }
     return GetDotProductText((float) statistics.Mean());
 }
        public static string GetResultsText(TransitionGroupDocNode nodeGroup,
            PeptideDocNode nodePep, int indexResult, int indexRatio)
        {
            float? libraryProduct = nodeGroup.GetLibraryDotProduct(indexResult);
            float? isotopeProduct = nodeGroup.GetIsotopeDotProduct(indexResult);
            RatioValue ratio = nodeGroup.GetPeakAreaRatio(indexResult, indexRatio);
            if (null == ratio && !isotopeProduct.HasValue && !libraryProduct.HasValue)
                return string.Empty;
            StringBuilder sb = new StringBuilder(" ("); // Not L10N
            int len = sb.Length;
            if (isotopeProduct.HasValue)
                sb.Append(string.Format("idotp {0}", isotopeProduct.Value.ToString(DOTP_FORMAT))); // Not L10N
            if (libraryProduct.HasValue)
            {
                if (sb.Length > len)
                    sb.Append(CS_SEPARATOR);
                sb.Append(string.Format("dotp {0}", libraryProduct.Value.ToString(DOTP_FORMAT))); // Not L10N
            }
            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))); // Not L10N
                    sb.Append(CS_SEPARATOR);
                }

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