private List<List<XYPoint>> GetMSMSDataArraysFromMSScans(List<int> scanList, double mzlower, double mzupper)
        {
            List<List<XYPoint>> msValuesList = new List<List<XYPoint>>(500);
            SpectrumList spectrumList = run.spectrumList;
            int timePoints = spectrumList.size();

            List<List<XYPoint>> msmsValuesList = new List<List<XYPoint>>(500);
            List<int> tempScanList = new List<int>();

            if (scanList == null)
            {
                for (int i = 0; i < timePoints; i++)
                {
                    tempScanList.Add(i);
                }
            }
            else
            {
                tempScanList = scanList;
            }

            for (int i = 0; i < tempScanList.Count; i++)
            {
                pwiz.CLI.msdata.Spectrum spectrum = spectrumList.spectrum(tempScanList[i], true);

                string level = (string)spectrum.cvParam(CVID.MS_ms_level).value;
                bool foundSelectedIon = false;
                if (level == "2")
                {
                    PrecursorList precursorlist = spectrum.precursors;

                    foreach (Precursor pc in precursorlist)
                    {
                        foreach (SelectedIon si in pc.selectedIons)
                        {
                            double selectedIonMZ = (double)si.cvParam(CVID.MS_selected_ion_m_z).value;
                            if (selectedIonMZ >= mzlower && selectedIonMZ <= mzupper)
                            {
                                foundSelectedIon = true;
                            }
                        }
                    }
                }
                if (foundSelectedIon)
                {
                    BinaryDataArray mzArray = spectrum.getMZArray();
                    BinaryDataArray intensityArray = spectrum.getIntensityArray();
                    BinaryData mzData = mzArray.data;
                    BinaryData intensityData = intensityArray.data;

                    List<XYPoint> msmsValues = new List<XYPoint>(1000);

                    for (int j = 0; j < mzData.Count; j++)
                    {
                        XYPoint pair = new XYPoint(mzData[j], intensityData[j]);
                        pair.NumberOfDuplicates = 0;
                        msmsValues.Add(pair);
                    }
                    msmsValuesList.Add(msmsValues);
                }
            }
            return msmsValuesList;
        }
Example #2
0
 private static void ApplyThreshold(XYPoint point)
 {
     point.XValue = Math.Truncate(point.XValue * 1000000) / 1000000;
 }