示例#1
0
        /// <summary>
        /// Get all rt index entries by rt range.
        /// </summary>
        public static IEnumerable <RtIndexEntry> Search(
            this IMzLiteArray <RtIndexEntry> rti,
            RangeQuery rtRange)
        {
            if (rti == null)
            {
                throw new ArgumentNullException("rti");
            }

            return(BinarySearch.Search(rti, rtRange, RtSearchCompare));
        }
示例#2
0
        /// <summary>
        /// Get all peaks by rt range.
        /// </summary>
        public static IEnumerable <TPeak> RtSearch <TPeak>(
            this IMzLiteArray <TPeak> peaks,
            RangeQuery rtRange) where TPeak : Peak2D
        {
            if (peaks == null)
            {
                throw new ArgumentNullException("peaks");
            }

            return(BinarySearch.Search(peaks, rtRange, RtSearchCompare));
        }
示例#3
0
            internal SwathSpectrumEntry SearchClosestRt(SwathQuery query)
            {
                IndexRange result;

                if (BinarySearch.Search(swathSpectra, query, RtRangeCompare, out result))
                {
                    return(IndexRange.EnumRange(swathSpectra, result)
                           .ItemAtMin(x => CalcLockRtDiffAbs(x, query)));
                }
                else
                {
                    return(null);
                }
            }
示例#4
0
            internal MSSwath SearchClosestTargetMz(SwathQuery query)
            {
                IndexRange result;

                if (BinarySearch.Search(swathes, query.TargetMz, SearchCompare, out result))
                {
                    return(IndexRange.EnumRange(swathes, result)
                           .ItemAtMin(x => CalcTargetMzDiffAbs(x, query)));
                }
                else
                {
                    return(null);
                }
            }
示例#5
0
        public Peak2D[] GetMS2(
            IMzLiteDataReader dataReader,
            SwathQuery query,
            Func <IEnumerable <Peak1D>, RangeQuery, Peak1D> mzRangeSelector = null)
        {
            if (dataReader == null)
            {
                throw new ArgumentNullException("dataReader");
            }
            if (query == null)
            {
                throw new ArgumentNullException("query");
            }
            if (mzRangeSelector == null)
            {
                mzRangeSelector = GetClosestMz;
            }

            MSSwath swath = swathList.SearchClosestTargetMz(query);

            if (swath == null)
            {
                return(new Peak2D[0]);
            }

            SwathSpectrumEntry swathSpec = swath.SearchClosestRt(query);

            if (swathSpec == null)
            {
                return(new Peak2D[0]);
            }

            Peak1DArray spectrumPeaks = dataReader.ReadSpectrumPeaks(swathSpec.SpectrumID);

            Peak2D[] ms2Peaks = new Peak2D[query.CountMS2Masses];

            for (int i = 0; i < query.CountMS2Masses; i++)
            {
                RangeQuery           mzRange = query[i];
                IEnumerable <Peak1D> mzPeaks = BinarySearch.Search(spectrumPeaks.Peaks, mzRange, MzRangeCompare);
                Peak1D p = mzRangeSelector(mzPeaks, mzRange);
                ms2Peaks[i] = new Peak2D(p.Intensity, p.Mz, swathSpec.Rt);
            }

            return(ms2Peaks);
        }
示例#6
0
 internal IEnumerable <SwathSpectrumEntry> SearchAllRt(SwathQuery query)
 {
     return(BinarySearch.Search(swathSpectra, query, RtRangeCompare));
 }
示例#7
0
 internal IEnumerable <MSSwath> SearchAllTargetMz(double targetMz)
 {
     return(BinarySearch.Search(swathes, targetMz, SearchCompare));
 }