コード例 #1
0
        void scanArrived_Response(object sender, MsScanEventArgs e)
        {
            try
            {
                Console.WriteLine("Scan arrived.");
                logfile.WriteLine("Scan arrived.");
                if (!authorized_for_run)
                {
                    Console.WriteLine("Ignoring pre-emptive scan.");
                    logfile.WriteLine("Ignoring pre-emptive scan.");
                    return;
                }
                else if (!accepting_scans)
                {
                    Console.WriteLine("Ignoring wait-time scan.");
                    logfile.WriteLine("Ignoring wait-time scan.");
                    return;
                }
                IMsScan scandata = e.GetScan();

                if (runTimeKeeper.Elapsed > intendedRunTime)
                {
                    Console.WriteLine("Ignoring extraneous scan.");
                    logfile.WriteLine("Ignoring extraneous scan.");
                }
                else
                {
                    Console.Write('<');
                    planner_MUT.WaitOne();
                    Console.Write('_');
                    runProgram.receiveScan(scandata);
                    scandata.Dispose();
                    planner_MUT.ReleaseMutex();
                    Console.Write('>');
                    logfile.Flush();
                }
            }
            catch (Exception err)
            {
                Console.WriteLine("Caught error in scanArrived_response!  Cancelling voltage.");
                change_voltage(0);
                Console.WriteLine(err.ToString());
                throw;
            }
        }
コード例 #2
0
        public override void receiveScan(IMsScan scanData)
        {
            //IInfoContainer info = scanData.CommonInformation;
            //IInfoContainer more_info = scanData.SpecificInformation;
            //MsScanInformationSource infosource = MsScanInformationSource.Unknown;
            object   obj_holder = null;
            ScanType scan_id    = ScanType.Unknown;
            int      scannum    = -1;

            //if (info.TryGetRawValue("Scan", out obj_holder, ref infosource))
            //{
            //    scannum = (int)obj_holder;
            //    if (ScanID.ContainsKey(scannum)) // Auto-scans also have Scan numbers!
            //    {
            //        scan_id = ScanID[scannum];
            //        ScanID.Remove(scannum);
            //    }
            //}
            //object accessid = null;
            if (scanData.SpecificInformation.TryGetRawValue("Access Id:", out obj_holder))
            {
                scannum = (int)obj_holder;
                if (ScanID.ContainsKey(scannum))
                {
                    scan_id = ScanID[scannum];
                    ScanID.Remove(scannum);
                }
            }

            //Debug.Assert(false);
            if (scannum >= ScanCount)
            {
                Console.WriteLine("Adjusting ScanCount: " + scannum.ToString() + " " + ScanCount.ToString());
                log_write("Adjusting ScanCount: " + scannum.ToString() + " " + ScanCount.ToString());
                ScanCount = scannum + 1;
            }
            //else if (scannum + 100 < ScanCount)
            //{
            //    Console.WriteLine("Adjusting ScanCount DOWNWARD: " + scannum.ToString() + " " + ScanCount.ToString());
            //    log_write("Adjusting ScanCount DOWNWARD: " + scannum.ToString() + " " + ScanCount.ToString());
            //    ScanCount = scannum + 1;
            //}

            Console.WriteLine("Received a " + scan_id.ToString() + " " + scannum.ToString());
            log_write("Received a " + scan_id.ToString() + " " + scannum.ToString());

            switch (scan_id)
            {
            case ScanType.MS2:
            case ScanType.Auto:
            case ScanType.Unknown:
                return;

            case ScanType.MS1:
                MS1_outstanding = false;

                IEnumerable <Tuple <double, double> >               scan             = Spectral_Processing.ConvertCentroids(scanData.Centroids);
                List <Tuple <int, Tuple <double, double> > >        molecular_peaks  = Spectral_Processing.deisotope_scan(scan);
                IEnumerable <Tuple <int, Tuple <double, double> > > valid_precursors = molecular_peaks.Where(x => x.Item1 > 1);

                IEnumerable <Tuple <int, Tuple <double, double> > > precursors_by_int = valid_precursors.OrderByDescending(OrderPeak);

                GenerateMS2s(precursors_by_int);
                Console.WriteLine("MS1 stats: " + scan.Count() + " " + valid_precursors.Count());
                log_write("MS1 stats: " + scan.Count() + " " + valid_precursors.Count());
                return;

            default:
                Debug.Assert(false);
                return;
            }
        }
コード例 #3
0
 public MSScanEventArgs(SimScan simScan)
 {
     scan = simScan;
 }
コード例 #4
0
        public override void receiveScan(IMsScan scanData)
        {
            //IInfoContainer info = scanData.CommonInformation;
            //IInfoContainer more_info = scanData.SpecificInformation;
            //MsScanInformationSource infosource = MsScanInformationSource.Unknown;
            object   obj_holder = null;
            ScanType scan_id    = ScanType.Unknown;
            int      scannum    = -1;

            //if (info.TryGetRawValue("Scan", out obj_holder, ref infosource))
            //{
            //    scannum = (int)obj_holder;
            //    if (ScanID.ContainsKey(scannum)) // Auto-scans also have Scan numbers!
            //    {
            //        scan_id = ScanID[scannum];
            //        ScanID.Remove(scannum);
            //    }
            //}
            //object accessid = null;
            if (scanData.SpecificInformation.TryGetRawValue("Access Id:", out obj_holder))
            {
                scannum = (int)obj_holder;
                if (ScanID.ContainsKey(scannum))
                {
                    scan_id = ScanID[scannum];
                    ScanID.Remove(scannum);
                }
            }

            if (scannum > ScanCount)
            {
                Console.WriteLine("Adjusting ScanCount: " + scannum.ToString() + " " + ScanCount.ToString());
                log_write("Adjusting ScanCount: " + scannum.ToString() + " " + ScanCount.ToString());
                ScanCount = scannum + 1;
            }
            //else if (scannum + 100 < ScanCount)
            //{
            //    Console.WriteLine("Adjusting ScanCount DOWNWARD: " + scannum.ToString() + " " + ScanCount.ToString());
            //    log_write("Adjusting ScanCount DOWNWARD: " + scannum.ToString() + " " + ScanCount.ToString());
            //    ScanCount = scannum + 1;
            //}

            Console.WriteLine("Received a " + scan_id.ToString() + " " + scannum.ToString());
            log_write("Received a " + scan_id.ToString() + " " + scannum.ToString());

            switch (scan_id)
            {
            case ScanType.MS1:
            case ScanType.MS2:
            case ScanType.Auto:
            case ScanType.Unknown:
                // Only Box-MS1 scans are being used for precursor assignment.
                // Other scans are merely written to the file automatically.
                return;

            case ScanType.BoxMS1_1:
            case ScanType.BoxMS1_2:
            case ScanType.BoxMS1_3:
                //MS1_outstanding -= 1;
                Debug.Assert(!BoxAggregation.ContainsKey(scan_id));
                BoxAggregation.Add(scan_id, Spectral_Processing.ConvertCentroids(scanData.Centroids).ToList());
                Console.WriteLine("Received MS1 " + MS1_outstanding.ToString() + " " + BoxAggregation.Count().ToString());


                if (BoxAggregation.Count() >= 3)
                {
                    log_write("Processing boxes. " + BoxAggregation.Keys.ToString());

                    MS1_outstanding = false;

                    IEnumerable <Peak> scan = BoxesToMS1();

                    List <Peak>        molecular_peaks  = Spectral_Processing.deisotope_scan(scan);
                    IEnumerable <Peak> valid_precursors = molecular_peaks.Where(x => x.Item1 > 1);

                    IEnumerable <Peak> precursors_by_int = valid_precursors.OrderByDescending(OrderPeak);

                    GenerateMS2s(precursors_by_int);
                }
                return;

            default:
                Debug.Assert(false);
                return;
            }
        }
コード例 #5
0
 public abstract void receiveScan(IMsScan scanData);