Esempio n. 1
0
        /// <summary>
        /// Illustrate how to make calls to deisotope a spectrum.
        /// </summary>
        /// <param name="dataAccess"></param>
        private void DeisotopeTest(IMsdrDataReader dataAccess)
        {
            IMsdrPeakFilter filter1 = new MsdrPeakFilter();

            filter1.AbsoluteThreshold = 10;
            filter1.RelativeThreshold = 0.1;
            filter1.MaxNumPeaks       = 0;//no limit on max number of peaks
            IMsdrChargeStateAssignmentFilter csaFilter = new MsdrChargeStateAssignmentFilter();

            IBDASpecFilter f = new BDASpecFilter();

            f.SpectrumType = SpecType.MassSpectrum;

            IBDAMSScanFileInformation msscanFileInfo = dataAccess.MSScanFileInformation;
            int numSpectra     = (int)msscanFileInfo.TotalScansPresent;
            int nNonEmptyCount = 0; // just deisotope the first 10 non-empty spectra

            for (int i = 0; i < numSpectra; i++)
            {
                IBDASpecData spec = dataAccess.GetSpectrum(i, filter1, filter1);//same peak filter used for both MS and MS2 spectra (you can pass in 2 different filters)
                println("Original spectrum has " + spec.TotalDataPoints + " points");
                if (spec.XArray.Length > 0)
                {
                    ++nNonEmptyCount;
                }
                if (nNonEmptyCount > 10)
                {
                    break;
                }
                dataAccess.Deisotope(spec, csaFilter);
                println("  Deisotoped spectrum has " + spec.TotalDataPoints + " points");
            }
        }