예제 #1
0
        // Feature, precursorScore, totalScore
        public Tuple<Feature, double, double> GetBestFeatureAndScore(int precursorCharge)
        {
            var precursorIon = new Ion(_sequenceComposition + Composition.H2O, precursorCharge);
            var imsScorer = _imsScorerFactory.GetImsScorer(_imsData, precursorIon);

            var precursorFeatureSet = _imsData.GetPrecursorFeatures(precursorIon.GetMz());
            var bestPrecursorScore = double.NegativeInfinity;
            var bestScore = double.NegativeInfinity;
            Feature bestFeature = null;
            foreach (var precursorFeature in precursorFeatureSet)
            {
                var precursorScore = imsScorer.GetPrecursorScore(precursorFeature);
                if (precursorScore < PrecursorScoreThreshold) continue;
                var productScore = GetProductIonScore(imsScorer, precursorFeature);

                var curFeatureScore = precursorScore + productScore;
                if (curFeatureScore > bestScore)
                {
                    bestPrecursorScore = precursorScore;
                    bestScore = curFeatureScore;
                    bestFeature = precursorFeature;
                }
            }

            return new Tuple<Feature, double, double>(bestFeature, bestPrecursorScore, bestScore);
        }