| OpenMS 2.5.0

Public Member Functions | Protected Attributes | List of all members
DTAFile Class Reference
Format » File IO

File adapter for DTA files. More...

`#include <OpenMS/FORMAT/DTAFile.h>`

## Public Member Functions

| DTAFile ()
| Default constructor. More...
virtual | ~DTAFile ()
| Destructor. More...
template<typename SpectrumType >
void | load (const String &filename, SpectrumType &spectrum)
| Loads a DTA file to a spectrum. More...
template<typename SpectrumType >
void | store (const String &filename, const SpectrumType &spectrum) const
| Stores a spectrum in a DTA file. More...

## Protected Attributes

UInt | default_ms_level_
| Default MS level used when reading the file. More...

## Detailed Description

File adapter for DTA files.

The first line contains the singly protonated peptide mass (MH+) and the peptide charge state separated by a space. Subsequent lines contain space separated pairs of fragment ion m/z and intensity values.

From precursor mass and charge state the mass-charge-ratio is calculated and stored in the spectrum as precursor mass.

## Constructor & Destructor Documentation

## ◆ DTAFile()

DTAFile | ( |  | ) |

Default constructor.

## ◆ ~DTAFile()

virtual ~DTAFile | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## ◆ load()

void load | ( | const String & | filename,
|  | SpectrumType & | spectrum
| ) |  |

inline

Loads a DTA file to a spectrum.

The content of the file is stored in `spectrum`. `spectrum` has to be a MSSpectrum or have the same interface.

Exceptions

  Exception::FileNotFound | is thrown if the file could not be opened
  Exception::ParseError | is thrown if an error occurs during parsing

References File::basename(), MSSpectrum::clear(), SpectrumSettings::getPrecursors(), String::has(), OpenMS::Constants::PROTON_MASS_U, Precursor::setCharge(), Peak1D::setIntensity(), MSSpectrum::setMSLevel(), Peak1D::setMZ(), MSSpectrum::setName(), Peak1D::setPosition(), String::split(), and String::trim().

## ◆ store()

void store | ( | const String & | filename,
|  | const SpectrumType & | spectrum
| ) |  | const

inline

Stores a spectrum in a DTA file.

The content of `spectrum` is stored in a file. `spectrum` has to be a MSSpectrum or have the same interface.

Exceptions

  Exception::UnableToCreateFile | is thrown if the file could not be created

References Precursor::getCharge(), Peak1D::getMZ(), SpectrumSettings::getPrecursors(), and OpenMS::writtenDigits< double >().

## Member Data Documentation

## ◆ default_ms_level_

UInt default_ms_level_

protected

Default MS level used when reading the file.