Post

TSpectrum<T>

The spectrum implementation shared by Spectrum and SpectrumEx.


Remarks

The spectrum implementation shared by Spectrum and SpectrumEx: the scan-level fields of SpectrumFoundation plus the data points. T is the data point type, SpecDataPoint or SpecDataPointEx.

Implements

ISpectrum<T>, IDisposable


Constructors

SyntaxDescription
TSpectrum(int count = 0)Creates a spectrum sized for the given number of data points.

Properties

IdentifierTypeDescription
CountintThe number of data points. Stored rather than computed from DataPoints.Length, for speed.
DataPointsT[]The data points. Assigning a new array here directly does not update Count; use Resize.

Inherited from SpectrumFoundation

IdentifierTypeDescription
AnalyzerstringMass analyzer used.
BasePeakIntensitydoubleThe abundance of the most intense peak in the scan.
BasePeakMzdoubleThe m/z of the most intense peak in the scan.
CentroidboolIdentifies the peak data type as centroid (true) or profile (false).
CollisionEnergydoubleThe activation energy for a fragmentation event.
DescriptionstringThe “Scan Description” field from the scan header.
DetectorTypestringDetector or mass analyzer used for the scan, such as ITMS or FTMS.
ElapsedScanTimedoubleTotal time, including injection time, to acquire the scan, in milliseconds.
EndMzdoublem/z that the scan ends at.
FaimsCVdoubleFAIMS compensation voltage, if used, in volts.
FaimsStateboolFAIMS state, true when on. FaimsState can be on while FaimsCV is 0.
HighestMzdoubleHighest m/z observed in the scan.
IonInjectionTimedoubleInjection time used to acquire the scan ions, in milliseconds, maximum 5000.
LowestMzdoubleLowest m/z observed in the scan.
MasterIndexintThermo variable for master scan number.
MetaDataDictionary<string, string>Key/value dictionary for information without a dedicated field.
MsLevelintThe MS level: 0 unknown, 1 MS1, 2 MS2, 3 MS3, and so on.
PolarityboolPolarity, true when positive.
PrecursorActivationMethodstringIf a dependent scan, the activation method used to generate the scan fragments.
PrecursorMasterScanNumberintIf a dependent scan, the parent scan number.
PrecursorsList<PrecursorIon>Zero or more precursor ions associated with this spectrum.
RetentionTimedoubleScan retention time, in minutes.
ScanDescriptionstringThe scan description.
ScanEventintScan event order.
ScanFilterstringScan filter line from the raw file.
ScanNumberintScan number.
ScanTypestringString description of the scan type.
StartMzdoublem/z that the scan starts at.
TotalIonCurrentdoubleTotal ion current for the scan.

Methods

MethodReturnsDescription
Deserialize(byte[] data)voidReads a byte array into spectrum object data members.
Dispose()voidA no-op beyond marking the instance disposed; a spectrum holds no unmanaged resources.
GetMz(double mz, double ppm = 0)intFinds the data point at an m/z, or the nearest one within a tolerance.
Resize(int sz)voidReplaces 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
using Nova.Data;

Spectrum spectrum = new Spectrum();

// Assigning DataPoints directly does not update Count, so size with Resize.
spectrum.Resize(2);
spectrum.DataPoints[0] = new SpecDataPoint(445.12, 10523.0);
spectrum.DataPoints[1] = new SpecDataPoint(522.77, 850.0);

byte[] payload = spectrum.Serialize();

Spectrum copy = new Spectrum();
copy.Deserialize(payload);
Console.WriteLine(copy.Count);
This post is licensed under CC BY 4.0 by the author.

Trending Tags