コード例 #1
0
        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);
            }
        }
コード例 #2
0
ファイル: DataReceiver.cs プロジェクト: avcarr2/MetaDrive
        //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);
            }
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            //Quick way to check parameters
            //var apath = "G:\\Parameters\\Parameters_Topdown_ChargeExclusion_Mesh.toml";
            //Parameters aparameters = AddParametersFromFile(apath);

            //Initiate Element
            Loaders.LoadElements();
            //Loading avagine model for Deconvolution
            var test = new MzSpectrumXY(new double[] { 1 }, new double[] { 1 }, true);

            //Load parameters
            string path = "";

            if (args.Count() > 0)
            {
                path = args[0];
            }

            Parameters parameters = AddParametersFromFile(path);

            //Generate Static BoxCarScan Properties.
            BoxCarScan.BuildStaticBoxString(parameters);

            //Start the task
            if (parameters.GeneralSetting.TestMod)
            {
                Console.WriteLine("--------------In Test Mod--------------");
                new CustomScansTandemByArrival(parameters).DoJob(5 * 60000);
            }
            else
            {
                Console.WriteLine("--------------In Gather Mod--------------");
                var dataReceiver = new DataReceiver(parameters);
                dataReceiver.InstrumentAccess = Connection.GetFirstInstrument();
                dataReceiver.ScanContainer    = dataReceiver.InstrumentAccess.GetMsScanContainer(0);

                dataReceiver.DetectStartSignal();
                dataReceiver.DoJob();

                dataReceiver.ScanContainer    = null;
                dataReceiver.InstrumentAccess = null;
            }

            Console.WriteLine("Task Finished...");
        }
コード例 #4
0
ファイル: DataReceiver.cs プロジェクト: avcarr2/MetaDrive
        //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);
            }
        }
コード例 #5
0
ファイル: DataReceiver.cs プロジェクト: avcarr2/MetaDrive
        private void AddScanIntoQueue_DynamicBoxCar_TD(IMsScan scan)
        {
            try
            {
                //Is MS1 Scan
                if (scan.HasCentroidInformation)
                {
                    List <ChargeEnvelop> chargeEnvelops;

                    var isoEnvelops = Deconvolute_TD(scan, out chargeEnvelops);

                    Console.WriteLine("chargeEnvelops.Count: {0}", isoEnvelops.Count);

                    if (Parameters.BoxCarScanSetting.DoDbcForMS1)
                    {
                        if (IsBoxCarScan(scan))
                        {
                            PlaceDynamicBoxCarMS2Scan(scan, chargeEnvelops, isoEnvelops);
                            FullScan.PlaceFullScan(m_scans, Parameters);
                        }
                        else
                        {
                            if (chargeEnvelops.Count >= 1 || isoEnvelops.Count >= 5)
                            {
                                lock (lockerExclude)
                                {
                                    var thred = isoEnvelops.OrderByDescending(p => p.IntensityRatio).First().IntensityRatio / 20;
                                    var isos  = isoEnvelops.Where(p => p.IntensityRatio > thred);
                                    foreach (var x in isos)
                                    {
                                        DynamicExclusionList.exclusionList.Enqueue(new Tuple <double, int, DateTime>(x.ExperimentIsoEnvelop.First().Mz, x.Charge, DateTime.Now));
                                    }
                                }

                                var boxes = BoxCarScan.GenerateDynamicBoxes_TD(isoEnvelops);

                                BoxCarScan.PlaceDynamicBoxCarScan(m_scans, Parameters, boxes);
                            }
                            else
                            {
                                FullScan.PlaceFullScan(m_scans, Parameters);
                            }
                        }
                    }
                    else
                    {
                        if (Parameters.BoxCarScanSetting.PrecursorSkipScan)
                        {
                            FullScan.PlaceFullScan(m_scans, Parameters);

                            PlaceDynamicBoxCarMS2Scan(scan, chargeEnvelops, isoEnvelops);
                        }
                        else
                        {
                            PlaceDynamicBoxCarMS2Scan(scan, chargeEnvelops, isoEnvelops);

                            FullScan.PlaceFullScan(m_scans, Parameters);
                        }
                    }
                }
            }

            catch (Exception e)
            {
                Console.WriteLine("AddScanIntoQueue_DynamicBox Exception!");
                Console.WriteLine(e.ToString() + " " + e.Source);
            }
        }