Post

FileReader

Reads spectra and chromatograms from an MS data file, choosing the reader by file extension.


Remarks

Reads spectra and chromatograms from an MS data file, choosing the reader by file extension. Enumerating it yields each spectrum in file order.

Implements

IEnumerable


Constructors


Properties

IdentifierTypeDescription
ChromatCountintNumber of chromatograms in the open file, or 0 for formats that carry none.
FileNamestringThe name of the file currently being read.
FirstScanintThe scan number of the first spectrum in the file.
FormatFileFormatIdentifies the format of the most recently opened file.
LastScanintThe scan number of the last spectrum in the file.
MaxRetentionTimedoubleThe retention time at the end of the run, in minutes.
ScanCountintThe number of spectra in the open file.

Methods

MethodReturnsDescription
static CheckFileFormat(string fileName)FileFormatReads a file name string and returns the FileFormat value based on the file extension characters.
GetEnumerator()IEnumeratorYields each spectrum in the open file in file order, subject to the current filter, then resets the reader.
OpenSpectrumFile(string fileName)boolOpens a file for reading, closing any file already open.
ReadChromatogram(string fileName = “”, int chromatIndex = -1)ChromatogramReads a chromatogram, opening the file first if it is not the current one.
ReadSpectrum(string fileName = “”, int scanNumber = -1, bool centroid = true)SpectrumReads a spectrum, opening the file first if it is not the current one.
ReadSpectrumEx(string fileName = “”, int scanNumber = -1, bool centroid = true)SpectrumExReads a spectrum with the extended per-peak data where the format provides it, opening the file first if it is not the current one.
Reset()voidReturns to the start of the open file for sequential reading.
SetFilter(MSFilter filter)voidSets the MS levels to read, for this reader and any file it has open.

Example

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

// Reads all MS1 scans from a Thermo Fisher Scientific data file
FileReader reader = new FileReader("DDA.raw", MSFilter.MS1);
foreach (Spectrum spec in reader)
{
  // Report each scan number and number of data points
  Console.WriteLine(spec.ScanNumber + " has " + spec.Count + " data points.");
}
This post is licensed under CC BY 4.0 by the author.

Trending Tags