SpecDataPoint
The basic mass spectrum data point, an m/z and intensity pair.
Remarks
The basic mass spectrum data point: an m/z and intensity pair. This is the point type of Spectrum.
Constructors
| Syntax | Description |
|---|---|
| SpecDataPoint(double mz = 0, double intensity = 0) | Creates a data point, with both values defaulting to zero. |
Properties
| Identifier | Type | Description |
|---|---|---|
| Mz | double | The mass to charge ratio (m/z) value for this data point. |
| Intensity | double | The intensity value for this data point. |
Methods
| Method | Returns | Description |
|---|---|---|
| CompareTo(SpecDataPoint x) | int | Orders data points by m/z alone. Two points at the same m/z compare as equal. |
| Read(BinaryReader reader) | void | Reads the m/z then the intensity from the stream, each as a double. |
| Write(BinaryWriter writer) | void | Writes the m/z then the intensity to the stream, each as a double. |
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
using Nova.Data;
SpecDataPoint[] peaks =
{
new SpecDataPoint(600.30, 2000.0),
new SpecDataPoint(445.12, 10523.0),
new SpecDataPoint(522.77, 850.0)
};
// IComparable orders by Mz, so no comparer is needed.
Array.Sort(peaks);
foreach (SpecDataPoint peak in peaks)
{
Console.WriteLine(peak.Mz);
}
This post is licensed under CC BY 4.0 by the author.