35 #ifndef OPENMS_FORMAT_HANDLERS_MZXMLHANDLER_H
36 #define OPENMS_FORMAT_HANDLERS_MZXMLHANDLER_H
49 class MetaInfoInterface;
59 template <
typename MapType>
104 virtual void endElement(
const XMLCh*
const uri,
const XMLCh*
const local_name,
const XMLCh*
const qname);
107 virtual void startElement(
const XMLCh*
const uri,
const XMLCh*
const local_name,
const XMLCh*
const qname,
const xercesc::Attributes& attributes);
110 virtual void characters(
const XMLCh*
const chars,
const XMLSize_t length);
113 void writeTo(std::ostream& os);
134 String(
";Quadrupole;Quadrupole Ion Trap;;;TOF;Magnetic Sector;FT-ICR;").
split(
';',
cv_terms_[3]);
197 std::vector<String> keys;
200 for (std::vector<String>::const_iterator it = keys.begin(); it != keys.end(); ++it)
204 os <<
String(indent,
'\t') <<
"<" << tag <<
" name=\"" << *it <<
"\" value=\"" << meta.
getMetaValue(*it) <<
"\"/>\n";
253 static bool init(
false);
256 s_value_ = xercesc::XMLString::transcode(
"value");
257 s_count_ = xercesc::XMLString::transcode(
"scanCount");
258 s_type_ = xercesc::XMLString::transcode(
"type");
259 s_name_ = xercesc::XMLString::transcode(
"name");
260 s_version_ = xercesc::XMLString::transcode(
"version");
261 s_filename_ = xercesc::XMLString::transcode(
"fileName");
262 s_filetype_ = xercesc::XMLString::transcode(
"fileType");
263 s_filesha1_ = xercesc::XMLString::transcode(
"fileSha1");
265 s_precision_ = xercesc::XMLString::transcode(
"precision");
266 s_byteorder_ = xercesc::XMLString::transcode(
"byteOrder");
267 s_pairorder_ = xercesc::XMLString::transcode(
"pairOrder");
272 s_mslevel_ = xercesc::XMLString::transcode(
"msLevel");
274 s_polarity_ = xercesc::XMLString::transcode(
"polarity");
275 s_scantype_ = xercesc::XMLString::transcode(
"scanType");
277 s_startmz_ = xercesc::XMLString::transcode(
"startMz");
278 s_endmz_ = xercesc::XMLString::transcode(
"endMz");
279 s_first_ = xercesc::XMLString::transcode(
"first");
280 s_last_ = xercesc::XMLString::transcode(
"last");
281 s_phone_ = xercesc::XMLString::transcode(
"phone");
282 s_email_ = xercesc::XMLString::transcode(
"email");
283 s_uri_ = xercesc::XMLString::transcode(
"URI");
284 s_num_ = xercesc::XMLString::transcode(
"num");
300 template <
typename MapType>
302 template <
typename MapType>
304 template <
typename MapType>
306 template <
typename MapType>
308 template <
typename MapType>
310 template <
typename MapType>
312 template <
typename MapType>
314 template <
typename MapType>
316 template <
typename MapType>
318 template <
typename MapType>
320 template <
typename MapType>
322 template <
typename MapType>
324 template <
typename MapType>
326 template <
typename MapType>
328 template <
typename MapType>
330 template <
typename MapType>
332 template <
typename MapType>
334 template <
typename MapType>
336 template <
typename MapType>
338 template <
typename MapType>
340 template <
typename MapType>
342 template <
typename MapType>
344 template <
typename MapType>
346 template <
typename MapType>
348 template <
typename MapType>
350 template <
typename MapType>
352 template <
typename MapType>
354 template <
typename MapType>
356 template <
typename MapType>
358 template <
typename MapType>
360 template <
typename MapType>
362 template <
typename MapType>
364 template <
typename MapType>
367 template <
typename MapType>
370 static bool init_static_members(
false);
371 if (!init_static_members)
373 initStaticMembers_();
376 static UInt scan_count = 0;
378 String tag = sm_.convert(qname);
379 open_tags_.push_back(tag);
383 if (skip_spectrum_ && tag !=
"scan")
389 optionalAttributeAsInt_(count, attributes, s_count_);
390 exp_->reserve(count);
391 logger_.startProgress(0, count,
"loading mzXML file");
393 data_processing_.clear();
396 else if (tag ==
"parentFile")
399 sf.
setNameOfFile(attributeAsString_(attributes, s_filename_));
400 sf.
setFileType(attributeAsString_(attributes, s_filetype_));
402 exp_->getSourceFiles().push_back(sf);
404 else if (tag ==
"software")
406 String& parent_tag = *(open_tags_.end() - 2);
407 if (parent_tag ==
"dataProcessing")
409 data_processing_.back().getSoftware().setVersion(attributeAsString_(attributes, s_version_));
410 data_processing_.back().getSoftware().setName(attributeAsString_(attributes, s_name_));
411 data_processing_.back().setMetaValue(
"#type",
String(attributeAsString_(attributes, s_type_)));
414 optionalAttributeAsString_(time, attributes, s_completiontime_);
415 data_processing_.back().setCompletionTime(asDateTime_(time));
417 else if (parent_tag ==
"msInstrument")
419 exp_->getInstrument().getSoftware().setVersion(attributeAsString_(attributes, s_version_));
420 exp_->getInstrument().getSoftware().setName(attributeAsString_(attributes, s_name_));
423 else if (tag ==
"peaks")
427 optionalAttributeAsString_(precision_, attributes, s_precision_);
428 if (precision_ !=
"32" && precision_ !=
"64")
430 error(LOAD,
String(
"Invalid precision '") + precision_ +
"' in element 'peaks'");
433 String byte_order =
"network";
434 optionalAttributeAsString_(byte_order, attributes, s_byteorder_);
435 if (byte_order !=
"network")
437 error(LOAD,
String(
"Invalid or missing byte order '") + byte_order +
"' in element 'peaks'. Must be 'network'!");
440 String pair_order =
"m/z-int";
441 optionalAttributeAsString_(pair_order, attributes, s_pairorder_);
442 if (pair_order !=
"m/z-int")
444 error(LOAD,
String(
"Invalid or missing pair order '") + pair_order +
"' in element 'peaks'. Must be 'm/z-int'!");
447 compressionType_ =
"none";
448 optionalAttributeAsString_(compressionType_, attributes, s_compressionType_);
449 if (compressionType_ !=
"none" && compressionType_ !=
"zlib")
451 error(LOAD,
String(
"Invalid compression type ") + compressionType_ +
"in elements 'peaks'. Must be 'none' or 'zlib'! ");
454 else if (tag ==
"precursorMz")
457 exp_->getSpectra().back().getPrecursors().push_back(
Precursor());
461 exp_->getSpectra().back().getPrecursors().back().setIntensity(attributeAsDouble_(attributes, s_precursorintensity_));
465 error(LOAD,
"Mandatory attribute 'precursorIntensity' of tag 'precursorMz' not found! Setting precursor intensity to zero!");
469 if (optionalAttributeAsInt_(charge, attributes, s_precursorcharge_))
471 exp_->getSpectra().back().getPrecursors().back().setCharge(charge);
475 if (optionalAttributeAsDouble_(window, attributes, s_windowwideness_))
477 exp_->getSpectra().back().getPrecursors().back().setIsolationWindowLowerOffset(window);
480 else if (tag ==
"scan")
482 skip_spectrum_ =
false;
484 if (options_.getMetadataOnly())
488 UInt ms_level = attributeAsInt_(attributes, s_mslevel_);
491 warning(LOAD,
String(
"Invalid 'msLevel' attribute with value '0' in 'scan' element found. Assuming ms level 1!"));
498 if (optionalAttributeAsString_(time_string, attributes, s_retentiontime_))
500 time_string = time_string.
suffix(
'T');
502 if (time_string.
has(
'H'))
504 retention_time += 3600 * asDouble_(time_string.
prefix(
'H'));
505 time_string = time_string.
suffix(
'H');
508 if (time_string.
has(
'M'))
510 retention_time += 60 * asDouble_(time_string.
prefix(
'M'));
511 time_string = time_string.
suffix(
'M');
514 if (time_string.
has(
'S'))
516 retention_time += asDouble_(time_string.
prefix(
'S'));
517 time_string = time_string.
suffix(
'S');
522 logger_.setProgress(scan_count);
524 if ((options_.hasRTRange() && !options_.getRTRange().encloses(
DPosition<1>(retention_time)))
525 || (options_.hasMSLevels() && !options_.containsMSLevel(ms_level)))
528 skip_spectrum_ =
true;
534 exp_->resize(exp_->size() + 1);
535 exp_->getSpectra().back().setMSLevel(ms_level);
536 exp_->getSpectra().back().setRT(retention_time);
537 exp_->getSpectra().back().setNativeID(
String(
"scan=") + attributeAsString_(attributes, s_num_));
539 peak_count_ = attributeAsInt_(attributes, s_peakscount_);
540 exp_->getSpectra().back().reserve(peak_count_ / 2 + 1);
541 exp_->getSpectra().back().setDataProcessing(data_processing_);
547 optionalAttributeAsDouble_(window.
begin, attributes, s_startmz_);
548 optionalAttributeAsDouble_(window.
end, attributes, s_endmz_);
549 if (window.
begin != 0.0 || window.
end != 0.0)
551 exp_->getSpectra().back().getInstrumentSettings().getScanWindows().push_back(window);
555 optionalAttributeAsString_(polarity, attributes, s_polarity_);
556 exp_->getSpectra().back().getInstrumentSettings().setPolarity((
IonSource::Polarity) cvStringToEnum_(0, polarity,
"polarity"));
559 optionalAttributeAsString_(type, attributes, s_scantype_);
564 else if (type ==
"zoom")
566 exp_->getSpectra().back().getInstrumentSettings().setZoomScan(
true);
569 else if (type ==
"Full")
576 else if (type ==
"SIM")
580 else if (type ==
"SRM" || type ==
"MRM")
584 else if (type ==
"CRM")
588 else if (type ==
"Q1")
592 else if (type ==
"Q3")
596 else if (type ==
"EMS")
600 else if (type ==
"EPI")
603 exp_->getSpectra().back().setMSLevel(2);
605 else if (type ==
"ER")
607 exp_->getSpectra().back().getInstrumentSettings().setZoomScan(
true);
613 warning(LOAD,
String(
"Unknown scan mode '") + type +
"'. Assuming full scan");
618 else if (tag ==
"operator")
620 exp_->getContacts().resize(1);
621 exp_->getContacts().back().setFirstName(attributeAsString_(attributes, s_first_));
622 exp_->getContacts().back().setLastName(attributeAsString_(attributes, s_last_));
625 optionalAttributeAsString_(tmp, attributes, s_email_);
626 exp_->getContacts().back().setEmail(tmp);
629 optionalAttributeAsString_(tmp, attributes, s_phone_);
632 exp_->getContacts().back().setMetaValue(
"#phone", tmp);
636 optionalAttributeAsString_(tmp, attributes, s_uri_);
637 exp_->getContacts().back().setURL(tmp);
639 else if (tag ==
"msManufacturer")
641 exp_->getInstrument().setVendor(attributeAsString_(attributes, s_value_));
643 else if (tag ==
"msModel")
645 exp_->getInstrument().setModel(attributeAsString_(attributes, s_value_));
647 else if (tag ==
"msIonisation")
649 exp_->getInstrument().getIonSources().resize(1);
650 exp_->getInstrument().getIonSources()[0].setIonizationMethod((
IonSource::IonizationMethod) cvStringToEnum_(2, attributeAsString_(attributes, s_value_),
"msIonization"));
652 else if (tag ==
"msMassAnalyzer")
654 exp_->getInstrument().getMassAnalyzers().resize(1);
655 exp_->getInstrument().getMassAnalyzers()[0].setType((
MassAnalyzer::AnalyzerType) cvStringToEnum_(3, attributeAsString_(attributes, s_value_),
"msMassAnalyzer"));
657 else if (tag ==
"msDetector")
659 exp_->getInstrument().getIonDetectors().resize(1);
660 exp_->getInstrument().getIonDetectors()[0].setType((
IonDetector::Type) cvStringToEnum_(4, attributeAsString_(attributes, s_value_),
"msDetector"));
662 else if (tag ==
"msResolution")
664 exp_->getInstrument().getMassAnalyzers()[0].setResolutionMethod((
MassAnalyzer::ResolutionMethod) cvStringToEnum_(5, attributeAsString_(attributes, s_value_),
"msResolution"));
666 else if (tag ==
"dataProcessing")
671 optionalAttributeAsString_(
boolean, attributes, s_deisotoped_);
672 if (
boolean ==
"true" ||
boolean ==
"1")
678 optionalAttributeAsString_(
boolean, attributes, s_chargedeconvoluted_);
679 if (
boolean ==
"true" ||
boolean ==
"1")
685 optionalAttributeAsDouble_(cutoff, attributes, s_intensitycutoff_);
688 data_processing_.back().setMetaValue(
"#intensity_cutoff", cutoff);
692 optionalAttributeAsString_(
boolean, attributes, s_centroided_);
693 if (
boolean ==
"true" ||
boolean ==
"1")
698 else if (tag ==
"nameValue")
701 optionalAttributeAsString_(name, attributes, s_name_);
706 optionalAttributeAsString_(value, attributes, s_value_);
708 String& parent_tag = *(open_tags_.end() - 2);
710 if (parent_tag ==
"msInstrument")
712 exp_->getInstrument().setMetaValue(name, value);
714 else if (parent_tag ==
"scan")
716 exp_->getSpectra().back().setMetaValue(name, value);
720 std::cout <<
" Warning: Unexpected tag 'nameValue' in tag '" << parent_tag <<
"'" <<
"\n";
723 else if (tag ==
"processingOperation")
726 optionalAttributeAsString_(name, attributes, s_name_);
731 optionalAttributeAsString_(value, attributes, s_value_);
733 data_processing_.back().setMetaValue(name, value);
739 template <
typename MapType>
744 static const XMLCh* s_mzxml = xercesc::XMLString::transcode(
"mzXML");
745 static const XMLCh* s_peaks = xercesc::XMLString::transcode(
"peaks");
747 open_tags_.pop_back();
753 if (equal_(qname, s_mzxml))
755 logger_.endProgress();
757 else if (equal_(qname, s_peaks))
760 if (char_rest_ ==
"")
767 char_rest_.removeWhitespaces();
769 if (precision_ ==
"64")
771 std::vector<DoubleReal> data;
772 if (compressionType_ ==
"zlib")
783 for (
Size n = 0; n < (2 * peak_count_); n += 2)
786 if ((!options_.hasMZRange() || options_.getMZRange().encloses(
DPosition<1>(data[n])))
787 && (!options_.hasIntensityRange() || options_.getIntensityRange().encloses(
DPosition<1>(data[n + 1]))))
790 peak.setIntensity(data[n + 1]);
791 exp_->getSpectra().back().push_back(peak);
797 std::vector<Real> data;
798 if (compressionType_ ==
"zlib")
809 for (
Size n = 0; n < (2 * peak_count_); n += 2)
811 if ((!options_.hasMZRange() || options_.getMZRange().encloses(
DPosition<1>(data[n])))
812 && (!options_.hasIntensityRange() || options_.getIntensityRange().encloses(
DPosition<1>(data[n + 1]))))
815 peak.setIntensity(data[n + 1]);
816 exp_->getSpectra().back().push_back(peak);
825 template <
typename MapType>
832 char* transcoded_chars = sm_.convert(chars);
834 if (open_tags_.back() ==
"peaks")
837 char_rest_ += transcoded_chars;
839 else if (open_tags_.back() ==
"offset" || open_tags_.back() ==
"indexOffset" || open_tags_.back() ==
"sha1")
843 else if (open_tags_.back() ==
"precursorMz")
845 DoubleReal mz_pos = asDouble_(transcoded_chars);
847 exp_->getSpectra().back().getPrecursors().back().setMZ(mz_pos);
849 DoubleReal window_width = exp_->getSpectra().back().getPrecursors().back().getIsolationWindowLowerOffset();
850 if (window_width != 0.0)
852 exp_->getSpectra().back().getPrecursors().back().setIsolationWindowLowerOffset(mz_pos - 0.5 * window_width);
853 exp_->getSpectra().back().getPrecursors().back().setIsolationWindowUpperOffset(mz_pos + 0.5 * window_width);
856 else if (open_tags_.back() ==
"comment")
858 String parent_tag = *(open_tags_.end() - 2);
861 if (parent_tag ==
"msInstrument")
863 exp_->getInstrument().setMetaValue(
"#comment",
String(transcoded_chars));
865 else if (parent_tag ==
"dataProcessing")
869 else if (parent_tag ==
"scan")
871 exp_->getSpectra().back().setComment(transcoded_chars);
873 else if (
String(transcoded_chars).trim() !=
"")
875 warning(LOAD,
String(
"Unhandled comment '") + transcoded_chars +
"' in element '" + open_tags_.back() +
"'");
878 else if (
String(transcoded_chars).
trim() !=
"")
880 warning(LOAD,
String(
"Unhandled character content '") + transcoded_chars +
"' in element '" + open_tags_.back() +
"'");
884 template <
typename MapType>
889 for (
Size s = 0; s < cexp_->size(); s++)
892 if (spec.size() != 0)
897 logger_.startProgress(0, cexp_->size(),
"storing mzXML file");
898 os <<
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
899 <<
"<mzXML xmlns=\"http://sashimi.sourceforge.net/schema_revision/mzXML_2.1\" "
900 <<
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
901 <<
"xsi:schemaLocation=\"http://sashimi.sourceforge.net/schema_revision/mzXML_2.1 "
902 <<
"http://sashimi.sourceforge.net/schema_revision/mzXML_2.1/mzXML_idx_2.1.xsd\">\n"
903 <<
"\t<msRun scanCount=\"" << count_tmp_ <<
"\">\n";
908 if (cexp_->getSourceFiles().empty())
910 os <<
"\t\t<parentFile fileName=\"\" fileType=\"processedData\" fileSha1=\"0000000000000000000000000000000000000000\"/>\n";
914 for (
Size i = 0; i < cexp_->getSourceFiles().size(); ++i)
916 const SourceFile& sf = cexp_->getSourceFiles()[i];
917 os <<
"\t\t<parentFile fileName=\"" << sf.
getNameOfFile() <<
"\" fileType=\"";
927 os <<
"processedData";
930 os <<
"\" fileSha1=\"";
934 os <<
"0000000000000000000000000000000000000000";
947 if (cexp_->getInstrument() !=
Instrument() || cexp_->getContacts().size() != 0)
949 const Instrument& inst = cexp_->getInstrument();
950 os <<
"\t\t<msInstrument>\n"
951 <<
"\t\t\t<msManufacturer category=\"msManufacturer\" value=\"" << inst.
getVendor() <<
"\"/>\n" <<
"\t\t\t<msModel category=\"msModel\" value=\"" << inst.
getModel() <<
"\"/>\n";
954 os <<
"\t\t\t<msIonisation category=\"msIonisation\" value=\"\"/>\n";
958 os <<
"\t\t\t<msIonisation category=\"msIonisation\" value=\"" << cv_terms_[2][inst.
getIonSources()[0].getIonizationMethod()] <<
"\"/>\n";
961 if (analyzers.empty() || !analyzers[0].getResolutionMethod())
963 os <<
"\t\t\t<msMassAnalyzer category=\"msMassAnalyzer\" value=\"\"/>\n";
967 os <<
"\t\t\t<msMassAnalyzer category=\"msMassAnalyzer\" value=\"" << cv_terms_[3][analyzers[0].getType()] <<
"\"/>\n";
971 os <<
"\t\t\t<msDetector category=\"msDetector\" value=\"\"/>\n";
975 os <<
"\t\t\t<msDetector category=\"msDetector\" value=\"" << cv_terms_[4][inst.
getIonDetectors()[0].getType()] <<
"\"/>\n";
978 if (analyzers.empty() || !analyzers[0].getResolutionMethod())
980 os <<
"\t\t\t<msResolution category=\"msResolution\" value=\"\"/>\n";
984 os <<
"\t\t\t<msResolution category=\"msResolution\" value=\"" << cv_terms_[5][analyzers[0].getResolutionMethod()] <<
"\"/>\n";
987 if (cexp_->getContacts().size() > 0)
995 os <<
" email=\"" << cont.
getEmail() <<
"\"";
1000 os <<
" URI=\"" << cont.
getURL() <<
"\"";
1010 writeUserParam_(os, inst, 3);
1014 os <<
"\t\t\t<comment>" << inst.
getMetaValue(
"#comment") <<
"</comment>\n";
1017 os <<
"\t\t</msInstrument>\n";
1023 if (cexp_->size() == 0 || (*cexp_)[0].getDataProcessing().empty())
1025 os <<
"\t\t<dataProcessing>\n"
1026 <<
"\t\t\t<software type=\"processing\" name=\"\" version=\"\"/>\n"
1027 <<
"\t\t</dataProcessing>\n";
1031 for (
Size i = 0; i < (*cexp_)[0].getDataProcessing().size(); ++i)
1033 const DataProcessing& data_processing = (*cexp_)[0].getDataProcessing()[i];
1034 os <<
"\t\t<dataProcessing deisotoped=\""
1036 <<
"\" chargeDeconvoluted=\""
1038 <<
"\" centroided=\""
1043 os <<
" intensityCutoff=\"" << data_processing.
getMetaValue(
"#intensity_cutoff").
toString() <<
"\"";
1046 <<
"\t\t\t<software type=\"";
1061 os <<
"\" completionTime=\"" << data_processing.
getCompletionTime().
get().substitute(
' ',
'T');
1064 writeUserParam_(os, data_processing, 3,
"processingOperation");
1066 os <<
"\t\t</dataProcessing>\n";
1072 bool all_numbers =
true;
1073 bool all_empty =
true;
1074 bool all_prefixed_numbers =
true;
1075 for (
Size s = 0; s < cexp_->size(); s++)
1077 String native_id = (*cexp_)[s].getNativeID();
1080 all_prefixed_numbers =
false;
1084 native_id = native_id.
substr(5);
1092 all_numbers =
false;
1093 all_prefixed_numbers =
false;
1094 if (native_id !=
"")
1101 if (!all_numbers && !all_empty)
1103 warning(STORE,
"Not all spectrum native IDs are numbers or correctly prefixed with 'scan='. The spectra are renumbered and the native IDs are lost!");
1107 std::stack<UInt> open_scans;
1108 for (
Size s = 0; s < cexp_->size(); s++)
1110 logger_.setProgress(s);
1114 open_scans.push(ms_level);
1116 Size spectrum_id = s + 1;
1117 if (all_prefixed_numbers)
1121 else if (all_numbers)
1126 os <<
String(ms_level + 1,
'\t')
1127 <<
"<scan num=\"" << spectrum_id <<
"\" msLevel=\""
1128 << ms_level <<
"\" peaksCount=\""
1129 << spec.size() <<
"\" polarity=\"";
1154 os <<
"\" scanType=\"zoom";
1158 os <<
"\" scanType=\"Full";
1163 os <<
"\" scanType=\"SIM";
1167 os <<
"\" scanType=\"SRM";
1171 os <<
"\" scanType=\"CRM";
1175 os <<
"\" scanType=\"Full";
1179 os <<
"\" retentionTime=\"";
1180 if (spec.
getRT() < 0)
1182 os <<
"PT" << std::fabs(spec.
getRT()) <<
"S\"";
1189 warning(STORE,
"The MzXML format can store only one scan window for each scan. Only the first one is stored!");
1198 os <<
String(ms_level + 2,
'\t') <<
"<precursorMz precursorIntensity=\"" << precursor.
getIntensity();
1201 os <<
"\" precursorCharge=\"" << precursor.
getCharge();
1206 os <<
"\">" << precursor.
getMZ() <<
"</precursorMz>\n";
1211 os <<
String(ms_level + 2,
'\t') <<
"<peaks precision=\"32\"" <<
" byteOrder=\"network\" pairOrder=\"m/z-int\">";
1214 std::vector<Real> tmp;
1215 for (
Size i = 0; i < spec.size(); i++)
1217 tmp.push_back(spec[i].getMZ());
1218 tmp.push_back(spec[i].getIntensity());
1223 os << encoded <<
"</peaks>\n";
1227 os <<
String(ms_level + 2,
'\t') <<
"<peaks precision=\"32\"" <<
" byteOrder=\"network\" pairOrder=\"m/z-int\" xsi:nil=\"true\"/>\n";
1230 writeUserParam_(os, spec, ms_level + 2);
1233 os <<
String(ms_level + 2,
'\t') <<
"<comment>" << spec.
getComment() <<
"</comment>\n";
1237 UInt next_ms_level = 0;
1238 if (s < cexp_->size() - 1)
1240 next_ms_level = ((*cexp_)[s + 1]).getMSLevel();
1243 if (next_ms_level <= ms_level)
1245 for (
Size i = 0; i <= ms_level - next_ms_level && !open_scans.empty(); ++i)
1247 os <<
String(ms_level - i + 1,
'\t') <<
"</scan>\n";
1253 os <<
"\t</msRun>\n"
1254 <<
"\t<indexOffset>0</indexOffset>\n"
1257 logger_.endProgress();
1258 spec_write_counter_ = 1;
Deisotoping.
Definition: DataProcessing.h:62
Descripton of the applied preprocessing steps.
Definition: DataProcessing.h:51
String compressionType_
Definition: MzXMLHandler.h:181
ChecksumType getChecksumType() const
returns the checksum type
void writeUserParam_(std::ostream &os, const MetaInfoInterface &meta, int indent=4, String tag="nameValue")
write metaInfo to xml (usually in nameValue-tag)
Definition: MzXMLHandler.h:195
Definition: IonSource.h:134
Big endian type.
Definition: Base64.h:78
Description of a MS instrument.
Definition: Instrument.h:64
const String & getNameOfFile() const
returns the file name
const Software & getSoftware() const
returns a const reference to the instrument software
static const XMLCh * s_count_
Definition: MzXMLHandler.h:217
A more convenient string class.
Definition: String.h:56
Precursor meta information.
Definition: Precursor.h:56
Class to encode and decode Base64.
Definition: Base64.h:64
String precision_
Definition: MzXMLHandler.h:180
Exception that is thrown if the parsing is ended by some event (e.g. if only a prefix of the XML file...
Definition: XMLHandler.h:94
const std::vector< IonSource > & getIonSources() const
returns a const reference to the ion source list
static const XMLCh * s_peakscount_
Definition: MzXMLHandler.h:233
UInt getMSLevel() const
Returns the MS level.
Definition: MSSpectrum.h:231
static const XMLCh * s_name_
Definition: MzXMLHandler.h:219
Definition: MassAnalyzer.h:86
IntensityType getIntensity() const
Definition: Peak1D.h:103
static const XMLCh * s_first_
Definition: MzXMLHandler.h:239
static const XMLCh * s_phone_
Definition: MzXMLHandler.h:241
static const XMLCh * s_centroided_
Definition: MzXMLHandler.h:246
UInt spec_write_counter_
spectrum counter (spectra without peaks are not written)
Definition: MzXMLHandler.h:189
const std::set< ProcessingAction > & getProcessingActions() const
returns a const reference to the applied processing actions
static const XMLCh * s_precursorcharge_
Definition: MzXMLHandler.h:230
static const XMLCh * s_filesha1_
Definition: MzXMLHandler.h:223
SpectrumType::Iterator PeakIterator
Definition: MzXMLHandler.h:166
const String & getComment() const
returns the free-text comment
Negative polarity.
Definition: IonSource.h:144
const std::vector< MassAnalyzer > & getMassAnalyzers() const
returns a const reference to the mass analyer list
String toString() const
Conversion to String.
DoubleReal end
End of the window.
Definition: ScanWindow.h:64
Peak2D PeakType
Definition: MassTrace.h:49
void setFileType(const String &file_type)
sets the file type
XML handlers for MzXMLFile.
Definition: MzXMLHandler.h:60
CoordinateType getMZ() const
Non-mutable access to m/z.
Definition: Peak1D.h:108
Positive polarity.
Definition: IonSource.h:143
Definition: MassAnalyzer.h:70
Int getCharge() const
Non-mutable access to the charge.
virtual void startElement(const XMLCh *const uri, const XMLCh *const local_name, const XMLCh *const qname, const xercesc::Attributes &attributes)
Parsing method for opening tags.
Definition: MzXMLHandler.h:368
Base class for XML handlers.
Definition: XMLHandler.h:89
const std::vector< IonDetector > & getIonDetectors() const
returns a const reference to the ion detector list
Description of a file location, used to store the origin of (meta) data.
Definition: SourceFile.h:47
static const XMLCh * s_retentiontime_
Definition: MzXMLHandler.h:236
XMLHandler()
Not implemented.
bool has(Byte byte) const
true if String contains the byte, false otherwise
DoubleReal begin
Begin of the window.
Definition: ScanWindow.h:62
MS2+ mass spectrum, is a "mass spectrum".
Definition: InstrumentSettings.h:58
ContainerType::iterator Iterator
Mutable iterator.
Definition: MSSpectrum.h:123
Type
Detector type.
Definition: IonDetector.h:52
Selected reaction monitoring scan Synonyms: 'Multiple reaction monitoring scan', 'SRM scan', 'MRM scan'.
Definition: InstrumentSettings.h:60
void setChecksum(const String &checksum, ChecksumType type)
sets the file's checksum
static const XMLCh * s_scantype_
Definition: MzXMLHandler.h:235
const MapType * cexp_
map pointer for writing
Definition: MzXMLHandler.h:171
bool getZoomScan() const
return if this scan is a zoom (enhanced resolution) scan
ScanMode getScanMode() const
returns the scan mode
Definition: IonDetector.h:76
void get(UInt &month, UInt &day, UInt &year, UInt &hour, UInt &minute, UInt &second) const
Fills the arguments with the date and the time.
ResolutionMethod
resolution method
Definition: MassAnalyzer.h:80
static const XMLCh * s_polarity_
Definition: MzXMLHandler.h:234
virtual ~MzXMLHandler()
Destructor.
Definition: MzXMLHandler.h:97
Int toInt() const
Conversion to int.
void init_()
Definition: MzXMLHandler.h:123
const std::vector< ScanWindow > & getScanWindows() const
returns a const reference to the m/z scan windows
static const XMLCh * s_byteorder_
Definition: MzXMLHandler.h:226
static const XMLCh * s_completiontime_
Definition: MzXMLHandler.h:224
String & toLower()
Converts the string to lowercase.
bool hasSubstring(const String &string) const
true if String contains the string, false otherwise
PeakFileOptions options_
Options for loading and storing.
Definition: MzXMLHandler.h:174
static const XMLCh * s_num_
Definition: MzXMLHandler.h:244
const String & getModel() const
returns the instrument model
String & trim()
removes whitespaces (space, tab, line feed, carriage return) at the beginning and the end of the stri...
Scan window description.
Definition: ScanWindow.h:47
const String & getVendor() const
returns the instrument vendor
String char_rest_
Definition: MzXMLHandler.h:182
void setOptions(const PeakFileOptions &options)
Sets the options.
Definition: MzXMLHandler.h:116
static const XMLCh * s_value_
Definition: MzXMLHandler.h:216
full scan mass spectrum, is a "mass spectrum" Synonyms: 'full spectrum', 'Q1 spectrum', 'Q3 spectrum', 'Single-Stage Mass Spectrometry'
Definition: InstrumentSettings.h:57
DoubleReal getIsolationWindowUpperOffset() const
returns the upper offset from the target m/z
const Software & getSoftware() const
returns a const reference to the software used for processing
IonizationMethod
ionization method
Definition: IonSource.h:80
const String & getName() const
returns the name of the software
static const XMLCh * s_pairorder_
Definition: MzXMLHandler.h:227
Selected ion monitoring scan Synonyms: 'Multiple ion monitoring scan', 'SIM scan', 'MIM scan'.
Definition: InstrumentSettings.h:59
UInt peak_count_
Definition: MzXMLHandler.h:179
std::vector< DataProcessing > data_processing_
data processing auxilary variable
Definition: MzXMLHandler.h:210
Invalid conversion exception.
Definition: Exception.h:363
void setNameOfFile(const String &name_of_file)
sets the file name
static const XMLCh * s_version_
Definition: MzXMLHandler.h:220
const String & getFileType() const
returns the file type
MapType::PeakType PeakType
Peak type.
Definition: MzXMLHandler.h:162
Secure Hash Algorithm-1.
Definition: SourceFile.h:55
static const XMLCh * s_last_
Definition: MzXMLHandler.h:240
Consecutive reaction monitoring scan Synonyms: 'CRM scan'.
Definition: InstrumentSettings.h:61
const String & getVersion() const
returns the software version
const DateTime & getCompletionTime() const
returns the time of completition of the processing
IonSource::Polarity getPolarity() const
returns the polarity
MzXMLHandler(const MapType &exp, const String &filename, const String &version, const ProgressLogger &logger)
Constructor for a write-only handler.
Definition: MzXMLHandler.h:82
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
MSSpectrum< PeakType > SpectrumType
Spectrum type.
Definition: MzXMLHandler.h:164
Unknown scan method.
Definition: InstrumentSettings.h:55
String prefix(SizeType length) const
returns the prefix of length length
const String & getChecksum() const
returns the file's checksum
DateTime Class.
Definition: DateTime.h:55
Base class for all classes that want to report their progess.
Definition: ProgressLogger.h:56
String substr(size_t pos=0, size_t n=npos) const
Wrapper for the STL substr() method. Returns a String object with its contents initialized to a subst...
bool skip_spectrum_
Flag that indicates whether this spectrum should be skipped (due to options)
Definition: MzXMLHandler.h:186
const InstrumentSettings & getInstrumentSettings() const
returns a const reference to the instrument settings of the current spectrum
Peak picking (conversion from raw to peak data)
Definition: DataProcessing.h:67
static const XMLCh * s_startmz_
Definition: MzXMLHandler.h:237
Base64 decoder_
Definition: MzXMLHandler.h:178
static const XMLCh * s_type_
Definition: MzXMLHandler.h:218
general spectrum type
Definition: InstrumentSettings.h:56
DoubleReal getRT() const
Definition: MSSpectrum.h:215
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
Options for loading files containing peak data.
Definition: PeakFileOptions.h:47
std::vector< std::vector< String > > cv_terms_
Array of CV term lists (one sublist denotes one term and it's children)
Definition: XMLHandler.h:192
AnalyzerType
analyzer type
Definition: MassAnalyzer.h:53
virtual void endElement(const XMLCh *const uri, const XMLCh *const local_name, const XMLCh *const qname)
Parsing method for closing tags.
Definition: MzXMLHandler.h:740
const ProgressLogger & logger_
Progress logging class.
Definition: MzXMLHandler.h:192
static const std::string NamesOfScanMode[SIZE_OF_SCANMODE]
Names of scan modes.
Definition: InstrumentSettings.h:74
const String & getNativeID() const
returns the native identifier for the spectrum, used by the acquisition software. ...
static const XMLCh * s_filename_
Definition: MzXMLHandler.h:221
virtual void characters(const XMLCh *const chars, const XMLSize_t length)
Parsing method for character data.
Definition: MzXMLHandler.h:826
String suffix(SizeType length) const
returns the suffix of length length
void initStaticMembers_()
Definition: MzXMLHandler.h:251
int Int
Signed integer type.
Definition: Types.h:100
MapType * exp_
map pointer for reading
Definition: MzXMLHandler.h:169
static const XMLCh * s_endmz_
Definition: MzXMLHandler.h:238
static const XMLCh * s_deisotoped_
Definition: MzXMLHandler.h:247
bool split(const char splitter, std::vector< String > &substrings, bool quote_protect=false) const
Splits a string into substrings using splitter as delimiter.
static const XMLCh * s_uri_
Definition: MzXMLHandler.h:243
Charge deconvolution.
Definition: DataProcessing.h:61
MzXMLHandler()
Not implemented.
void writeTo(std::ostream &os)
Write the contents to a stream.
Definition: MzXMLHandler.h:885
DoubleReal getIsolationWindowLowerOffset() const
returns the lower offset from the target m/z
static const XMLCh * s_filetype_
Definition: MzXMLHandler.h:222
static const XMLCh * s_intensitycutoff_
Definition: MzXMLHandler.h:245
static const XMLCh * s_mslevel_
Definition: MzXMLHandler.h:232
static const XMLCh * s_email_
Definition: MzXMLHandler.h:242
Polarity
Polarity of the ion source.
Definition: IonSource.h:140
static const XMLCh * s_precursorintensity_
Definition: MzXMLHandler.h:229
static const XMLCh * s_compressionType_
Definition: MzXMLHandler.h:228
bool hasPrefix(const String &string) const
true if String begins with string, false otherwise
Parse Error exception.
Definition: Exception.h:608
static const XMLCh * s_windowwideness_
Definition: MzXMLHandler.h:231
static const XMLCh * s_chargedeconvoluted_
Definition: MzXMLHandler.h:248
static const XMLCh * s_precision_
Definition: MzXMLHandler.h:225