コード例 #1
0
        /// <summary>
        /// Return the number of unique isolation windows in the dataset
        /// </summary>
        /// <returns></returns>
        public int GetNumUniqueIsoWindows()
        {
            var isoWindowSet = new HashSet <IsolationWindow>();

            foreach (var scanNum in ScanNumToMsLevel.Where(x => x.Value > 1).Select(x => x.Key))
            {
                if (!(GetSpectrum(scanNum) is ProductSpectrum productSpec))
                {
                    continue;
                }
                isoWindowSet.Add(productSpec.IsolationWindow);
            }
            return(isoWindowSet.Count);
        }
コード例 #2
0
        /// <summary>
        /// Get the narrowest isolation window width
        /// </summary>
        /// <returns></returns>
        public double GetMinIsolationWindowWidth()
        {
            var minWidth = Double.MaxValue;

            foreach (var scanNum in ScanNumToMsLevel.Where(x => x.Value > 1).Select(x => x.Key))
            {
                var productSpec = GetSpectrum(scanNum) as ProductSpectrum;
                if (productSpec == null)
                {
                    continue;
                }
                if (productSpec.IsolationWindow.Width < minWidth)
                {
                    minWidth = productSpec.IsolationWindow.Width;
                }
            }
            return(minWidth);
        }
コード例 #3
0
        /*
         * public ProductSpectrum GetSummedMs2Spectrum(double monoIsotopicMass, Ms1Feature range,
         *  ActivationMethod activationMethod = ActivationMethod.Unknown)
         * {
         *  return GetSummedMs2Spectrum(monoIsotopicMass, range.MinScanNum, range.MaxScanNum, range.MinCharge,
         *      range.MaxCharge, activationMethod);
         * }*/

        #endregion

        #region Detail data by scan number

        /// <summary>
        /// Gets the MS level of the specified scan
        /// </summary>
        /// <param name="scanNum">scan number</param>
        /// <returns>MS level</returns>
        public int GetMsLevel(int scanNum)
        {
            int msLevel;

            return(ScanNumToMsLevel.TryGetValue(scanNum, out msLevel) ? msLevel : 0);
        }
コード例 #4
0
 /// <summary>
 /// Gets the scan numbers of the specified msLevel
 /// </summary>
 /// <param name="msLevel">MS level</param>
 /// <returns>scan numbers of the specified msLevel</returns>
 public IList <int> GetScanNumbers(int msLevel)
 {
     return(ScanNumToMsLevel.Where(x => x.Value == msLevel).Select(x => x.Key).ToList());
 }
コード例 #5
0
 /// <summary>
 /// Gets the smallest scan number larger than ms2ScanNum
 /// </summary>
 /// <param name="scanNum">scan number</param>
 /// <param name="msLevel">MS level</param>
 /// <returns>next scan number at the specified level</returns>
 public int GetNextScanNum(int scanNum, int msLevel)
 {
     return(ScanNumToMsLevel.Where(x => x.Value == msLevel && x.Key > scanNum).DefaultIfEmpty(new KeyValuePair <int, int>(MaxLcScan + 1, 0)).Min(x => x.Key));
 }
コード例 #6
0
 /// <summary>
 /// Gets the greatest scan number smaller than ms2ScanNum
 /// </summary>
 /// <param name="scanNum">scan number</param>
 /// <param name="msLevel">MS level</param>
 /// <returns>previous scan number at the specified level</returns>
 public int GetPrevScanNum(int scanNum, int msLevel)
 {
     return(ScanNumToMsLevel.Where(x => x.Value == msLevel && x.Key < scanNum).DefaultIfEmpty(new KeyValuePair <int, int>(MinLcScan - 1, 0)).Max(x => x.Key));
 }