Post

FileReader.ReadChromatogram

Reads a chromatogram, opening the file first if it is not the current one.


Remarks

ChromatCount gives the number of chromatograms in the open file. Formats that carry none report 0.


Syntax

SyntaxDescription
ReadChromatogram(string fileName = “”, int chromatIndex = -1)Reads a chromatogram, opening the file first if it is not the current one.

Parameters

NameTypeDescription
fileNamestringThe file to read from, or empty for the current file.
chromatIndexintThe chromatogram index (zero based), or -1 for the next one.

Returns

TypeDescription
ChromatogramThe chromatogram, or an empty one if it could not be read.

Exceptions

ExceptionCondition
SpectrumFileOpenExceptionA new file could not be opened.

Example

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

FileReader reader = new FileReader("DDA.mzML");
for (int i = 0; i < reader.ChromatCount; i++)
{
  Chromatogram chromat = reader.ReadChromatogram("", i);
  Console.WriteLine(chromat.ID + ": " + chromat.Count + " points");
}
This post is licensed under CC BY 4.0 by the author.

Trending Tags