forked from HuanLab/BUDDY
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpectrumModel.cs
58 lines (49 loc) · 2.21 KB
/
SpectrumModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//using System;
//using System.Collections.Generic;
//using System.Collections.ObjectModel;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using BUDDY.MgfHandler;
//using OxyPlot;
//using OxyPlot.Annotations;
//using OxyPlot.Axes;
//using OxyPlot.Series;
//namespace BUDDY
//{
// public class SpectrumModel
// {
// public SpectrumModel()
// {
// List<MgfRecord> mgf = new List<MgfRecord>();
// mgf = MgfParser.ReadMgf(@"X:\Users\Shipei_Xing\Bottom-up_2020Dec\BUDDY_input_demo\demo_1.mgf");
// var model = new PlotModel { Title = "Precursor m/z: " + mgf[0].Pepmass };
// var scatterSeries = new ScatterSeries { MarkerType = MarkerType.Circle };
// for (int i = 0; i < mgf[0].Spectrum.Count; i++)
// {
// var x = mgf[0].Spectrum[i].Mz;
// var y = mgf[0].Spectrum[i].Intensity;
// var size = 2;
// var colorValue = 1;
// scatterSeries.Points.Add(new ScatterPoint(x, y, size, colorValue));
// var annotation = new LineAnnotation();
// annotation.Color = OxyColors.MediumPurple;
// annotation.MinimumY = 0;
// annotation.MaximumY = mgf[0].Spectrum[i].Intensity;
// annotation.X = mgf[0].Spectrum[i].Mz;
// annotation.LineStyle = LineStyle.Solid;
// annotation.Type = LineAnnotationType.Vertical;
// annotation.StrokeThickness = 1.7;
// model.Annotations.Add(annotation);
// }
// var customAxis = new RangeColorAxis { Key = "customColors" };
// customAxis.AddRange(0, 2000, OxyColors.Purple);
// model.Axes.Add(customAxis);
// model.Series.Add(scatterSeries);
// model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, Title = "m/z", AbsoluteMinimum = 0});
// model.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Title = "Relative Abundance", AbsoluteMinimum = 0 });
// this.MyModel = model;
// }
// public PlotModel MyModel { get; private set; }
// }
//}