Beispiel #1
0
        public int IsInWithPPM(double mass, int[] mass_inten, ref double mass_error) //误差窗口内最高峰
        {
            int start = (int)(mass - mass * Ppm_mass_error);
            int end   = (int)(mass + mass * Ppm_mass_error);

            if (start <= 0 || end >= Config_Help.MaxMass)
            {
                return(-1);
            }
            double maxInten = 0.0;
            int    max_k    = -1;

            for (int k = mass_inten[start - 1]; k < mass_inten[end]; ++k)
            {
                PEAK   peak = (PEAK)(Spec.Peaks[k]);
                double tmpd = System.Math.Abs((peak.Mass - mass) / mass);
                if (tmpd <= Ppm_mass_error && peak.Intensity > maxInten)
                {
                    maxInten = peak.Intensity;
                    max_k    = k;
                }
            }
            if (max_k != -1)
            {
                mass_error = (((PEAK)(Spec.Peaks[max_k])).Mass - mass) * 1.0e6 / mass; //实验质量-理论质量
            }
            return(max_k);
        }
Beispiel #2
0
 public bool Equals(PEAK other)
 {
     if (other == null)
     {
         return(false);
     }
     return(this.Mass.Equals(other.Mass));  // && this.mod_index.Equals(other.mod_index)
 }
Beispiel #3
0
        private void translateCharge(int j, Spectra out_spectra, int charge)
        {
            double mass = this.Peaks[j].Mass;

            mass *= charge;
            mass -= ((charge - 1) * Config_Help.massZI);
            PEAK peak = new PEAK(mass, this.Peaks[j].Intensity);

            out_spectra.Peaks.Add(peak);
        }
Beispiel #4
0
        public double Value;           //Mass_Error+30*Intensity_Error

        public MS1_Pair_Peak(PEAK ori_peak, PEAK pair_peak, double N_mass, int N_number)
        {
            this.Ori_Peak        = ori_peak;
            this.Pair_Peak       = pair_peak;
            this.N_Mass          = N_mass;
            this.N_Number        = N_number;
            this.Mass_Error      = Math.Abs(Math.Abs(Ori_Peak.Mass - Pair_Peak.Mass) - N_mass) * 1e6 / Ori_Peak.Mass;
            this.Intensity_Error = Math.Abs(Pair_Peak.Intensity / Ori_Peak.Intensity - 1);
            this.Value           = Mass_Error + Intensity_Error * 30;
        }
Beispiel #5
0
        int IComparable.CompareTo(Object obj)
        {
            PEAK temp = (PEAK)obj;

            if (this.Mass > temp.Mass)
            {
                return(1);
            }
            else if (this.Mass < temp.Mass)
            {
                return(-1);
            }
            return(0);
        }
Beispiel #6
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            PEAK temp = obj as PEAK;

            if (temp == null)
            {
                return(false);
            }
            else
            {
                return(Equals(temp));
            }
        }
Beispiel #7
0
        //误差在ppm_mass_error范围内的误差最小的峰的索引号
        public static int IsInWithPPM2(double mass, int[] mass_inten, double ppm_mass_error, ObservableCollection <PEAK> peaks)
        {
            int start = (int)(mass - mass * ppm_mass_error);
            int end   = (int)(mass + mass * ppm_mass_error);

            if (start <= 0 || end >= Config_Help.MaxMass)
            {
                return(-1);
            }
            double min_mz_error = double.MaxValue;
            int    min_k        = -1;

            for (int k = mass_inten[start - 1]; k < mass_inten[end]; ++k)
            {
                PEAK   peak = (PEAK)(peaks[k]);
                double tmpd = System.Math.Abs((peak.Mass - mass) / mass);
                if (tmpd <= ppm_mass_error && tmpd < min_mz_error)
                {
                    min_mz_error = tmpd;
                    min_k        = k;
                }
            }
            return(min_k);
        }
Beispiel #8
0
        //误差在ppm_mass_error范围内的最高峰的索引号
        public static int IsInWithPPM(double mass, int[] mass_inten, double ppm_mass_error, ObservableCollection <PEAK> peaks)
        {
            int start = (int)(mass - mass * ppm_mass_error);
            int end   = (int)(mass + mass * ppm_mass_error);

            if (start <= 0 || end >= Config_Help.MaxMass)
            {
                return(-1);
            }
            double maxInten = 0.0;
            int    max_k    = -1;

            for (int k = mass_inten[start - 1]; k < mass_inten[end]; ++k)
            {
                PEAK   peak = (PEAK)(peaks[k]);
                double tmpd = System.Math.Abs((peak.Mass - mass) / mass);
                if (tmpd <= ppm_mass_error && peak.Intensity > maxInten)
                {
                    maxInten = peak.Intensity;
                    max_k    = k;
                }
            }
            return(max_k);
        }