Post

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

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

Properties

Inherited from TSpectrum<T>

IdentifierTypeDescription
CountintThe number of data points. Stored rather than computed from DataPoints.Length, for speed.
DataPointsSpecDataPoint[]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

Inherited from TSpectrum<T>

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
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.

Trending Tags