示例#1
0
        private void Orbitrap_MsScanArrived(object sender, MsScanEventArgs e)
        {
            // If examining code takes longer, in particular for some scans, it is wise
            // to use a processing queue in order to get the system as responsive as possible.

            using (IMsScan scan = (IMsScan)e.GetScan())                 // caution! You must dispose this, or you block shared memory!
            {
                Console.WriteLine("==================================================");
                Console.WriteLine("\n{0:HH:mm:ss,fff} scan with {1} centroids arrived", DateTime.Now, scan.CentroidCount);

                //TO THINK: If the coming scan is MS2 scan, start the timing of the scan precursor into exclusion list. Currently, start when add the scan precursor.

                if (!IsTakeOverScan(scan))
                {
                    if (IsMS1Scan(scan))
                    {
                        Console.WriteLine("MS1 Scan arrived.");
                        if (!TimeIsOver)
                        {
                            AddScanIntoQueueAction(scan);
                        }
                    }
                    else
                    {
                        Console.WriteLine("MS2 Scan arrived.");
                    }
                }
                else if (!firstFullScanPlaced)
                {
                    FullScan.PlaceFullScan(m_scans, Parameters);
                    Console.WriteLine("Place First User defined Full Scan.");
                    firstFullScanPlaced = true;
                }
            }
        }
示例#2
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);
            }
        }
示例#3
0
        //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);
            }
        }
示例#4
0
        //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
        //Tranditional ShotGun DDA workflow.

        private void AddScanIntoQueue_ShotGun(IMsScan scan)
        {
            try
            {
                //Is MS1 Scan
                if (scan.HasCentroidInformation)
                {
                    Console.WriteLine("MS1 Scan arrived. Is BoxCar Scan: {0}. Deconvolute.", IsBoxCarScan(scan));

                    DeconvoluteMS1ScanAddMS2Scan_TopN(scan);

                    lock (lockerScan)
                    {
                        FullScan.PlaceFullScan(m_scans, Parameters);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("AddScanIntoQueue_BottomUp Exception!");
                Console.WriteLine(e.ToString() + " " + e.Source);
            }
        }
示例#6
0
        private void PlaceUserDefined(IMsScan scan)
        {
            Console.WriteLine("\n{0:HH:mm:ss,fff} UserDefined Start", DateTime.Now);

            var monomass = 16950.88339;

            Dictionary <int, double> mz_z = new Dictionary <int, double>();

            for (int i = 15; i <= 27; i++)
            {
                mz_z.Add(i, monomass.ToMz(i));
            }

            var mzs = mz_z.Values;

            //foreach (var mz in mzs)
            //{
            //    Parameters.MS2ScanSetting.NCE = 10;
            //    DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz);
            //    Parameters.MS2ScanSetting.NCE = 15;
            //    DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz);
            //    Parameters.MS2ScanSetting.NCE = 20;
            //    DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz);
            //    Parameters.MS2ScanSetting.NCE = 25;
            //    DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz);
            //    Parameters.MS2ScanSetting.NCE = 30;
            //    DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz);
            //    Parameters.MS2ScanSetting.NCE = 35;
            //    DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz);
            //    Parameters.MS2ScanSetting.NCE = 40;
            //    DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz);
            //    Parameters.MS2ScanSetting.NCE = 45;
            //    DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz);
            //    Parameters.MS2ScanSetting.NCE = 50;
            //    DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz);
            //}
            //Parameters.MS2ScanSetting.NCE = 25;

            //foreach (var mz in mzs)
            //{
            //    DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz);
            //    Parameters.MS2ScanSetting.NCE_factors = "[0.9, 1, 1.1]";
            //    DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz);
            //    Parameters.MS2ScanSetting.NCE_factors = "[0.8, 1, 1.2]";
            //    DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz);
            //    Parameters.MS2ScanSetting.NCE_factors = "[0.6, 1, 1.4]";
            //    DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz);
            //    Parameters.MS2ScanSetting.NCE_factors = "null";
            //}

            int j = 15;

            while (j <= 27)
            {
                DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz_z[j]);
                Parameters.MS2ScanSetting.NCE_factors = "[0.9, 1, 1.1]";
                DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz_z[j]);
                Parameters.MS2ScanSetting.NCE_factors = "[0.8, 1, 1.2]";
                DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz_z[j]);
                Parameters.MS2ScanSetting.NCE_factors = "[0.6, 1, 1.4]";
                DataDependentScan.PlaceMS2Scan(m_scans, Parameters, mz_z[j]);
                Parameters.MS2ScanSetting.NCE_factors = "null";
                j += 1;
            }

            List <double> comb = new List <double>();

            comb.Add(mz_z[20]);
            comb.Add(mz_z[21]);
            comb.Add(mz_z[22]);
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "[0.9, 1, 1.1]";
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "[0.8, 1, 1.2]";
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "[0.6, 1, 1.4]";
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "null";

            comb.Clear();
            comb.Add(mz_z[19]);
            comb.Add(mz_z[21]);
            comb.Add(mz_z[23]);
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "[0.9, 1, 1.1]";
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "[0.8, 1, 1.2]";
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "[0.6, 1, 1.4]";
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "null";

            comb.Clear();
            comb.Add(mz_z[17]);
            comb.Add(mz_z[21]);
            comb.Add(mz_z[25]);
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "[0.9, 1, 1.1]";
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "[0.8, 1, 1.2]";
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "[0.6, 1, 1.4]";
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "null";

            comb.Clear();
            comb.Add(mz_z[17]);
            comb.Add(mz_z[19]);
            comb.Add(mz_z[21]);
            comb.Add(mz_z[23]);
            comb.Add(mz_z[25]);
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "[0.9, 1, 1.1]";
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "[0.8, 1, 1.2]";
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "[0.6, 1, 1.4]";
            DataDependentScan.PlaceMS2Scan(m_scans, Parameters, comb);
            Parameters.MS2ScanSetting.NCE_factors = "null";

            FullScan.PlaceFullScan(m_scans, Parameters);
        }
示例#7
0
        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);
            }
        }