/// <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); }
/// <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); }
/// <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)); }
/// <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()); }
/// <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)); }