Ejemplo n.º 1
0
        /// <summary>
        /// Creates an Xic for a feature based on individual charge states.
        /// </summary>
        /// <param name="rawPath">Path to the raw file.</param>
        /// <param name="peaksPath">Path to the peaks file.</param>
        /// <param name="feature">Feature to target</param>
        public Dictionary <int, Chromatogram> CreateXicForChargeStates(UMCLight feature, bool shouldSmooth)
        {
            Dictionary <int, Chromatogram>    chromatograms = new Dictionary <int, Chromatogram>();
            Dictionary <int, List <XYZData> > charges       = feature.CreateChargeSIC();

            XicFinder finder = new XicFinder();

            feature.ChargeStateChromatograms.Clear();

            //
            foreach (int charge in charges.Keys)
            {
                // This is the current XIC - but it's not that great
                List <XYZData> xicMz = charges[charge];

                // Finds the maximum point in the XIC, we'll use this as our target, it most likely contains
                // the exact point that we'll want to use to help identify the feature.
                var maxPoint = xicMz.Where(u => u.Y == xicMz.Max(x => x.Y)).Select(u => new { u.X, u.Y, u.Z }).FirstOrDefault();

                int    targetScan = Convert.ToInt32(maxPoint.X);
                double targetMz   = maxPoint.Z;

                // Find the Xic based on the target point, this may include other peaks
                List <XYData> totalXic = null;

                try
                {
                    totalXic = FindXic(targetMz, targetScan, shouldSmooth);

                    if (totalXic.Count > 1)
                    {
                        // Then find a specific Xic based on the target scan.
                        List <XYData> specificXic = finder.FindTarget(totalXic, targetScan);

                        // Add the targeted Xic to the charge state map so that we can create Xic's for each charge state.
                        Chromatogram gram = new Chromatogram(specificXic, maxPoint.Z, charge);
                        chromatograms.Add(charge, gram);
                    }
                }
                catch (PreconditionException)
                {
                    // This would mean that the charge state didnt have enough features in it.
                }
            }
            return(chromatograms);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates an Xic for a feature based on individual charge states.
        /// </summary>
        /// <param name="rawPath">Path to the raw file.</param>
        /// <param name="peaksPath">Path to the peaks file.</param>
        /// <param name="feature">Feature to target</param>
        public Dictionary <int, List <Chromatogram> > CreateXicForIsotopes(UMCLight feature, bool shouldSmooth)
        {
            Dictionary <int, List <Chromatogram> > chromatograms = new Dictionary <int, List <Chromatogram> >();
            Dictionary <int, List <XYZData> >      charges       = feature.CreateChargeSIC();
            XicFinder finder = new XicFinder();

            feature.IsotopeChromatograms.Clear();

            foreach (int charge in charges.Keys)
            {
                /// Creates a list of Xic's for a given chromatogram.
                List <Chromatogram> grams = new List <Chromatogram>();
                chromatograms.Add(charge, grams);

                // This is the current XIC - but it's not that great
                List <XYZData> xicMz = charges[charge];

                // Finds the maximum point in the XIC, we'll use this as our target, it most likely contains
                // the exact point that we'll want to use to help identify the feature.
                var    maxPoint   = xicMz.Where(u => u.Y == xicMz.Max(x => x.Y)).Select(u => new { u.X, u.Y, u.Z }).FirstOrDefault();
                int    targetScan = Convert.ToInt32(maxPoint.X);
                double targetMz   = maxPoint.Z;

                List <XYData> isotopicProfile = CreateIsotopicProfile(targetMz, targetScan, charge);

                foreach (XYData isotope in isotopicProfile)
                {
                    // Find the Xic based on the target point, this may include other peaks
                    List <XYData> totalXic = FindXic(targetMz, targetScan, shouldSmooth);

                    // Then find a specific Xic based on the target scan.
                    List <XYData> targetIsotopeXic = finder.FindTarget(totalXic, targetScan);

                    // Add the targeted Xic to the charge state map so that we can create Xic's for each charge state.
                    Chromatogram gram = new Chromatogram(targetIsotopeXic, maxPoint.Z, charge);
                    grams.Add(gram);
                }

                chromatograms[charge] = grams;
            }

            feature.IsotopeChromatograms = chromatograms;
            return(chromatograms);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates an Xic for a feature based on individual charge states.
        /// </summary>
        /// <param name="rawPath">Path to the raw file.</param>
        /// <param name="peaksPath">Path to the peaks file.</param>        
        /// <param name="feature">Feature to target</param>
        public Dictionary<int, Chromatogram> CreateXicForChargeStates(UMCLight feature, bool shouldSmooth)
        {
            Dictionary<int, Chromatogram> chromatograms = new Dictionary<int, Chromatogram>();
            Dictionary<int, List<XYZData>> charges      =  feature.CreateChargeSIC();

            XicFinder finder   = new XicFinder();
            feature.ChargeStateChromatograms.Clear();

            //
            foreach (int charge in charges.Keys)
            {
                // This is the current XIC - but it's not that great
                List<XYZData> xicMz             = charges[charge];

                // Finds the maximum point in the XIC, we'll use this as our target, it most likely contains
                // the exact point that we'll want to use to help identify the feature.
                var maxPoint                    = xicMz.Where( u => u.Y == xicMz.Max(x=>x.Y)).Select(u=> new { u.X, u.Y, u.Z}).FirstOrDefault();

                int     targetScan  = Convert.ToInt32(maxPoint.X);
                double  targetMz    = maxPoint.Z;

                // Find the Xic based on the target point, this may include other peaks
                List<PNNLOmics.Data.XYData> totalXic = null;

                try
                {
                    totalXic = FindXic(targetMz, targetScan, shouldSmooth);

                    if (totalXic.Count > 1)
                    {
                        // Then find a specific Xic based on the target scan.
                        List<PNNLOmics.Data.XYData> specificXic = finder.FindTarget(totalXic, targetScan);

                        // Add the targeted Xic to the charge state map so that we can create Xic's for each charge state.
                        Chromatogram gram = new Chromatogram(specificXic, maxPoint.Z, charge);
                        chromatograms.Add(charge, gram);
                    }
                }
                catch (PreconditionException)
                {
                    // This would mean that the charge state didnt have enough features in it.
                }
            }
            return chromatograms;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates an Xic for a feature based on individual charge states.
        /// </summary>
        /// <param name="rawPath">Path to the raw file.</param>
        /// <param name="peaksPath">Path to the peaks file.</param>        
        /// <param name="feature">Feature to target</param>
        public Dictionary<int, List<Chromatogram>> CreateXicForIsotopes(UMCLight feature, bool shouldSmooth)
        {
            Dictionary<int, List<Chromatogram>> chromatograms = new Dictionary<int, List<Chromatogram>>();
            Dictionary<int, List<XYZData>> charges      = feature.CreateChargeSIC();
            XicFinder finder                            = new XicFinder();
            feature.IsotopeChromatograms.Clear();

            foreach (int charge in charges.Keys)
            {
                /// Creates a list of Xic's for a given chromatogram.
                List<Chromatogram> grams    = new List<Chromatogram>();
                chromatograms.Add(charge, grams);

                // This is the current XIC - but it's not that great
                List<XYZData> xicMz         = charges[charge];

                // Finds the maximum point in the XIC, we'll use this as our target, it most likely contains
                // the exact point that we'll want to use to help identify the feature.
                var maxPoint    = xicMz.Where(u => u.Y == xicMz.Max(x => x.Y)).Select(u => new { u.X, u.Y, u.Z }).FirstOrDefault();
                int targetScan  = Convert.ToInt32(maxPoint.X);
                double targetMz = maxPoint.Z;

                List<PNNLOmics.Data.XYData>  isotopicProfile = CreateIsotopicProfile(targetMz, targetScan, charge);

                foreach (PNNLOmics.Data.XYData isotope in isotopicProfile)
                {
                    // Find the Xic based on the target point, this may include other peaks
                    List<PNNLOmics.Data.XYData> totalXic = FindXic(targetMz, targetScan, shouldSmooth);

                    // Then find a specific Xic based on the target scan.
                    List<PNNLOmics.Data.XYData> targetIsotopeXic = finder.FindTarget(totalXic, targetScan);

                    // Add the targeted Xic to the charge state map so that we can create Xic's for each charge state.
                    Chromatogram gram = new Chromatogram(targetIsotopeXic, maxPoint.Z, charge);
                    grams.Add(gram);
                }

                chromatograms[charge] = grams;
            }

            feature.IsotopeChromatograms = chromatograms;
            return chromatograms;
        }