Пример #1
0
        private static MzLite.Model.MassSpectrum GetSpectrum(
            Batch batch,
            MassSpectrometerSample sample,
            MSExperiment msExp,
            int sampleIndex,
            int experimentIndex,
            int scanIndex)
        {
            MassSpectrumInfo wiffSpectrum = msExp.GetMassSpectrumInfo(scanIndex);

            MzLite.Model.MassSpectrum mzLiteSpectrum = new Model.MassSpectrum(ToSpectrumID(sampleIndex, experimentIndex, scanIndex));

            // spectrum

            IParamEdit paramEdit = mzLiteSpectrum.BeginParamEdit();

            paramEdit.MS_MsLevel(wiffSpectrum.MSLevel);

            if (wiffSpectrum.CentroidMode)
            {
                paramEdit.MS_CentroidSpectrum();
            }
            else
            {
                paramEdit.MS_ProfileSpectrum();
            }

            // scan

            Scan scan = new Scan();

            scan.BeginParamEdit()
            .MS_ScanStartTime(wiffSpectrum.StartRT)
            .UO_Minute();

            mzLiteSpectrum.Scans.Add(scan);

            // precursor

            if (wiffSpectrum.IsProductSpectrum)
            {
                Precursor precursor = new Precursor();

                double isoWidth;
                double targetMz;

                if (GetIsolationWindow(wiffSpectrum.Experiment, out isoWidth, out targetMz))
                {
                    precursor.IsolationWindow.BeginParamEdit()
                    .MS_IsolationWindowTargetMz(targetMz)
                    .MS_IsolationWindowUpperOffset(isoWidth)
                    .MS_IsolationWindowLowerOffset(isoWidth);
                }

                SelectedIon selectedIon = new SelectedIon();

                selectedIon.BeginParamEdit()
                .MS_SelectedIonMz(wiffSpectrum.ParentMZ)
                .MS_ChargeState(wiffSpectrum.ParentChargeState);

                precursor.SelectedIons.Add(selectedIon);

                precursor.Activation.BeginParamEdit()
                .MS_CollisionEnergy(wiffSpectrum.CollisionEnergy);

                mzLiteSpectrum.Precursors.Add(precursor);
            }

            return(mzLiteSpectrum);
        }