33 #include <QStringList>
36 #include "../../config.h"
45 char *
const p =
reinterpret_cast<char *
>(&in);
46 for(
size_t i = 0; i <
sizeof(T) / 2; ++i)
47 std::swap(p[i], p[
sizeof(T) - i - 1]);
64 mp_output->m_monitor.count();
65 mp_output->writeQualifiedMassSpectrum(spectrum);
76 QIODevice *p_output_device)
121 mpa_outputStream->writeNamespace(
"http://www.w3.org/2001/XMLSchema-instance",
137 "xmlns",
"http://sashimi.sourceforge.net/schema_revision/mzXML_3.2");
139 "xsi:schemaLocation",
140 "http://sashimi.sourceforge.net/schema_revision/mzXML_3.2 "
141 "http://sashimi.sourceforge.net/schema_revision/mzXML_3.2/"
142 "mzXML_idx_3.2.xsd");
230 QStringList native_id_list = native_id.split(
"=");
231 if(native_id_list.size() < 2)
236 return native_id_list.back().toULong();
238 return std::numeric_limits<std::size_t>::max();
244 std::size_t scan_number =
246 if(scan_number == std::numeric_limits<std::size_t>::max())
257 std::size_t scan_number =
259 if(scan_number == std::numeric_limits<std::size_t>::max())
297 QString(
"%1").arg(spectrum.
size()));
299 if(spectrum.
size() > 0)
320 QString(
"PT%1S").arg(QString::number(spectrum.
getRtInSeconds(),
'f', 2)));
333 "precursorIntensity",
357 QByteArray byte_array;
358 if(QSysInfo::ByteOrder == QSysInfo::LittleEndian)
364 byte_array.append((
char *)&swap, 8);
366 byte_array.append((
char *)&swap, 8);
374 byte_array.append((
char *)&peak.x, 8);
375 byte_array.append((
char *)&peak.y, 8);
std::size_t getSpectrumIndex() const
const QString & getNativeId() const
base class to read MSrun the only way to build a MsRunReader object is to use the MsRunReaderFactory
virtual std::size_t spectrumListSize() const =0
get the totat number of spectrum conained in the MSrun data file
virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler)=0
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
const MsRunIdCstSPtr & getMsRunId() const
Translater(MzxmlOutput *p_mzxml_output)
virtual bool needPeakList() const override
tells if we need the peak list (if we want the binary data) for each spectrum
virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override
void setReadAhead(bool read_ahead)
std::size_t getScanNumberFromNativeId(const QString &native_id) const
MzxmlOutput(UiMonitorInterface &monitor, QIODevice *p_output_device)
void write(MsRunReader *p_msrunreader)
UiMonitorInterface & m_monitor
std::size_t getScanNumber(const QualifiedMassSpectrum &spectrum) const
QXmlStreamWriter * mpa_outputStream
void writeQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum)
void maskMs1(bool mask_ms1)
std::size_t getPrecursorScanNumber(const QualifiedMassSpectrum &spectrum) const
void writeHeader(MsRunReader *p_msrunreader)
Class representing a fully specified mass spectrum.
uint getMsLevel() const
Get the mass spectrum level.
MassSpectrumCstSPtr getMassSpectrumCstSPtr() const
Get the MassSpectrumCstSPtr.
uint getPrecursorCharge(bool *ok=nullptr) const
Get the precursor charge.
const QString & getPrecursorNativeId() const
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.
std::size_t getPrecursorSpectrumIndex() const
Get the scan number of the precursor ion.
pappso_double getRtInSeconds() const
Get the retention time in seconds.
virtual void setReadAhead(bool is_read_ahead) final
use threads to read a spectrum by batch of batch_size
virtual void setNeedMsLevelPeakList(unsigned int ms_level, bool want_peak_list) final
tells if we need the peak list given
virtual void setTotalSteps(std::size_t total_number_of_steps)
use it if the number of steps is known in an algorithm the total number of steps is usefull to report...
#define PAPPSOMSPP_VERSION
write msrun peaks into mzxml output stream
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...