libpappsomspp
Library for mass spectrometry
pappso::MgfOutput Class Reference

#include <mgfoutput.h>

Public Member Functions

 MgfOutput (QIODevice *p_output_device)
 
void write (const QualifiedMassSpectrum &mass_spectrum)
 
void close ()
 
virtual ~MgfOutput ()
 

Private Attributes

QTextStream * mpa_outputStream
 

Detailed Description

Todo:
write docs

Definition at line 39 of file mgfoutput.h.

Constructor & Destructor Documentation

◆ MgfOutput()

MgfOutput::MgfOutput ( QIODevice *  p_output_device)

Default constructor

Definition at line 5 of file mgfoutput.cpp.

6 {
7 
8  mpa_outputStream = new QTextStream(p_output_device);
9 }
QTextStream * mpa_outputStream
Definition: mgfoutput.h:55

References mpa_outputStream.

◆ ~MgfOutput()

MgfOutput::~MgfOutput ( )
virtual

Destructor

Definition at line 11 of file mgfoutput.cpp.

12 {
13 }

Member Function Documentation

◆ close()

void MgfOutput::close ( )

Definition at line 61 of file mgfoutput.cpp.

62 {
63  mpa_outputStream->flush();
64 }

References mpa_outputStream.

◆ write()

void MgfOutput::write ( const QualifiedMassSpectrum mass_spectrum)

Definition at line 16 of file mgfoutput.cpp.

17 {
18  /*
19  * BEGIN IONS
20 TITLE=20120906_balliau_extract_1_A01_urnb-1.15968.15968.2
21 RTINSECONDS=2843.58
22 PEPMASS=638.36934732588 270659.09375
23 CHARGE=2+
24 89.01705933 1255.7088623047
25 89.06031799 258758.140625
26 90.06361389 12425.6162109375
27 */
28  *mpa_outputStream << "BEGIN IONS" << Qt::endl;
29  *mpa_outputStream << "TITLE="
30  << mass_spectrum.getMassSpectrumId()
32  .get()
33  ->getSampleName()
34  << "."
35  << mass_spectrum.getMassSpectrumId().getSpectrumIndex()
36  << Qt::endl;
37  *mpa_outputStream << "RTINSECONDS="
38  << QString::number(mass_spectrum.getRtInSeconds(), 'f', 2)
39  << Qt::endl;
40  *mpa_outputStream << "PEPMASS="
41  << QString::number(mass_spectrum.getPrecursorMz(), 'g', 15)
42  << " "
43  << QString::number(
44  mass_spectrum.getPrecursorIntensity(), 'f', 5)
45  << Qt::endl;
46  *mpa_outputStream << "CHARGE=" << mass_spectrum.getPrecursorCharge() << "+"
47  << Qt::endl;
48 
49  if(mass_spectrum.getMassSpectrumCstSPtr() != nullptr)
50  {
51  for(auto &&peak : *(mass_spectrum.getMassSpectrumCstSPtr().get()))
52  {
53  *mpa_outputStream << QString::number(peak.x, 'g', 15) << " "
54  << QString::number(peak.y, 'g', 15) << Qt::endl;
55  }
56  }
57  *mpa_outputStream << "END IONS" << Qt::endl;
58 }
std::size_t getSpectrumIndex() const
const MsRunIdCstSPtr & getMsRunIdCstSPtr() const
MassSpectrumCstSPtr getMassSpectrumCstSPtr() const
Get the MassSpectrumCstSPtr.
uint getPrecursorCharge(bool *ok=nullptr) const
Get the precursor charge.
pappso_double getPrecursorIntensity(bool *ok=nullptr) const
Get the intensity of the precursor ion.
const MassSpectrumId & getMassSpectrumId() const
Get the MassSpectrumId.
pappso_double getPrecursorMz(bool *ok=nullptr) const
Get the precursor m/z ratio.
pappso_double getRtInSeconds() const
Get the retention time in seconds.

References pappso::QualifiedMassSpectrum::getMassSpectrumCstSPtr(), pappso::QualifiedMassSpectrum::getMassSpectrumId(), pappso::MassSpectrumId::getMsRunIdCstSPtr(), pappso::QualifiedMassSpectrum::getPrecursorCharge(), pappso::QualifiedMassSpectrum::getPrecursorIntensity(), pappso::QualifiedMassSpectrum::getPrecursorMz(), pappso::QualifiedMassSpectrum::getRtInSeconds(), pappso::MassSpectrumId::getSpectrumIndex(), and mpa_outputStream.

Member Data Documentation

◆ mpa_outputStream

QTextStream* pappso::MgfOutput::mpa_outputStream
private

Definition at line 55 of file mgfoutput.h.

Referenced by MgfOutput(), close(), and write().


The documentation for this class was generated from the following files: