Loading...
Searching...
No Matches
mgfoutput.cpp
Go to the documentation of this file.
#include "mgfoutput.h"
using namespace pappso;
MgfOutput::MgfOutput(QIODevice *p_output_device)
{
mpa_outputStream = new QTextStream(p_output_device);
}
MgfOutput::~MgfOutput()
{
}
void
MgfOutput::write(const QualifiedMassSpectrum &mass_spectrum)
{
/*
* BEGIN IONS
TITLE=20120906_balliau_extract_1_A01_urnb-1.15968.15968.2
RTINSECONDS=2843.58
PEPMASS=638.36934732588 270659.09375
CHARGE=2+
89.01705933 1255.7088623047
89.06031799 258758.140625
90.06361389 12425.6162109375
*/
*mpa_outputStream << "BEGIN IONS" << Qt::endl;
*mpa_outputStream << "TITLE="
<< mass_spectrum.getMassSpectrumId().getMsRunIdCstSPtr().get()->getSampleName()
<< "." << mass_spectrum.getMassSpectrumId().getSpectrumIndex() << Qt::endl;
*mpa_outputStream << "RTINSECONDS=" << QString::number(mass_spectrum.getRtInSeconds(), 'f', 2)
<< Qt::endl;
*mpa_outputStream << "PEPMASS=" << QString::number(mass_spectrum.getPrecursorMz(), 'g', 15) << " "
<< QString::number(mass_spectrum.getPrecursorIntensity(), 'f', 5) << Qt::endl;
*mpa_outputStream << "CHARGE=" << mass_spectrum.getPrecursorCharge() << "+" << Qt::endl;
if(mass_spectrum.getMassSpectrumCstSPtr() != nullptr)
{
for(auto &&peak : *(mass_spectrum.getMassSpectrumCstSPtr().get()))
{
*mpa_outputStream << QString::number(peak.x, 'g', 15) << " "
<< QString::number(peak.y, 'g', 15) << Qt::endl;
}
}
*mpa_outputStream << "END IONS" << Qt::endl;
}
void
MgfOutput::close()
{
mpa_outputStream->flush();
}
pappso::MassSpectrumId::getSpectrumIndex
std::size_t getSpectrumIndex() const
Definition massspectrumid.cpp:113
pappso::MassSpectrumId::getMsRunIdCstSPtr
const MsRunIdCstSPtr & getMsRunIdCstSPtr() const
Definition massspectrumid.cpp:85
pappso::MgfOutput::close
void close()
Definition mgfoutput.cpp:50
pappso::MgfOutput::mpa_outputStream
QTextStream * mpa_outputStream
Definition mgfoutput.h:55
pappso::MgfOutput::~MgfOutput
virtual ~MgfOutput()
Definition mgfoutput.cpp:11
pappso::MgfOutput::MgfOutput
MgfOutput(QIODevice *p_output_device)
Definition mgfoutput.cpp:5
pappso::MgfOutput::write
void write(const QualifiedMassSpectrum &mass_spectrum)
Definition mgfoutput.cpp:16
pappso::MsRunId::getSampleName
const QString & getSampleName() const
Definition msrunid.cpp:84
pappso::QualifiedMassSpectrum
Class representing a fully specified mass spectrum.
Definition qualifiedmassspectrum.h:99
pappso::QualifiedMassSpectrum::getMassSpectrumCstSPtr
MassSpectrumCstSPtr getMassSpectrumCstSPtr() const
Get the MassSpectrumCstSPtr.
Definition qualifiedmassspectrum.cpp:138
pappso::QualifiedMassSpectrum::getPrecursorCharge
uint getPrecursorCharge(bool *ok=nullptr) const
get precursor charge
Definition qualifiedmassspectrum.cpp:336
pappso::QualifiedMassSpectrum::getPrecursorIntensity
pappso_double getPrecursorIntensity(bool *ok=nullptr) const
get precursor intensity
Definition qualifiedmassspectrum.cpp:396
pappso::QualifiedMassSpectrum::getMassSpectrumId
const MassSpectrumId & getMassSpectrumId() const
Get the MassSpectrumId.
Definition qualifiedmassspectrum.cpp:154
pappso::QualifiedMassSpectrum::getPrecursorMz
pappso_double getPrecursorMz(bool *ok=nullptr) const
get precursor mz
Definition qualifiedmassspectrum.cpp:240
pappso::QualifiedMassSpectrum::getRtInSeconds
pappso_double getRtInSeconds() const
Get the retention time in seconds.
Definition qualifiedmassspectrum.cpp:205
mgfoutput.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39