public bool Equals(IsolationWindow other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(other.Start.Equals(Start) && other.End.Equals(End) && other.Target.Equals(Target) && other.StartMargin.Equals(StartMargin) && other.EndMargin.Equals(EndMargin) && other.CERange.Equals(CERange)); }
public IsolationWindow GetIsolationWindow(double targetMz, double matchTolerance) { IsolationWindow isolationWindow = null; if (!FromResults) { // Match pre-specified targets. if (PrespecifiedIsolationWindows[0].Target.HasValue) { foreach (var window in PrespecifiedIsolationWindows) { if (!window.TargetMatches(targetMz, matchTolerance)) { continue; } if (isolationWindow != null) { throw new InvalidDataException( string.Format(Resources.SpectrumFilter_FindFilterPairs_Two_isolation_windows_contain_targets_which_match_the_isolation_target__0__, targetMz)); } isolationWindow = window; } } // Find containing window. else { double?bestDeltaMz = null; // find the window with center closest to the target m/z foreach (var window in PrespecifiedIsolationWindows) { if (!window.Contains(targetMz)) { continue; } var winCenter = (window.IsolationStart + window.IsolationEnd) / 2.0; var deltaMz = Math.Abs(winCenter - targetMz); if (isolationWindow == null || deltaMz < bestDeltaMz) { isolationWindow = window; bestDeltaMz = deltaMz; } } } } return(isolationWindow); }
private IEnumerable <IsolationWindow> GetDisjointRanges(IList <IsolationWindow> isolationWindows) { var listIsolationWindows = new List <IsolationWindow>(isolationWindows); listIsolationWindows.Sort((w1, w2) => Comparer <double> .Default.Compare(w1.Start, w2.Start)); int iDisjoint = 0; for (int i = 1; i < listIsolationWindows.Count; i++) { var disjointWindow = listIsolationWindows[iDisjoint]; var nextWindow = listIsolationWindows[i]; if (disjointWindow.End >= nextWindow.Start) { listIsolationWindows[iDisjoint] = new IsolationWindow(disjointWindow.Start, nextWindow.End); } else { iDisjoint++; listIsolationWindows[iDisjoint] = nextWindow; } } return(listIsolationWindows.Take(iDisjoint + 1)); }
private IEnumerable<IsolationWindow> GetDisjointRanges(IList<IsolationWindow> isolationWindows) { var listIsolationWindows = new List<IsolationWindow>(isolationWindows); listIsolationWindows.Sort((w1, w2) => Comparer<double>.Default.Compare(w1.Start, w2.Start)); int iDisjoint = 0; for (int i = 1; i < listIsolationWindows.Count; i++) { var disjointWindow = listIsolationWindows[iDisjoint]; var nextWindow = listIsolationWindows[i]; if (disjointWindow.End >= nextWindow.Start) { listIsolationWindows[iDisjoint] = new IsolationWindow(disjointWindow.Start, nextWindow.End); } else { iDisjoint++; listIsolationWindows[iDisjoint] = nextWindow; } } return listIsolationWindows.Take(iDisjoint + 1); }
public bool Equals(IsolationWindow other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return other.Start.Equals(Start) && other.End.Equals(End) && other.Target.Equals(Target) && other.StartMargin.Equals(StartMargin) && other.EndMargin.Equals(EndMargin) && other.CERange.Equals(CERange); }
protected virtual void WriteIsolationWindow(TextWriter writer, IsolationWindow isolationWindow) { double target = isolationWindow.Target ?? isolationWindow.MethodCenter; writer.WriteLine(SequenceMassCalc.PersistentMZ(target).ToString(CultureInfo.InvariantCulture)); }