Exemplo n.º 1
0
        public ExperimentalSpectra GetExperimentalSpectra(int scanNumber, int scanCount, int chargeState)
        {
            if (!mzAccessor.GetSpectrumByScanNumber(scanNumber, out var specInfo))
            {
                return(null);
            }

            var entries = new List <ExperimentalSpectraEntry>();

            var precursorMass        = specInfo.ParentIonMZ;
            var precursorChargeState = chargeState;

            var mzList        = specInfo.MZList;
            var intensityList = specInfo.IntensityList;

            for (var i = 0; i < mzList.Length; i++)
            {
                var    mz        = mzList[i];
                double intensity = intensityList[i];

                entries.Add(new ExperimentalSpectraEntry(mz, intensity));
            }

            var expSpec = new ExperimentalSpectra(scanNumber, chargeState, precursorMass, precursorChargeState, entries, mPeptideMassCalculator);

            return(expSpec);
        }
Exemplo n.º 2
0
        // Note that Centroid is ignored by this class
        public override bool GetRawData(out List <double> mzs, out List <double> intensities, int scan_num, bool centroid, int num_pts)
        {
            if (scan_num > mint_num_scans)
            {
                var mesg = "File only has " + mint_num_scans + " scans. Cannot read to scan number: " + scan_num;
                throw new Exception(mesg);
            }

            mint_current_scan = scan_num;
            mobj_MzXmlFile.GetSpectrumHeaderInfoByScanNumber(scan_num, out mobj_CurrentScanData);

            mzs         = new List <double>();
            intensities = new List <double>();

            var scanData = new clsSpectrumInfo();

            mobj_MzXmlFile.GetSpectrumByScanNumber(scan_num, out scanData);

            var num_points = scanData.DataCount;

            if (num_pts > 0 && num_pts < num_points)
            {
                num_points = num_pts;
            }

            mzs.Capacity         = num_points;
            intensities.Capacity = num_points;
            double fMass;
            double fInten;
            var    max_intensity = -1 * double.MaxValue;
            var    min_intensity = double.MaxValue;

            for (var i = 0; i < scanData.DataCount; i++)
            {
                fMass  = scanData.MZList[i];
                fInten = scanData.IntensityList[i];
                if (fInten > max_intensity)
                {
                    max_intensity = fInten;
                }
                if (fInten < min_intensity) //Anoop Jan 08: was > before
                {
                    min_intensity = fInten;
                }
                mzs.Add(fMass);
                intensities.Add(fInten);
            }

            mdbl_signal_level = max_intensity - min_intensity;

            return(true);
        }