private void Orbitrap_MsScanArrived(object sender, MsScanEventArgs e) { string accessId; using (IMsScan scan = (IMsScan)e.GetScan()) // caution! You must dispose this, or you block shared memory! { // The access ID gives a feedback about placed scans or scans generated by the instrument. scan.SpecificInformation.TryGetValue("Access Id:", out accessId); Console.WriteLine("{0:HH:mm:ss,fff} scan {1} arrived", DateTime.Now, accessId); ////// The common part is shared by all Thermo Fisher instruments, these settings mainly form the so called filter string ////// which also appears on top of each spectrum in many visualizers. //Console.WriteLine("----------------Common--------------"); //Dump("Common", scan.CommonInformation); ////// The specific part is individual for each instrument type. Many values are shared by different Exactive Series models. //Console.WriteLine("----------------Specific--------------"); // Dump("Specific", scan.SpecificInformation); //Dump(scan); var ib = IsBoxCarScan(scan); Console.WriteLine("IsBoxCar Scan: {0}", ib); FullScan.PlaceFullScan(m_scans, Parameters); //List<double> dynamicBoxCarRange = new List<double> { 600, 700, 800, 900, 1000 }; //BoxCarScan.PlaceBoxCarScan(m_scans, Parameters, dynamicBoxCarRange); DataDependentScan.PlaceMS2Scan(m_scans, Parameters, 750); BoxCarScan.PlaceStaticBoxCarScan(m_scans, Parameters); } }
//In bottom up, it is possible to change the BoxCar ranges based on the real full mass scan. //The workflow works, but the improvement is hard to evaluate so far. private void AddScanIntoQueue_BynamicBoxCar_BU(IMsScan scan) { try { //Is MS1 Scan if (scan.HasCentroidInformation && IsMS1Scan(scan)) { bool isBoxCarScan = IsBoxCarScan(scan); //string scanNumber; //scan.CommonInformation.TryGetValue("ScanNumber", out scanNumber); Console.WriteLine("In DynamicBoxCar_BU method, MS1 Scan arrived. Is BoxCar Scan: {0}.", isBoxCarScan); if (!isBoxCarScan) { List <IsoEnvelop> isoEnvelops = Deconvolute_BU(scan); if (isoEnvelops.Count > 0) { if (Parameters.MS2ScanSetting.DoMS2) { PlaceBU_MS2Scan(scan, isoEnvelops); } BoxCarScan.GenerateDynamicBoxes_BU(isoEnvelops, Parameters, Boxes); FullScan.PlaceFullScan(m_scans, Parameters); //The nearby Full mass scans in the current DDA method are very similar, so it is possible to use the previous full scan to generate the current boxes. if (Boxes.Count > 0) { BoxCarScan.PlaceDynamicBoxCarScan_BU(m_scans, Parameters, Boxes); //To generate data for comparison BoxCarScan.PlaceStaticBoxCarScan(m_scans, Parameters); Boxes.Clear(); } } else { FullScan.PlaceFullScan(m_scans, Parameters); } } } } catch (Exception e) { Console.WriteLine("AddScanIntoQueue_DynamicBoxCar_Bu MS2FromFullScan Exception!"); Console.WriteLine(e.ToString() + " " + e.Source); } }
//In StaticBox, the MS1 scan contains a lot of features. There is no need to extract features from BoxCar Scans for placing MS2 scans. //The workflow is similar to the 'BoxCar' paper in Nature Method. private void AddScanIntoQueue_StaticBox(IMsScan scan) { try { //Is MS1 Scan if (scan.HasCentroidInformation && IsMS1Scan(scan)) { bool isBoxCarScan = IsBoxCarScan(scan); string scanNumber; scan.CommonInformation.TryGetValue("ScanNumber", out scanNumber); Console.WriteLine("In StaticBox method, MS1 Scan arrived. Is BoxCar Scan: {0}.", isBoxCarScan); if (!isBoxCarScan && Parameters.MS2ScanSetting.DoMS2) { DeconvoluteMS1ScanAddMS2Scan_TopN(scan); } if (isBoxCarScan) { BoxCarScanNum--; } if (BoxCarScanNum == 0) { lock (lockerScan) { FullScan.PlaceFullScan(m_scans, Parameters); BoxCarScan.PlaceStaticBoxCarScan(m_scans, Parameters); } BoxCarScanNum = Parameters.BoxCarScanSetting.NumberOfBoxCarScans; } } } catch (Exception e) { Console.WriteLine("AddScanIntoQueue_StaticBoxMS2FromFullScan Exception!"); Console.WriteLine(e.ToString() + " " + e.Source); } }