private void setEnabledToolStripMenuItem_Click(object sender, EventArgs e) { GraphPane graphScans = zgcCurve.MasterPane.PaneList[0]; int min = (int)graphScans.XAxis.Scale.Min; int max = (int)graphScans.XAxis.Scale.Max + 1; lvScanUpdating = true; try { foreach (ListViewItem item in lvScans.Items) { LabelFreeItem c = (LabelFreeItem)item.Tag; if (c.Scan >= min && c.Scan <= max) { item.Checked = true; } } } finally { lvScanUpdating = false; } UpdatePrecursorItem(); UpdateCurve(); }
private void mnuSavitzkyGolaySmoothing_Click(object sender, EventArgs e) { List <double> source = new List <double>(); foreach (ListViewItem item in lvScans.Items) { LabelFreeItem c = (LabelFreeItem)item.Tag; source.Add(c.AdjustIntensity); } var result = source.ToArray(); for (int repeat = 0; repeat < 10; repeat++) { result = MathUtils.SavitzkyGolay7Point(result); for (int i = 0; i < result.Length; i++) { result[i] = Math.Max(0, result[i]); } } int index = 0; foreach (ListViewItem item in lvScans.Items) { LabelFreeItem c = (LabelFreeItem)item.Tag; c.AdjustIntensity = result[index++]; } if (lvPrecursor.SelectedItems.Count > 0) { double area = 0.0; foreach (ListViewItem item in lvScans.Items) { if (item.Checked) { LabelFreeItem c = (LabelFreeItem)item.Tag; area += c.AdjustIntensity; } } lvPrecursor.SelectedItems[0].SubItems[2].Text = area.ToString("0.0"); } UpdateCurve(); }
private void UpdateCurve() { foreach (GraphPane pane in zgcCurve.MasterPane.PaneList) { pane.ClearData(); } try { if (lvPrecursor.SelectedItems.Count == 0) { return; } GraphPane graphScans = zgcCurve.MasterPane.PaneList[0]; GraphPane graphPPM = zgcCurve.MasterPane.PaneList[1]; var pplScan = new PointPairList(); var pplPPM = new PointPairList(); var pplScanCurve = new PointPairList(); bool bChecked = false; double precursorMz = MyConvert.ToDouble(lvPrecursor.SelectedItems[0].Text); var identified = new PointPairList(); foreach (ListViewItem item in this.lvScans.Items) { if (item == null) { return; } if (item.Checked != bChecked) { if (pplScanCurve.Count > 0 && bChecked) { graphScans.AddPoly("", pplScanCurve, Color.Blue, new[] { PLOY_COLOR }); } pplScanCurve = new PointPairList(); bChecked = item.Checked; } LabelFreeItem c = (LabelFreeItem)item.Tag; pplScan.Add(new PointPair(c.Scan, c.AdjustIntensity)); pplScanCurve.Add(new PointPair(c.Scan, c.AdjustIntensity)); pplPPM.Add(new PointPair(c.Scan, c.DeltaMzPPM)); if (c.Identified) { identified.Add(new PointPair(c.Scan, c.AdjustIntensity)); } } if (pplScanCurve.Count > 0 && bChecked) { graphScans.AddPoly("", pplScanCurve, Color.Blue, new[] { PLOY_COLOR }); } graphScans.AddCurve(precursorMz.ToString(), pplScan, Color.Blue, SymbolType.None); graphPPM.AddCurve(precursorMz.ToString(), pplPPM, Color.Blue, SymbolType.None); graphScans.AddIndividualLine("Identified", identified, Color.Red); } finally { ZedGraphicExtension.UpdateGraph(this.zgcCurve); } }