CSMSL.Tolerance.GetRange C# (CSharp) Метод

GetRange() публичный Метод

Gets the range of values encompassed by this tolerance
public GetRange ( double mean ) : DoubleRange
mean double The mean value
Результат DoubleRange
        public DoubleRange GetRange(double mean)
        {
            double value = Value*((Type == ToleranceType.PlusAndMinus) ? 2 : 1);

            double tol;
            switch (Unit)
            {
                case ToleranceUnit.MMU:
                    tol = value/2000.0;
                    break;

                case ToleranceUnit.PPM:
                    tol = value*mean/2e6;
                    break;

                default:
                    tol = value/2.0;
                    break;
            }
            return new DoubleRange(mean - tol, mean + tol);
        }

Usage Example

Пример #1
0
 public static double GetPValue(PSM psm, Tolerance prod_tolerance, double cutoff)
 {
     // Get the width of the product ion tolerance at the isolation mz;
     double productToleranceWidth = prod_tolerance.GetRange(psm.IsolationMZ).Width;
     double cutoffThreshold = psm.Spectrum.GetBasePeakIntensity()*cutoff;
     return Math.Min(1.0, psm.Spectrum.Count(peak => peak.Intensity >= cutoffThreshold)*2*productToleranceWidth/psm.ScanWidth);
 }