Example #1
0
        public static PSM getPSM_BySpectra(Spectra spec)
        {
            PSM psm = new PSM(0, spec.Title, "", "", 0.0, spec.Pepmass, 0.0, 0.0, 0.0, 0.0, ' ', "0", true, "", 0);

            psm.Charge       = spec.Charge;
            psm.Spectra_mass = spec.Pepmass * spec.Charge - Config_Help.massZI * (spec.Charge - 1);
            return(psm);
        }
Example #2
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);
        }
Example #3
0
        private bool deisotpeChargeHCD(int j, Spectra out_spectra, int charge, List <int> PeaksTag, double ppm_me, double da_me, bool isNeed_translate = true)
        {
            double          deviation    = Config_Help.mass_ISO / charge;
            double          lfCurrentVal = this.Peaks[j].Mass + deviation;
            double          d1           = calc(ppm_me, da_me, this.Peaks[j].Mass);
            SortedSet <int> PeakR        = new SortedSet <int>();
            bool            tag          = false;

            for (int k = j + 1; k < this.Peaks.Count; ++k)
            {
                double d2 = calc(ppm_me, da_me, this.Peaks[k].Mass);
                double d  = (d1 + d2) / 2;
                if (this.Peaks[k].Mass >= lfCurrentVal - d && this.Peaks[k].Mass <= lfCurrentVal + d)
                {
                    lfCurrentVal = this.Peaks[k].Mass + deviation;
                    d1           = d2;
                    PeaksTag[k]  = charge;
                    PeaksTag[j]  = charge;
                    PeakR.Add(k);
                    PeakR.Add(j);
                    tag = true;
                }
                else if (this.Peaks[k].Mass > lfCurrentVal + d)
                {
                    break;
                }
            }

            if (tag)
            {
                bool flag = false;
                foreach (int i in PeakR)
                {
                    if (flag && this.Peaks[i].Intensity < this.Peaks[PeakR.First()].Intensity)
                    {
                        continue;
                    }
                    if (isNeed_translate)
                    {
                        translateCharge(i, out_spectra, charge);
                    }
                    else
                    {
                        translateCharge(i, out_spectra, 1);
                    }
                    flag = true;
                }
                return(true);
            }
            return(false);
        }
Example #4
0
        private void delete_isotope(double ppm_me, double da_me, bool isNeed_translate = true) //去同位素峰并转化成单电荷
        {
            Spectra    out_spectra = new Spectra();
            List <int> PeaksTag    = new List <int>();

            for (int j = 0; j < this.Peaks.Count; ++j)
            {
                PeaksTag.Add(0);
            }
            for (int j = 0; j < this.Peaks.Count; ++j)
            {
                if (PeaksTag[j] > 0)
                {
                    continue;
                }
                for (int c = this.Charge; c >= 1; --c)
                {
                    if (deisotpeChargeHCD(j, out_spectra, c, PeaksTag, ppm_me, da_me, isNeed_translate))
                    {
                        break;
                    }
                }
                if (PeaksTag[j] == 0)
                {
                    if (isNeed_translate)
                    {
                        translateCharge(j, out_spectra, 1);
                        translateCharge(j, out_spectra, 2);
                    }
                    else
                    {
                        translateCharge(j, out_spectra, 1);
                    }
                }
            }
            List <PEAK> peaks = new List <PEAK>(out_spectra.Peaks);

            peaks.Sort();
            this.Peaks = new ObservableCollection <PEAK>(peaks);
        }
Example #5
0
 public Pnovo_Help(string mgf_path, string output_path, Spectra spectra)
 {
     this.mgf_path    = mgf_path;
     this.output_path = output_path;
     this.spectra     = spectra;
 }