Пример #1
0
 /// <summary>
 /// Resets all parameters to default values.
 /// </summary>
 private void Clear()
 {
     m_userTolerances              = new FeatureMatcherTolerances();
     m_useEllipsoid                = true;
     m_shouldCalculateShiftFDR     = true;
     m_shouldCalculateSTAC         = true;
     m_shouldCalculateHistogramFDR = false;
     m_shouldCalculateSLiC         = true;
     m_useDriftTime                = false;
     m_usePriors           = true;
     m_chargeStateList     = new List <int>();
     m_shiftAmount         = 11.0;
     m_histogramBinWidth   = 0.02;
     m_histogramMultiplier = 0.1;
 }
Пример #2
0
        /// <summary>
        /// Sets the internal flag as to whether the match is within the given tolerances.
        /// </summary>
        /// <param name="tolerances">Tolerances to use for matching.</param>
        /// <param name="useElllipsoid">Whether to use ellipsoidal region for matching.</param>
        /// <returns></returns>
        public bool InRegion(FeatureMatcherTolerances tolerances, bool useElllipsoid)
        {
            if (m_targetFeature == new TTarget())
            {
                throw new InvalidOperationException("Match must be populated before using functions involving the match.");
            }
            var toleranceMatrix = tolerances.AsVector(true);

            if (m_reducedDifferenceVector != new DenseMatrix(2, 1))
            {
                var dimensions = m_reducedDifferenceVector.RowCount;

                if (useElllipsoid)
                {
                    double distance = 0;
                    for (var i = 0; i < dimensions; i++)
                    {
                        distance += m_reducedDifferenceVector[i, 0] * m_reducedDifferenceVector[i, 0] / toleranceMatrix[i, 0] / toleranceMatrix[i, 0];
                    }
                    m_withinRefinedRegion = (distance <= 1);
                }
                else
                {
                    var truthValue = true;
                    for (var i = 0; i < dimensions; i++)
                    {
                        truthValue = (truthValue && Math.Abs(m_reducedDifferenceVector[i, 0]) <= toleranceMatrix[i, 0]);
                    }
                    m_withinRefinedRegion = truthValue;
                }
            }
            else
            {
                if (useElllipsoid)
                {
                    double distance = 0;
                    var    massDiff = m_observedFeature.MassMonoisotopicAligned - m_targetFeature.MassMonoisotopicAligned;
                    var    netDiff  = m_observedFeature.NetAligned - m_targetFeature.NetAligned;
                    distance += massDiff * massDiff / toleranceMatrix[0, 0] / toleranceMatrix[0, 0];
                    distance += netDiff * netDiff / toleranceMatrix[1, 0] / toleranceMatrix[1, 0];
                    // TODO: Add drift time difference.
                    m_withinRefinedRegion = (distance <= 1);
                }
            }
            return(m_withinRefinedRegion);
        }