public CalculatedPeaks AutoSizePeak(TracerFormula tracerFormula, AdjustPeaksMode adjustPeaksMode) { if (tracerFormula.Equals(BasePeakKey)) { return(this); } var result = new CalculatedPeaks(PeptideFileAnalysis) { AutoFindPeak = false, }; var oldBasePeak = _peaks[BasePeakKey]; result.MakeBasePeak(BasePeakKey, oldBasePeak.StartTime, oldBasePeak.EndTime); foreach (var entry in _peaks) { if (entry.Key.Equals(BasePeakKey)) { continue; } Peak?newPeak = null; if (entry.Key.Equals(tracerFormula)) { double width = oldBasePeak.EndTime - oldBasePeak.StartTime; if (adjustPeaksMode == AdjustPeaksMode.Full) { newPeak = result.FindMatchingPeak(tracerFormula); } else if (adjustPeaksMode == AdjustPeaksMode.Overlapping) { newPeak = result.FindMatchingPeak(tracerFormula, entry.Value.StartTime - width, entry.Value.EndTime + width); } else if (adjustPeaksMode == AdjustPeaksMode.Narrow) { newPeak = result.FindMatchingPeak(tracerFormula, Math.Min(entry.Value.StartTime, entry.Value.EndTime - width), Math.Max(entry.Value.EndTime, entry.Value.StartTime + width)); } } if (newPeak == null) { result.MakeSecondaryPeak(entry.Key, entry.Value.StartTime, entry.Value.EndTime); } } result.FinishCalculation(); return(result); }
public CalculatedPeaks ChangeTime(TracerFormula tracerFormula, double newStartTime, double newEndTime) { CalculatedPeaks result = new CalculatedPeaks(PeptideFileAnalysis) { AutoFindPeak = false, }; Peak oldBasePeak = _peaks[BasePeakKey]; bool isBasePeak; if (tracerFormula.Equals(BasePeakKey)) { result.MakeBasePeak(BasePeakKey, newStartTime, newEndTime); isBasePeak = true; } else { result.MakeBasePeak(BasePeakKey, oldBasePeak.StartTime, oldBasePeak.EndTime); isBasePeak = false; } foreach (var entry in _peaks) { if (entry.Key.Equals(tracerFormula)) { if (isBasePeak) { continue; } result.MakeSecondaryPeak(tracerFormula, newStartTime, newEndTime); } else { result.MakeSecondaryPeak(entry.Key, entry.Value.StartTime, entry.Value.EndTime); } } result.FinishCalculation(); return(result); }
public CalculatedPeaks ChangeTime(TracerFormula tracerFormula, double newStartTime, double newEndTime) { CalculatedPeaks result = new CalculatedPeaks(PeptideFileAnalysis) { AutoFindPeak = false, }; Peak oldBasePeak = _peaks[BasePeakKey]; bool isBasePeak; if (tracerFormula.Equals(BasePeakKey)) { result.MakeBasePeak(BasePeakKey, newStartTime, newEndTime); isBasePeak = true; } else { result.MakeBasePeak(BasePeakKey, oldBasePeak.StartTime, oldBasePeak.EndTime); isBasePeak = false; } foreach (var entry in _peaks) { if (entry.Key.Equals(tracerFormula)) { if (isBasePeak) { continue; } result.MakeSecondaryPeak(tracerFormula, newStartTime, newEndTime); } else { result.MakeSecondaryPeak(entry.Key, entry.Value.StartTime, entry.Value.EndTime); } } result.FinishCalculation(); return result; }
public CalculatedPeaks AutoSizePeak(TracerFormula tracerFormula, AdjustPeaksMode adjustPeaksMode) { if (tracerFormula.Equals(BasePeakKey)) { return this; } var result = new CalculatedPeaks(PeptideFileAnalysis) { AutoFindPeak = false, }; var oldBasePeak = _peaks[BasePeakKey]; result.MakeBasePeak(BasePeakKey, oldBasePeak.StartTime, oldBasePeak.EndTime); foreach (var entry in _peaks) { if (entry.Key.Equals(BasePeakKey)) { continue; } Peak? newPeak = null; if (entry.Key.Equals(tracerFormula)) { double width = oldBasePeak.EndTime - oldBasePeak.StartTime; if (adjustPeaksMode == AdjustPeaksMode.Full) { newPeak = result.FindMatchingPeak(tracerFormula); } else if (adjustPeaksMode == AdjustPeaksMode.Overlapping) { newPeak = result.FindMatchingPeak(tracerFormula, entry.Value.StartTime - width, entry.Value.EndTime + width); } else if (adjustPeaksMode == AdjustPeaksMode.Narrow) { newPeak = result.FindMatchingPeak(tracerFormula, Math.Min(entry.Value.StartTime, entry.Value.EndTime - width), Math.Max(entry.Value.EndTime, entry.Value.StartTime + width)); } } if (newPeak == null) { result.MakeSecondaryPeak(entry.Key, entry.Value.StartTime, entry.Value.EndTime); } } result.FinishCalculation(); return result; }
private bool IsDisplayed(TracerFormula tracerFormula) { if (dataGridView1.SelectedRows.Count == 0) { return true; } for (int i = 0; i < dataGridView1.Rows.Count; i++) { var row = dataGridView1.Rows[i]; if (row.Selected && tracerFormula.Equals(row.Tag)) { return true; } } return false; }