Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            frmPeakpara = new frmPeakParameters();
            frmPeakpara.ShowDialog();
            //ReadGlycanList();

            System.Diagnostics.PerformanceCounter Proc = new System.Diagnostics.PerformanceCounter("Memory", "Available MBytes");
            int freeMemory = Convert.ToInt32(Proc.NextValue() * 0.7f);

            _Raw = new XRawReader(@"D:\Dropbox\for_Yunli_Hu\b1_19_1_07142012.raw");
            //MultiNGlycanESIMultiThreads main = new MultiNGlycanESIMultiThreads(_GlycanList, _Raw, NoOfThread, frmPeakpara.PeakProcessorParameters, frmPeakpara.TransformParameters);
            //main.ProcessWithMultiThreads();
        }
        private void SplitDataset()
        {
            System.Diagnostics.PerformanceCounter Proc = new System.Diagnostics.PerformanceCounter("Memory", "Available MBytes");
            int freeMemory = Convert.ToInt32(Proc.NextValue() * 0.7f);
            int MaxScanInOneSet = Convert.ToInt32(((freeMemory / _noOfThreads) / 45.0f) * 100.0f);
            if (MaxScanInOneSet >= 3000)
            {
                MaxScanInOneSet = 3000;
            }
            XRawReader rawReader = new XRawReader(rawFiles.Peek());
            List<int> MSScanNo = new List<int>();
            _splitDataset = new List<List<int>>();
            for (int i = StartScan; i <= EndScan; i++)
            {
                if (rawReader.GetMsLevel(i) == 1)
                {
                    MSScanNo.Add(i);
                }
            }
            int NoOfSet = Convert.ToInt32( Math.Ceiling(MSScanNo.Count / (double)MaxScanInOneSet));

            for (int i = 1; i <= NoOfSet; i++)
            {
                _splitDataset.Add(new List<int>());
            }
            int DataSetIdx = 0;
            for (int i = 0; i < MSScanNo.Count; i++)
            {
                _splitDataset[DataSetIdx].Add(MSScanNo[i]);
                DataSetIdx++;
                if (DataSetIdx == NoOfSet)
                {
                    DataSetIdx = 0;
                }
            }
            rawReader.Close();
        }
        public void ProcessWithMultiThreads()
        {
            XRawReader rawReader;
            for (int i = 0; i < _noOfThreads; i++)
            {
                rawReader = new XRawReader(rawFiles.Pop());
               /* Thread p = new Thread(new MultiNGlycanESI(rawReader, _splitDataset[i], _ListGlycompound, _MassPPM, _GlycanPPM, _MergeDurationMin, _Permenthylated, _ReducedReducingEnd,));

               /* _multiESIProcessor.PeakProcessorParameters = _peakParameter;
                _multiESIProcessor.TransformParameters = _transformParameter;
                _multiESIThreads[i] = _multiESIProcessor;
                ThreadPool.QueueUserWorkItem(_multiESIProcessor.Process);*/
            }
        }