A static method. The reader returned is already open; call its Close method when finished.
Syntax
| Syntax | Description |
|---|
| static GetReader(string file, MSFilter filter) | Creates a reader for the file, chosen by its extension, and opens it. |
Parameters
| Name | Type | Description |
|---|
| file | string | The file to open. |
| filter | MSFilter | The MS levels to read. |
Returns
| Type | Description |
|---|
| ISpectrumFileReader | A reader with the file open. |
Exceptions
| Exception | Condition |
|---|
| ArgumentException | The file extension is not a recognized format. |
| SpectrumFileOpenException | The file could not be opened or indexed. |
Example
1
2
3
4
5
6
7
8
9
10
11
12
13
| using Nova.Data;
using Nova.Io.Read;
try
{
ISpectrumFileReader reader = SpectrumFileReaderFactory.GetReader("DDA.mzML", MSFilter.MS2);
Spectrum spectrum = reader.GetSpectrum();
reader.Close();
}
catch (SpectrumFileOpenException ex)
{
Console.WriteLine(ex.Message);
}
|