Ejemplo n.º 1
0
        private static int Compare(SWATHIndexerItem item, double mz, double rt, double rtOffset)
        {
            if (item.MzEnd < mz)
            {
                return(-1);
            }

            if (item.MzStart > mz)
            {
                return(1);
            }

            double lowRt = SaveSubtract(rt, rtOffset);

            if (item.Rt < lowRt)
            {
                return(-1);
            }

            double heighRt = SaveAdd(rt, rtOffset);

            if (item.Rt > heighRt)
            {
                return(1);
            }

            return(0);
        }
Ejemplo n.º 2
0
        public static SWATHIndexer Build(IMzLiteDataReader reader, string runID, Func <MassSpectrum, SWATHIndexerItem> createItem)
        {
            IList <SWATHIndexerItem> list = new List <SWATHIndexerItem>(65000);

            foreach (MassSpectrum ms in reader.ReadMassSpectra(runID))
            {
                SWATHIndexerItem item = createItem.Invoke(ms);

                if (item != null)
                {
                    list.Add(item);
                }
            }

            SWATHIndexer indexer = new SWATHIndexer();

            indexer.items = new SWATHIndexerItem[list.Count];
            list.CopyTo(indexer.items, 0);

            Array.Sort(indexer.items, new ItemSorting());

            return(indexer);
        }