Spectrum
A spectrum of basic m/z and intensity data points.
Remarks
A spectrum of basic m/z and intensity data points. It is TSpectrum<SpecDataPoint>.
Implements
ISpectrum<SpecDataPoint>, IDisposable
Constructors
| Syntax | Description |
|---|---|
| Spectrum(int count = 0) | Creates a spectrum sized for the given number of data points. |
Properties
Inherited from TSpectrum<T>
| Identifier | Type | Description |
|---|---|---|
| Count | int | The number of data points. Stored rather than computed from DataPoints.Length, for speed. |
| DataPoints | SpecDataPoint[] | The data points. Assigning a new array here directly does not update Count; use Resize. |
Inherited from SpectrumFoundation
| Identifier | Type | Description |
|---|---|---|
| Analyzer | string | Mass analyzer used. |
| BasePeakIntensity | double | The abundance of the most intense peak in the scan. |
| BasePeakMz | double | The m/z of the most intense peak in the scan. |
| Centroid | bool | Identifies the peak data type as centroid (true) or profile (false). |
| CollisionEnergy | double | The activation energy for a fragmentation event. |
| Description | string | The “Scan Description” field from the scan header. |
| DetectorType | string | Detector or mass analyzer used for the scan, such as ITMS or FTMS. |
| ElapsedScanTime | double | Total time, including injection time, to acquire the scan, in milliseconds. |
| EndMz | double | m/z that the scan ends at. |
| FaimsCV | double | FAIMS compensation voltage, if used, in volts. |
| FaimsState | bool | FAIMS state, true when on. FaimsState can be on while FaimsCV is 0. |
| HighestMz | double | Highest m/z observed in the scan. |
| IonInjectionTime | double | Injection time used to acquire the scan ions, in milliseconds, maximum 5000. |
| LowestMz | double | Lowest m/z observed in the scan. |
| MasterIndex | int | Thermo variable for master scan number. |
| MetaData | Dictionary<string, string> | Key/value dictionary for information without a dedicated field. |
| MsLevel | int | The MS level: 0 unknown, 1 MS1, 2 MS2, 3 MS3, and so on. |
| Polarity | bool | Polarity, true when positive. |
| PrecursorActivationMethod | string | If a dependent scan, the activation method used to generate the scan fragments. |
| PrecursorMasterScanNumber | int | If a dependent scan, the parent scan number. |
| Precursors | List<PrecursorIon> | Zero or more precursor ions associated with this spectrum. |
| RetentionTime | double | Scan retention time, in minutes. |
| ScanDescription | string | The scan description. |
| ScanEvent | int | Scan event order. |
| ScanFilter | string | Scan filter line from the raw file. |
| ScanNumber | int | Scan number. |
| ScanType | string | String description of the scan type. |
| StartMz | double | m/z that the scan starts at. |
| TotalIonCurrent | double | Total ion current for the scan. |
Methods
Inherited from TSpectrum<T>
| Method | Returns | Description |
|---|---|---|
| Deserialize(byte[] data) | void | Reads a byte array into spectrum object data members. |
| Dispose() | void | A no-op beyond marking the instance disposed; a spectrum holds no unmanaged resources. |
| GetMz(double mz, double ppm = 0) | int | Finds the data point at an m/z, or the nearest one within a tolerance. |
| Resize(int sz) | void | Replaces the data points with a new, empty array of the given size. Existing points are discarded. |
| Serialize() | byte[] | Writes spectrum object data members into a byte array. Not every member is carried. |
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using Nova.Data;
using Nova.Io.Read;
int ms1Count = 0;
int ms2Count = 0;
FileReader reader = new FileReader("TheBestDataEver.mzML", MSFilter.MS1 | MSFilter.MS2);
foreach (Spectrum spec in reader)
{
if (spec.MsLevel == 1)
{
ms1Count++;
}
else
{
ms2Count++;
}
}
Console.WriteLine("There are " + ms1Count + " MS scans and " + ms2Count + " MS/MS scans.");
This post is licensed under CC BY 4.0 by the author.