Post

ISpectrumFileReader.GetSpectrumEx

Reads a spectrum, with the extended per-peak data, from the currently open MS data file.


Remarks

With a scan number, that scan is read, or an empty spectrum if it does not pass the filter. With -1, the next spectrum that passes the filter is read, and an empty spectrum, with ScanNumber 0, marks the end of the file.

Only Thermo RAW files provide the extended data. Other formats leave it at zero.


Syntax

SyntaxDescription
GetSpectrumEx(int scanNumber = -1, bool centroid = true)Reads a spectrum from the currently open MS data file, with the extended per-peak data where the format provides it.

Parameters

NameTypeDescription
scanNumberintOptional scan number to grab. If omitted (or negative), the next spectrum in the file is loaded.
centroidboolIndicates the preferred peak type. Not guaranteed; check the Spectrum.Centroid property.

Returns

TypeDescription
SpectrumExSpectrumEx object.

Example

1
2
3
4
5
6
7
8
9
10
using Nova.Data;
using Nova.Io.Read;

ISpectrumFileReader reader = SpectrumFileReaderFactory.GetReader("DDA.raw", MSFilter.MS2);
SpectrumEx spectrum = reader.GetSpectrumEx(1000);
for (int i = 0; i < spectrum.Count; i++)
{
  Console.WriteLine(spectrum.DataPoints[i].Mz + " at resolution " + spectrum.DataPoints[i].Resolution);
}
reader.Close();
This post is licensed under CC BY 4.0 by the author.

Trending Tags