public PeakFeatureStatistics(PeakTransitionGroupFeatures features, IList <double> mprophetScores, IList <double> pValues, int bestScoreIndex, double?qValue)
 {
     Features       = features;
     MprophetScores = mprophetScores;
     PValues        = pValues;
     BestScoreIndex = bestScoreIndex;
     QValue         = qValue;
 }
Exemplo n.º 2
0
 public PeakFeatureStatistics(PeakTransitionGroupFeatures features, IList <float> mprophetScores, IList <float> pvalues,
                              int bestScoreIndex, float bestScore, float?qValue)
 {
     MprophetScores = mprophetScores;    // May only be present for writing features
     PValues        = pvalues;
     // Don't hold onto the features, because they hold a lot of memory
     BestPeakIndex  = features.PeakGroupFeatures[bestScoreIndex].OriginalPeakIndex;
     BestScoreIndex = bestScoreIndex;
     BestScore      = bestScore;
     QValue         = qValue;
 }
        private static void WriteRow(TextWriter writer,
                                     PeakTransitionGroupFeatures features,
                                     PeakGroupFeatures peakGroupFeatures,
                                     CultureInfo cultureInfo,
                                     double mProphetScore,
                                     double pValue,
                                     double qValue)
        {
            char   separator   = TextUtil.GetCsvSeparator(cultureInfo);
            string fileName    = SampleHelp.GetFileName(features.Id.FilePath);
            var    fieldsArray = new List <string>
            {
                Convert.ToString(features.Id, cultureInfo),
                Convert.ToString(features.Id.Run, cultureInfo),
                fileName,
                Convert.ToString(peakGroupFeatures.RetentionTime, cultureInfo),
                Convert.ToString(peakGroupFeatures.StartTime, cultureInfo),
                Convert.ToString(peakGroupFeatures.EndTime, cultureInfo),
                features.Id.NodePep.RawUnmodifiedTextId, // Unmodified sequence, or custom ion name
                features.Id.NodePep.RawTextId,           // Modified sequence, or custom ion name
                features.Id.NodePepGroup.Name,
                Convert.ToString(features.Id.NodePep.IsDecoy ? 1 : 0, cultureInfo),
                ToFieldString((float)mProphetScore, cultureInfo),
                ToFieldString((float)pValue, cultureInfo),
                ToFieldString((float)qValue, cultureInfo)
            };

            if (IsFilterTestData)
            {
                fieldsArray.Add(peakGroupFeatures.GetFilterPairsText(cultureInfo));
            }

            foreach (var name in fieldsArray)
            {
                writer.WriteDsvField(name, separator);
                writer.Write(separator);
            }
            bool first = true;

            foreach (float featureColumn in peakGroupFeatures.Features)
            {
                if (!first)
                {
                    writer.Write(separator);
                }
                writer.WriteDsvField(ToFieldString(featureColumn, cultureInfo), separator);
                first = false;
            }
            writer.WriteLine();
        }
Exemplo n.º 4
0
        private static void WriteRow(TextWriter writer,
                                     PeakTransitionGroupFeatures features,
                                     PeakGroupFeatures peakGroupFeatures,
                                     CultureInfo cultureInfo,
                                     double mProphetScore,
                                     double pValue,
                                     double qValue)
        {
            char   separator   = TextUtil.GetCsvSeparator(cultureInfo);
            string fileName    = SampleHelp.GetFileName(features.Id.FilePath);
            var    fieldsArray = new List <string>
            {
                Convert.ToString(features.Id, cultureInfo),
                Convert.ToString(features.Id.Run, cultureInfo),
                fileName,
                // CONSIDER: This impacts memory consumption for large-scale DIA, and it is not clear anyone uses these
                Convert.ToString(peakGroupFeatures.RetentionTime, cultureInfo),
                Convert.ToString(peakGroupFeatures.StartTime, cultureInfo),
                Convert.ToString(peakGroupFeatures.EndTime, cultureInfo),
                features.Id.RawUnmodifiedTextId, // Unmodified sequence, or custom ion name
                features.Id.RawTextId,           // Modified sequence, or custom ion name
                features.Id.NodePepGroup.Name,
                Convert.ToString(features.IsDecoy ? 1 : 0, cultureInfo),
                ToFieldString((float)mProphetScore, cultureInfo),
                ToFieldString((float)pValue, cultureInfo),
                ToFieldString((float)qValue, cultureInfo)
            };

            foreach (var name in fieldsArray)
            {
                writer.WriteDsvField(name, separator);
                writer.Write(separator);
            }
            bool first = true;

            foreach (float featureColumn in peakGroupFeatures.Features)
            {
                if (!first)
                {
                    writer.Write(separator);
                }
                writer.WriteDsvField(ToFieldString(featureColumn, cultureInfo), separator);
                first = false;
            }
            writer.WriteLine();
        }
Exemplo n.º 5
0
        private void WriteTransitionGroup(TextWriter writer,
                                          PeakTransitionGroupFeatures features,
                                          CultureInfo cultureInfo,
                                          bool bestOnly,
                                          bool includeDecoys)
        {
            var                   id = features.Key;
            int                   bestScoresIndex = -1;
            IList <float>         mProphetScores  = null;
            IList <float>         pValues         = null;
            double                qValue          = double.NaN;
            PeakFeatureStatistics peakFeatureStatistics;

            if (_featureDictionary.TryGetValue(id, out peakFeatureStatistics))
            {
                bestScoresIndex = peakFeatureStatistics.BestScoreIndex;
                mProphetScores  = peakFeatureStatistics.MprophetScores;
                pValues         = peakFeatureStatistics.PValues;
                qValue          = peakFeatureStatistics.QValue ?? double.NaN;
            }
            if (features.IsDecoy && !includeDecoys)
            {
                return;
            }
            int j = 0;

            foreach (var peakGroupFeatures in features.PeakGroupFeatures)
            {
                if (!bestOnly || j == bestScoresIndex)
                {
                    double mProphetScore = mProphetScores != null ? mProphetScores[j] : double.NaN;
                    double pValue        = pValues != null ? pValues[j] : double.NaN;
                    WriteRow(writer, features, peakGroupFeatures, cultureInfo, mProphetScore,
                             pValue, qValue);
                }
                ++j;
            }
        }
Exemplo n.º 6
0
 private static bool IsUnknownScore(PeakTransitionGroupFeatures features, int selectedCalculator)
 {
     return(features.PeakGroupFeatures.Any(groupFeatures => double.IsNaN(groupFeatures.Features[selectedCalculator])));
 }
Exemplo n.º 7
0
 private static bool IsUnknownScore(PeakTransitionGroupFeatures features, int selectedCalculator)
 {
     return features.PeakGroupFeatures.Any(groupFeatures => double.IsNaN(groupFeatures.Features[selectedCalculator]));
 }
Exemplo n.º 8
0
 public PeakFeatureStatistics(PeakTransitionGroupFeatures features, IList<double> mprophetScores, IList<double> pValues, int bestScoreIndex, double? qValue)
 {
     Features = features;
     MprophetScores = mprophetScores;
     PValues = pValues;
     BestScoreIndex = bestScoreIndex;
     QValue = qValue;
 }
Exemplo n.º 9
0
 private void WriteTransitionGroup(TextWriter writer,
     PeakTransitionGroupFeatures features,
     CultureInfo cultureInfo,
     bool bestOnly,
     bool includeDecoys)
 {
     var id = features.Id.Key;
     int bestScoresIndex = -1;
     IList<double> mProphetScores = null;
     IList<double> pValues = null;
     double qValue = double.NaN;
     PeakFeatureStatistics peakFeatureStatistics;
     if (_featureDictionary.TryGetValue(id, out peakFeatureStatistics))
     {
         bestScoresIndex = peakFeatureStatistics.BestScoreIndex;
         mProphetScores = peakFeatureStatistics.MprophetScores;
         pValues = peakFeatureStatistics.PValues;
         qValue = peakFeatureStatistics.QValue ?? double.NaN;
     }
     if (features.Id.NodePep.IsDecoy && !includeDecoys)
         return;
     int j = 0;
     foreach (var peakGroupFeatures in features.PeakGroupFeatures)
     {
         if (!bestOnly || j == bestScoresIndex)
         {
             double mProphetScore = mProphetScores != null ? mProphetScores[j] : double.NaN;
             double pValue = pValues != null ? pValues[j] : double.NaN;
             WriteRow(writer, features, peakGroupFeatures, cultureInfo, mProphetScore,
                      pValue, qValue);
         }
         ++j;
     }
 }
Exemplo n.º 10
0
        private static void WriteRow(TextWriter writer,
            PeakTransitionGroupFeatures features,
            PeakGroupFeatures peakGroupFeatures,
            CultureInfo cultureInfo,
            double mProphetScore,
            double pValue,
            double qValue)
        {
            char separator = TextUtil.GetCsvSeparator(cultureInfo);
            string fileName = SampleHelp.GetFileName(features.Id.FilePath);
            var fieldsArray = new List<string>
                {
                    Convert.ToString(features.Id, cultureInfo),
                    Convert.ToString(features.Id.Run, cultureInfo),
                    fileName,
                    Convert.ToString(peakGroupFeatures.RetentionTime, cultureInfo),
                    Convert.ToString(peakGroupFeatures.StartTime, cultureInfo),
                    Convert.ToString(peakGroupFeatures.EndTime, cultureInfo),
                    features.Id.NodePep.RawUnmodifiedTextId, // Unmodified sequence, or custom ion name
                    features.Id.NodePep.RawTextId, // Modified sequence, or custom ion name
                    features.Id.NodePepGroup.Name,
                    Convert.ToString(features.Id.NodePep.IsDecoy ? 1 : 0, cultureInfo),
                    ToFieldString((float) mProphetScore, cultureInfo),
                    ToFieldString((float) pValue, cultureInfo),
                    ToFieldString((float) qValue, cultureInfo)
                };
            if (IsFilterTestData)
            {
                fieldsArray.Add(peakGroupFeatures.GetFilterPairsText(cultureInfo));
            }

            foreach (var name in fieldsArray)
            {
                writer.WriteDsvField(name, separator);
                writer.Write(separator);
            }
            bool first = true;
            foreach (float featureColumn in peakGroupFeatures.Features)
            {
                if (!first)
                    writer.Write(separator);
                writer.WriteDsvField(ToFieldString(featureColumn, cultureInfo), separator);
                first = false;
            }
            writer.WriteLine();
        }