35 #ifndef OPENMS_FORMAT_HANDLERS_MZMLHANDLER_H
36 #define OPENMS_FORMAT_HANDLERS_MZMLHANDLER_H
63 #include <boost/shared_ptr.hpp>
89 class ControlledVocabulary;
109 template <
typename MapType>
150 LOG_ERROR <<
"MzMLHandler was initialized with an invalid version number: " <<
version_ << std::endl;
187 LOG_ERROR <<
"MzMLHandler was initialized with an invalid version number: " <<
version_ << std::endl;
199 virtual void endElement(
const XMLCh*
const ,
const XMLCh*
const ,
const XMLCh*
const qname);
202 virtual void startElement(
const XMLCh*
const ,
const XMLCh*
const ,
const XMLCh*
const qname,
const xercesc::Attributes& attributes);
205 virtual void characters(
const XMLCh*
const chars,
const XMLSize_t length);
208 virtual void writeTo(std::ostream& os);
267 std::vector<std::vector< ConstDataProcessingPtr > >& dps);
271 template <
typename ContainerT>
278 std::vector<double> data_to_encode(container.size());
279 if (array_type ==
"intensity")
281 for (
Size p = 0; p < container.size(); ++p)
283 data_to_encode[p] = container[p].getIntensity();
288 for (
Size p = 0; p < container.size(); ++p)
290 data_to_encode[p] = container[p].getMZ();
297 std::vector<float> data_to_encode(container.size());
299 if (array_type ==
"intensity")
301 for (
Size p = 0; p < container.size(); ++p)
303 data_to_encode[p] = container[p].getIntensity();
308 for (
Size p = 0; p < container.size(); ++p)
310 data_to_encode[p] = container[p].getMZ();
332 #pragma omp parallel for
351 #pragma omp critical(HandleException)
396 #pragma omp parallel for
442 template <
typename SpectrumType>
444 const Size n, SpectrumType& spectrum)
const
448 UInt meta_float_array_index = 0;
449 UInt meta_int_array_index = 0;
450 UInt meta_string_array_index = 0;
451 for (
Size i = 0; i < input_data.size(); i++)
453 if (input_data[i].meta.getName() !=
"m/z array" && input_data[i].meta.getName() !=
"intensity array")
457 if (n < input_data[i].size)
462 ++meta_float_array_index;
466 if (n < input_data[i].size)
471 ++meta_int_array_index;
475 if (n < input_data[i].decoded_char.size())
477 String value = input_data[i].decoded_char[n];
480 ++meta_string_array_index;
496 template <
typename SpectrumType>
499 SpectrumType& spectrum)
507 bool mz_precision_64 =
true;
508 bool int_precision_64 =
true;
515 if (int_index == -1 || mz_index == -1)
518 if (default_arr_length != 0)
520 warning(
LOAD,
String(
"The m/z or intensity array of spectrum '") + spectrum.
getNativeID() +
"' is missing and default_arr_length is " + default_arr_length +
".");
526 if ((input_data[mz_index].ints_32.size() > 0) || (input_data[mz_index].ints_64.size() > 0))
528 fatalError(
LOAD,
"Encoding m/z array as integer is not allowed!");
530 if ((input_data[int_index].ints_32.size() > 0) || (input_data[int_index].ints_64.size() > 0))
532 fatalError(
LOAD,
"Encoding intensity array as integer is not allowed!");
536 Size mz_size = mz_precision_64 ? input_data[mz_index].floats_64.size() : input_data[mz_index].floats_32.size();
537 Size int_size = int_precision_64 ? input_data[int_index].floats_64.size() : input_data[int_index].floats_32.size();
539 if (mz_size != int_size)
541 fatalError(
LOAD,
String(
"The length of m/z and integer values of spectrum '") + spectrum.
getNativeID() +
"' differ (mz-size: " + mz_size +
", int-size: " + int_size +
"! Not reading spectrum!");
543 bool repair_array_length =
false;
544 if (default_arr_length != mz_size)
546 warning(
LOAD,
String(
"The m/z array of spectrum '") + spectrum.
getNativeID() +
"' has the size " + mz_size +
", but it should have size " + default_arr_length +
" (defaultArrayLength).");
547 repair_array_length =
true;
549 if (default_arr_length != int_size)
551 warning(
LOAD,
String(
"The intensity array of spectrum '") + spectrum.
getNativeID() +
"' has the size " + int_size +
", but it should have size " + default_arr_length +
" (defaultArrayLength).");
552 repair_array_length =
true;
554 if (repair_array_length)
556 default_arr_length = int_size;
557 warning(
LOAD,
String(
"Fixing faulty defaultArrayLength to ") + default_arr_length +
".");
561 if (input_data.size() > 2)
563 for (
Size i = 0; i < input_data.size(); i++)
565 if (input_data[i].meta.getName() !=
"m/z array" && input_data[i].meta.getName() !=
"intensity array")
574 spectrum.
getFloatDataArrays().back().MetaInfoDescription::operator=(input_data[i].meta);
600 for (
Size i = 0; i < input_data.size(); i++)
602 if (input_data[i].meta.getName() ==
"m/z array" || input_data[i].meta.getName() ==
"intensity array")
604 std::vector<UInt> keys;
605 input_data[i].meta.getKeys(keys);
606 for (
Size k = 0;
k < keys.size(); ++
k)
608 spectrum.
setMetaValue(keys[
k], input_data[i].meta.getMetaValue(keys[k]));
618 spectrum.reserve(default_arr_length);
622 if ( mz_precision_64 && !int_precision_64 &&
623 input_data.size() == 2 &&
628 std::vector< double >::iterator mz_it = input_data[mz_index].floats_64.begin();
629 std::vector< float >::iterator int_it = input_data[int_index].floats_32.begin();
630 for (
Size n = 0; n < default_arr_length; n++)
633 tmp.setIntensity(*int_it);
637 spectrum.push_back(tmp);
642 for (
Size n = 0; n < default_arr_length; n++)
644 double mz = mz_precision_64 ? input_data[mz_index].floats_64[n] : input_data[mz_index].floats_32[n];
645 double intensity = int_precision_64 ? input_data[int_index].floats_64[n] : input_data[int_index].floats_32[n];
650 tmp.setIntensity(intensity);
652 spectrum.push_back(tmp);
657 if (input_data.size() > 2)
672 template <
typename ChromatogramType>
675 ChromatogramType& inp_chromatogram)
683 bool int_precision_64 =
true;
684 bool rt_precision_64 =
true;
691 if (int_index == -1 || rt_index == -1)
694 if (default_arr_length != 0)
696 warning(
LOAD,
String(
"The m/z or intensity array of chromatogram '") + inp_chromatogram.
getNativeID() +
"' is missing and default_arr_length is " + default_arr_length +
".");
702 Size rt_size = rt_precision_64 ? input_data[rt_index].floats_64.size() : input_data[rt_index].floats_32.size();
703 if (default_arr_length != rt_size)
705 warning(
LOAD,
String(
"The base64-decoded rt array of chromatogram '") + inp_chromatogram.
getNativeID() +
"' has the size " + rt_size +
", but it should have size " + default_arr_length +
" (defaultArrayLength).");
707 Size int_size = int_precision_64 ? input_data[int_index].floats_64.size() : input_data[int_index].floats_32.size();
708 if (default_arr_length != int_size)
710 warning(
LOAD,
String(
"The base64-decoded intensity array of chromatogram '") + inp_chromatogram.
getNativeID() +
"' has the size " + int_size +
", but it should have size " + default_arr_length +
" (defaultArrayLength).");
714 if (input_data.size() > 2)
716 for (
Size i = 0; i < input_data.size(); i++)
718 if (input_data[i].meta.getName() !=
"intensity array" && input_data[i].meta.getName() !=
"time array")
727 inp_chromatogram.
getFloatDataArrays().back().MetaInfoDescription::operator=(input_data[i].meta);
736 inp_chromatogram.
getIntegerDataArrays().back().MetaInfoDescription::operator=(input_data[i].meta);
745 inp_chromatogram.
getStringDataArrays().back().MetaInfoDescription::operator=(input_data[i].meta);
753 for (
Size i = 0; i < input_data.size(); i++)
755 if (input_data[i].meta.getName() ==
"time array" || input_data[i].meta.getName() ==
"intensity array")
757 std::vector<UInt> keys;
758 input_data[i].meta.getKeys(keys);
759 for (
Size k = 0;
k < keys.size(); ++
k)
761 inp_chromatogram.
setMetaValue(keys[
k], input_data[i].meta.getMetaValue(keys[k]));
767 inp_chromatogram.reserve(default_arr_length);
768 ChromatogramPeakType tmp;
769 for (
Size n = 0; n < default_arr_length; n++)
771 double rt = rt_precision_64 ? input_data[rt_index].floats_64[n] : input_data[rt_index].floats_32[n];
772 double intensity = int_precision_64 ? input_data[int_index].floats_64[n] : input_data[int_index].floats_32[n];
777 tmp.setIntensity(intensity);
779 inp_chromatogram.push_back(tmp);
782 UInt meta_float_array_index = 0;
783 UInt meta_int_array_index = 0;
784 UInt meta_string_array_index = 0;
785 for (
Size i = 0; i < input_data.size(); i++)
787 if (input_data[i].meta.getName() !=
"intensity array" && input_data[i].meta.getName() !=
"time array")
791 if (n < input_data[i].size)
796 ++meta_float_array_index;
800 if (n < input_data[i].size)
805 ++meta_int_array_index;
809 if (n < input_data[i].decoded_char.size())
811 String value = input_data[i].decoded_char[n];
814 ++meta_string_array_index;
822 template <
typename DataType>
826 bool no_numpress =
true;
831 String compression_term_no_np;
833 if (array_type ==
"mz")
835 cv_term_type =
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000514\" name=\"m/z array\" unitAccession=\"MS:1000040\" unitName=\"m/z\" unitCvRef=\"MS\" />\n";
840 else if (array_type ==
"time")
842 cv_term_type =
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000595\" name=\"time array\" unitAccession=\"UO:0000010\" unitName=\"second\" unitCvRef=\"MS\" />\n";
847 else if (array_type ==
"intensity")
849 cv_term_type =
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000515\" name=\"intensity array\" unitAccession=\"MS:1000131\" unitName=\"number of detector counts\" unitCvRef=\"MS\"/>\n";
863 if (!encoded_string.empty())
867 os <<
"\t\t\t\t\t<binaryDataArray encodedLength=\"" << encoded_string.size() <<
"\">\n";
869 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000523\" name=\"64-bit float\" />\n";
874 if (is32bit && no_numpress)
876 compression_term = compression_term_no_np;
878 os <<
"\t\t\t\t\t<binaryDataArray encodedLength=\"" << encoded_string.size() <<
"\">\n";
880 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000521\" name=\"32-bit float\" />\n";
882 else if (!is32bit && no_numpress)
884 compression_term = compression_term_no_np;
886 os <<
"\t\t\t\t\t<binaryDataArray encodedLength=\"" << encoded_string.size() <<
"\">\n";
888 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000523\" name=\"64-bit float\" />\n";
891 os <<
"\t\t\t\t\t\t" << compression_term <<
"\n";
892 os <<
"\t\t\t\t\t\t<binary>" << encoded_string <<
"</binary>\n";
893 os <<
"\t\t\t\t\t</binaryDataArray>\n";
1049 template <
typename MapType>
1053 if (skip_spectrum_ || skip_chromatogram_)
1056 String& current_tag = open_tags_.back();
1058 if (current_tag ==
"binary")
1061 sm_.appendASCII(chars, length, data_.back().base64);
1063 else if (current_tag ==
"offset" || current_tag ==
"indexListOffset" || current_tag ==
"fileChecksum")
1072 char* transcoded_chars = sm_.convert(chars);
1073 String transcoded_chars2 = transcoded_chars;
1074 transcoded_chars2.
trim();
1075 if (transcoded_chars2 !=
"")
1076 warning(LOAD,
String(
"Unhandled character content in tag '") + current_tag +
"': " + transcoded_chars2);
1080 template <
typename MapType>
1083 static const XMLCh* s_count = xercesc::XMLString::transcode(
"count");
1084 static const XMLCh* s_default_array_length = xercesc::XMLString::transcode(
"defaultArrayLength");
1085 static const XMLCh* s_array_length = xercesc::XMLString::transcode(
"arrayLength");
1086 static const XMLCh* s_accession = xercesc::XMLString::transcode(
"accession");
1087 static const XMLCh* s_name = xercesc::XMLString::transcode(
"name");
1088 static const XMLCh* s_type = xercesc::XMLString::transcode(
"type");
1089 static const XMLCh* s_value = xercesc::XMLString::transcode(
"value");
1090 static const XMLCh* s_unit_accession = xercesc::XMLString::transcode(
"unitAccession");
1091 static const XMLCh* s_id = xercesc::XMLString::transcode(
"id");
1092 static const XMLCh* s_spot_id = xercesc::XMLString::transcode(
"spotID");
1094 static const XMLCh* s_ref = xercesc::XMLString::transcode(
"ref");
1095 static const XMLCh* s_version = xercesc::XMLString::transcode(
"version");
1096 static const XMLCh* s_order = xercesc::XMLString::transcode(
"order");
1097 static const XMLCh* s_location = xercesc::XMLString::transcode(
"location");
1098 static const XMLCh* s_sample_ref = xercesc::XMLString::transcode(
"sampleRef");
1099 static const XMLCh* s_software_ref = xercesc::XMLString::transcode(
"softwareRef");
1100 static const XMLCh* s_source_file_ref = xercesc::XMLString::transcode(
"sourceFileRef");
1101 static const XMLCh* s_default_instrument_configuration_ref = xercesc::XMLString::transcode(
"defaultInstrumentConfigurationRef");
1102 static const XMLCh* s_instrument_configuration_ref = xercesc::XMLString::transcode(
"instrumentConfigurationRef");
1103 static const XMLCh* s_default_data_processing_ref = xercesc::XMLString::transcode(
"defaultDataProcessingRef");
1104 static const XMLCh* s_data_processing_ref = xercesc::XMLString::transcode(
"dataProcessingRef");
1105 static const XMLCh* s_start_time_stamp = xercesc::XMLString::transcode(
"startTimeStamp");
1106 static const XMLCh* s_external_spectrum_id = xercesc::XMLString::transcode(
"externalSpectrumID");
1107 static const XMLCh* s_default_source_file_ref = xercesc::XMLString::transcode(
"defaultSourceFileRef");
1108 static const XMLCh* s_scan_settings_ref = xercesc::XMLString::transcode(
"scanSettingsRef");
1110 String tag = sm_.convert(qname);
1111 open_tags_.push_back(tag);
1115 if (open_tags_.size() > 1)
1116 parent_tag = *(open_tags_.end() - 2);
1117 String parent_parent_tag;
1118 if (open_tags_.size() > 2)
1119 parent_parent_tag = *(open_tags_.end() - 3);
1122 if (tag !=
"spectrum" && skip_spectrum_)
1125 if (tag !=
"chromatogram" && skip_chromatogram_)
1128 if (tag ==
"spectrum")
1132 default_array_length_ = attributeAsInt_(attributes, s_default_array_length);
1135 if (optionalAttributeAsString_(source_file_ref, attributes, s_source_file_ref))
1137 spec_.setSourceFile(source_files_[source_file_ref]);
1140 spec_.setNativeID(attributeAsString_(attributes, s_id));
1143 if (optionalAttributeAsString_(maldi_spot_id, attributes, s_spot_id))
1145 spec_.setMetaValue(
"maldi_spot_id", maldi_spot_id);
1148 String data_processing_ref;
1149 if (optionalAttributeAsString_(data_processing_ref, attributes, s_data_processing_ref))
1151 spec_.setDataProcessing(processing_[data_processing_ref]);
1155 spec_.setDataProcessing(processing_[default_processing_]);
1158 else if (tag ==
"chromatogram")
1161 default_array_length_ = attributeAsInt_(attributes, s_default_array_length);
1163 if (optionalAttributeAsString_(source_file_ref, attributes, s_source_file_ref))
1165 chromatogram_.setSourceFile(source_files_[source_file_ref]);
1168 chromatogram_.setNativeID(attributeAsString_(attributes, s_id));
1170 String data_processing_ref;
1171 if (optionalAttributeAsString_(data_processing_ref, attributes, s_data_processing_ref))
1173 chromatogram_.setDataProcessing(processing_[data_processing_ref]);
1177 chromatogram_.setDataProcessing(processing_[default_processing_]);
1180 else if (tag ==
"spectrumList")
1183 default_processing_ = attributeAsString_(attributes, s_default_data_processing_ref);
1186 if (options_.getMetadataOnly())
1189 UInt count = attributeAsInt_(attributes, s_count);
1190 exp_->reserveSpaceSpectra(count);
1191 logger_.startProgress(0, count,
"loading spectra list");
1192 in_spectrum_list_ =
true;
1194 else if (tag ==
"chromatogramList")
1197 default_processing_ = attributeAsString_(attributes, s_default_data_processing_ref);
1200 if (options_.getMetadataOnly())
1203 UInt count = attributeAsInt_(attributes, s_count);
1204 exp_->reserveSpaceChromatograms(count);
1205 logger_.startProgress(0, count,
"loading chromatogram list");
1206 in_spectrum_list_ =
false;
1208 else if (tag ==
"binaryDataArrayList" )
1210 data_.reserve(attributeAsInt_(attributes, s_count));
1212 else if (tag ==
"binaryDataArray" )
1216 data_.back().compression =
false;
1219 Int array_length = (
Int) default_array_length_;
1220 optionalAttributeAsInt_(array_length, attributes, s_array_length);
1221 data_.back().size = array_length;
1224 String data_processing_ref;
1225 if (optionalAttributeAsString_(data_processing_ref, attributes, s_data_processing_ref))
1227 data_.back().meta.setDataProcessing(processing_[data_processing_ref]);
1230 else if (tag ==
"cvParam")
1233 optionalAttributeAsString_(value, attributes, s_value);
1234 String unit_accession =
"";
1235 optionalAttributeAsString_(unit_accession, attributes, s_unit_accession);
1236 handleCVParam_(parent_parent_tag, parent_tag, attributeAsString_(attributes, s_accession), attributeAsString_(attributes, s_name), value, unit_accession);
1238 else if (tag ==
"userParam")
1241 optionalAttributeAsString_(type, attributes, s_type);
1243 optionalAttributeAsString_(value, attributes, s_value);
1244 handleUserParam_(parent_parent_tag, parent_tag, attributeAsString_(attributes, s_name), type, value);
1246 else if (tag ==
"referenceableParamGroup")
1248 current_id_ = attributeAsString_(attributes, s_id);
1250 else if (tag ==
"sourceFile")
1252 current_id_ = attributeAsString_(attributes, s_id);
1254 String name_of_file = attributeAsString_(attributes, s_name);
1257 String path_to_file = attributeAsString_(attributes, s_location);
1261 if (path_to_file.empty() && !name_of_file.empty())
1265 if (path_to_file ==
".") path_to_file =
"file://./";
1271 if (path_to_file.
hasPrefix(
"file:///.")) path_to_file.
substitute(
"file:///.",
"file://./");
1273 bool is_relative_path = path_to_file.
hasPrefix(
"file://./") || path_to_file.
hasPrefix(
"file://../");
1276 if (!is_relative_path && path_to_file.
hasPrefix(
"file://") && !path_to_file.
hasPrefix(
"file:///"))
1278 warning(LOAD,
"Ill formed absolute or relative sourceFile path: " + path_to_file);
1289 if (!is_relative_path && path_to_file ==
"file:///")
1291 path_to_file =
"file://";
1294 source_files_[current_id_].setNameOfFile(name_of_file);
1295 source_files_[current_id_].setPathToFile(path_to_file);
1297 else if (tag ==
"referenceableParamGroupRef")
1300 String ref = attributeAsString_(attributes, s_ref);
1301 for (
Size i = 0; i < ref_param_[ref].size(); ++i)
1303 handleCVParam_(parent_parent_tag, parent_tag, ref_param_[ref][i].accession, ref_param_[ref][i].name, ref_param_[ref][i].value, ref_param_[ref][i].unit_accession);
1306 else if (tag ==
"scan")
1311 if (optionalAttributeAsString_(source_file_ref, attributes, s_source_file_ref))
1313 tmp.
setMetaValue(
"source_file_name", source_files_[source_file_ref].getNameOfFile());
1314 tmp.
setMetaValue(
"source_file_path", source_files_[source_file_ref].getPathToFile());
1317 String external_spectrum_id;
1318 if (optionalAttributeAsString_(external_spectrum_id, attributes, s_external_spectrum_id))
1326 String instrument_configuration_ref;
1327 if (optionalAttributeAsString_(instrument_configuration_ref, attributes, s_instrument_configuration_ref))
1329 warning(LOAD,
"Unhandled attribute 'instrumentConfigurationRef' in 'scan' tag.");
1332 spec_.getAcquisitionInfo().push_back(tmp);
1334 else if (tag ==
"mzML")
1337 chromatogram_count = 0;
1340 String file_version = attributeAsString_(attributes, s_version);
1347 warning(LOAD,
String(
"Invalid mzML version string '") + file_version +
"'. Assuming mzML version " + version_ +
"!");
1351 if (current_version < mzML_min_version)
1353 fatalError(LOAD,
String(
"Only mzML 1.1.0 or higher is supported! This file has version '") + file_version +
"'.");
1357 warning(LOAD,
"The mzML file version (" + file_version +
") is newer than the parser version (" + version_ +
"). This might lead to undefined behavior.");
1363 if (optionalAttributeAsString_(accession, attributes, s_accession))
1365 exp_->setIdentifier(accession);
1369 if (optionalAttributeAsString_(
id, attributes, s_id))
1371 exp_->setMetaValue(
"mzml_id",
id);
1374 else if (tag ==
"contact")
1378 else if (tag ==
"sample")
1380 current_id_ = attributeAsString_(attributes, s_id);
1382 if (optionalAttributeAsString_(name, attributes, s_name))
1384 samples_[current_id_].setName(name);
1387 else if (tag ==
"run")
1391 if (optionalAttributeAsString_(sample_ref, attributes, s_sample_ref))
1393 exp_->setSample(samples_[sample_ref]);
1396 String instrument_ref = attributeAsString_(attributes, s_default_instrument_configuration_ref);
1397 exp_->setInstrument(instruments_[instrument_ref]);
1400 if (optionalAttributeAsString_(start_time, attributes, s_start_time_stamp))
1402 exp_->setDateTime(asDateTime_(start_time));
1405 String default_source_file_ref;
1406 if (optionalAttributeAsString_(default_source_file_ref, attributes, s_default_source_file_ref))
1408 exp_->getSourceFiles().push_back(source_files_[default_source_file_ref]);
1411 else if (tag ==
"software")
1413 current_id_ = attributeAsString_(attributes, s_id);
1414 software_[current_id_].setVersion(attributeAsString_(attributes, s_version));
1416 else if (tag ==
"dataProcessing")
1418 current_id_ = attributeAsString_(attributes, s_id);
1420 else if (tag ==
"processingMethod")
1427 dp->setSoftware(software_[attributeAsString_(attributes, s_software_ref)]);
1431 LOG_ERROR <<
"Warning: Parsing error, \"processingMethod\" is missing the required attribute \"softwareRef\".\n" <<
1432 "The software tool which generated this mzML should be fixed. Please notify the maintainers." << std::endl;
1434 processing_[current_id_].push_back(dp);
1437 else if (tag ==
"instrumentConfiguration")
1439 current_id_ = attributeAsString_(attributes, s_id);
1442 String scan_settings_ref;
1443 if (optionalAttributeAsString_(scan_settings_ref, attributes, s_scan_settings_ref))
1445 warning(LOAD,
"Unhandled attribute 'scanSettingsRef' in 'instrumentConfiguration' tag.");
1448 else if (tag ==
"softwareRef")
1451 instruments_[current_id_].setSoftware(software_[attributeAsString_(attributes, s_ref)]);
1453 else if (tag ==
"source")
1455 instruments_[current_id_].getIonSources().push_back(
IonSource());
1456 instruments_[current_id_].getIonSources().back().setOrder(attributeAsInt_(attributes, s_order));
1458 else if (tag ==
"analyzer")
1460 instruments_[current_id_].getMassAnalyzers().push_back(
MassAnalyzer());
1461 instruments_[current_id_].getMassAnalyzers().back().setOrder(attributeAsInt_(attributes, s_order));
1463 else if (tag ==
"detector")
1465 instruments_[current_id_].getIonDetectors().push_back(
IonDetector());
1466 instruments_[current_id_].getIonDetectors().back().setOrder(attributeAsInt_(attributes, s_order));
1468 else if (tag ==
"precursor")
1470 if (in_spectrum_list_)
1473 spec_.getPrecursors().push_back(
Precursor());
1477 if (optionalAttributeAsString_(source_file_ref, attributes, s_source_file_ref))
1479 spec_.getPrecursors().back().setMetaValue(
"source_file_name", source_files_[source_file_ref].getNameOfFile());
1480 spec_.getPrecursors().back().setMetaValue(
"source_file_path", source_files_[source_file_ref].getPathToFile());
1483 String external_spectrum_id;
1484 if (optionalAttributeAsString_(external_spectrum_id, attributes, s_external_spectrum_id))
1486 spec_.getPrecursors().back().setMetaValue(
"external_spectrum_id", external_spectrum_id);
1489 selected_ion_count_ = 0;
1493 chromatogram_.setPrecursor(
Precursor());
1496 if (optionalAttributeAsString_(source_file_ref, attributes, s_source_file_ref))
1498 chromatogram_.getPrecursor().setMetaValue(
"source_file_name", source_files_[source_file_ref].getNameOfFile());
1499 chromatogram_.getPrecursor().setMetaValue(
"source_file_path", source_files_[source_file_ref].getPathToFile());
1502 String external_spectrum_id;
1503 if (optionalAttributeAsString_(external_spectrum_id, attributes, s_external_spectrum_id))
1505 chromatogram_.getPrecursor().setMetaValue(
"external_spectrum_id", external_spectrum_id);
1507 selected_ion_count_ = 0;
1510 else if (tag ==
"product")
1513 if (in_spectrum_list_)
1515 spec_.getProducts().push_back(
Product());
1519 chromatogram_.setProduct(
Product());
1522 else if (tag ==
"selectedIon")
1525 ++selected_ion_count_;
1527 else if (tag ==
"selectedIonList")
1530 if (attributeAsInt_(attributes, s_count) > 1)
1532 warning(LOAD,
"OpenMS can currently handle only one selection ion per precursor! Only the first ion is loaded!");
1535 else if (tag ==
"scanWindow")
1537 spec_.getInstrumentSettings().getScanWindows().push_back(
ScanWindow());
1541 template <
typename MapType>
1544 static const XMLCh* s_spectrum = xercesc::XMLString::transcode(
"spectrum");
1545 static const XMLCh* s_chromatogram = xercesc::XMLString::transcode(
"chromatogram");
1546 static const XMLCh* s_spectrum_list = xercesc::XMLString::transcode(
"spectrumList");
1547 static const XMLCh* s_chromatogram_list = xercesc::XMLString::transcode(
"chromatogramList");
1548 static const XMLCh* s_mzml = xercesc::XMLString::transcode(
"mzML");
1550 open_tags_.pop_back();
1552 if (equal_(qname, s_spectrum))
1556 if (!rt_set_ && spec_.metaValueExists(
"elution time (seconds)"))
1558 spec_.setRT(spec_.getMetaValue(
"elution time (seconds)"));
1569 if (!skip_spectrum_)
1572 spectrum_data_.back().default_array_length = default_array_length_;
1573 spectrum_data_.back().spectrum = spec_;
1574 if (options_.getFillData())
1576 spectrum_data_.back().data = data_;
1580 if (spectrum_data_.size() >= options_.getMaxDataPoolSize())
1582 populateSpectraWithData();
1585 skip_spectrum_ =
false;
1587 if (options_.getSizeOnly()) {skip_spectrum_ =
true; }
1588 logger_.setProgress(++scan_count);
1590 default_array_length_ = 0;
1592 else if (equal_(qname, s_chromatogram))
1595 if (!skip_chromatogram_)
1598 chromatogram_data_.back().default_array_length = default_array_length_;
1599 chromatogram_data_.back().chromatogram = chromatogram_;
1600 if (options_.getFillData())
1602 chromatogram_data_.back().data = data_;
1606 if (chromatogram_data_.size() >= options_.getMaxDataPoolSize())
1608 populateChromatogramsWithData();
1611 skip_chromatogram_ =
false;
1612 if (options_.getSizeOnly()) {skip_chromatogram_ =
true; }
1613 logger_.setProgress(++chromatogram_count);
1615 default_array_length_ = 0;
1617 else if (equal_(qname, s_spectrum_list))
1619 in_spectrum_list_ =
false;
1620 logger_.endProgress();
1622 else if (equal_(qname, s_chromatogram_list))
1624 in_spectrum_list_ =
false;
1625 logger_.endProgress();
1627 else if (equal_(qname, s_mzml))
1631 source_files_.clear();
1634 instruments_.clear();
1635 processing_.clear();
1638 populateSpectraWithData();
1639 populateChromatogramsWithData();
1645 template <
typename MapType>
1653 if (!cv_.exists(accession))
1656 if (parent_tag !=
"sample")
1658 warning(LOAD,
String(
"Unknown cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
1669 warning(LOAD,
String(
"Obsolete CV term '") + accession +
" - " + term.
name +
"' used in tag '" + parent_tag +
"'.");
1672 String parsed_name = name;
1675 correct_name.
trim();
1676 if (parsed_name != correct_name)
1678 warning(LOAD,
String(
"Name of CV term not correct: '") + term.
id +
" - " + parsed_name +
"' should be '" + correct_name +
"'");
1682 warning(LOAD,
String(
"Obsolete CV term '") + accession +
" - " + term.
name +
"' used in tag '" + parent_tag +
"'.");
1692 warning(LOAD,
String(
"The CV term '") + accession +
" - " + term.
name +
"' used in tag '" + parent_tag +
"' must not have a value. The value is '" + value +
"'.");
1711 termValue = value.
toInt();
1715 warning(LOAD,
String(
"The CV term '") + accession +
" - " + term.
name +
"' used in tag '" + parent_tag +
"' must have an integer value. The value is '" + value +
"'.");
1728 warning(LOAD,
String(
"The CV term '") + accession +
" - " + term.
name +
"' used in tag '" + parent_tag +
"' must have a floating-point value. The value is '" + value +
"'.");
1742 warning(LOAD,
String(
"The CV term '") + accession +
" - " + term.
name +
"' used in tag '" + parent_tag +
"' must be a valid date. The value is '" + value +
"'.");
1756 warning(LOAD,
String(
"The CV term '") + accession +
" - " + term.
name +
"' used in tag '" + parent_tag +
"' should have a numerical value. The value is '" + value +
"'.");
1761 if (unit_accession !=
"") termValue.
setUnit(unit_accession);
1764 if (parent_tag ==
"run")
1767 if (accession ==
"MS:1000858")
1769 exp_->setFractionIdentifier(value);
1772 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
1775 else if (parent_tag ==
"binaryDataArray")
1779 if (cv_.isChildOf(accession,
"MS:1000513"))
1781 data_.back().meta.setName(cv_.getTerm(accession).name);
1785 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
1790 else if (parent_tag ==
"spectrum")
1793 if (accession ==
"MS:1000294")
1797 else if (accession ==
"MS:1000579")
1801 else if (accession ==
"MS:1000580")
1805 else if (accession ==
"MS:1000581")
1809 else if (accession ==
"MS:1000582")
1813 else if (accession ==
"MS:1000583")
1817 else if (accession ==
"MS:1000804")
1821 else if (accession ==
"MS:1000805")
1825 else if (accession ==
"MS:1000806")
1829 else if (accession ==
"MS:1000325")
1833 else if (accession ==
"MS:1000326")
1837 else if (accession ==
"MS:1000341")
1841 else if (accession ==
"MS:1000789")
1845 else if (accession ==
"MS:1000790")
1850 else if (accession ==
"MS:1000127")
1854 else if (accession ==
"MS:1000128")
1858 else if (accession ==
"MS:1000525")
1863 else if (accession ==
"MS:1000511")
1865 spec_.setMSLevel(value.
toInt());
1867 if (options_.hasMSLevels() && !options_.containsMSLevel(spec_.getMSLevel()))
1869 skip_spectrum_ =
true;
1872 else if (accession ==
"MS:1000497")
1874 spec_.getInstrumentSettings().setZoomScan(
true);
1876 else if (accession ==
"MS:1000285")
1879 spec_.setMetaValue(
"total ion current", termValue);
1881 else if (accession ==
"MS:1000504")
1884 spec_.setMetaValue(
"base peak m/z", termValue);
1886 else if (accession ==
"MS:1000505")
1889 spec_.setMetaValue(
"base peak intensity", termValue);
1891 else if (accession ==
"MS:1000527")
1894 spec_.setMetaValue(
"highest observed m/z", termValue);
1896 else if (accession ==
"MS:1000528")
1899 spec_.setMetaValue(
"lowest observed m/z", termValue);
1901 else if (accession ==
"MS:1000618")
1904 spec_.setMetaValue(
"highest observed wavelength", termValue);
1906 else if (accession ==
"MS:1000619")
1909 spec_.setMetaValue(
"lowest observed wavelength", termValue);
1911 else if (accession ==
"MS:1000796")
1914 spec_.setMetaValue(
"spectrum title", termValue);
1916 else if (accession ==
"MS:1000797")
1919 spec_.setMetaValue(
"peak list scans", termValue);
1921 else if (accession ==
"MS:1000798")
1924 spec_.setMetaValue(
"peak list raw scans", termValue);
1927 else if (accession ==
"MS:1000129")
1931 else if (accession ==
"MS:1000130")
1936 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
1939 else if (parent_tag ==
"scanWindow")
1941 if (accession ==
"MS:1000501")
1943 spec_.getInstrumentSettings().getScanWindows().back().begin = value.
toDouble();
1945 else if (accession ==
"MS:1000500")
1947 spec_.getInstrumentSettings().getScanWindows().back().end = value.
toDouble();
1950 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
1953 else if (parent_tag ==
"referenceableParamGroup")
1960 ref_param_[current_id_].push_back(term);
1963 else if (parent_tag ==
"selectedIon")
1966 if (selected_ion_count_ > 1)
1969 if (accession ==
"MS:1000744")
1972 if (in_spectrum_list_)
1974 spec_.getPrecursors().back().setMZ(value.
toDouble());
1978 chromatogram_.getPrecursor().setMZ(value.
toDouble());
1981 else if (accession ==
"MS:1000041")
1983 if (in_spectrum_list_)
1985 spec_.getPrecursors().back().setCharge(value.
toInt());
1989 chromatogram_.getPrecursor().setCharge(value.
toInt());
1992 else if (accession ==
"MS:1000042")
1994 if (in_spectrum_list_)
1996 spec_.getPrecursors().back().setIntensity(value.
toDouble());
2000 chromatogram_.getPrecursor().setIntensity(value.
toDouble());
2003 else if (accession ==
"MS:1000633")
2005 if (in_spectrum_list_)
2007 spec_.getPrecursors().back().getPossibleChargeStates().push_back(value.
toInt());
2011 chromatogram_.getPrecursor().getPossibleChargeStates().push_back(value.
toInt());
2015 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
2018 else if (parent_tag ==
"activation")
2021 if (in_spectrum_list_)
2023 if (accession ==
"MS:1000245")
2026 spec_.getPrecursors().back().setMetaValue(
"charge stripping",
String(
"true"));
2028 else if (accession ==
"MS:1000045")
2031 spec_.getPrecursors().back().setMetaValue(
"collision energy", termValue);
2033 else if (accession ==
"MS:1000412")
2036 spec_.getPrecursors().back().setMetaValue(
"buffer gas", termValue);
2038 else if (accession ==
"MS:1000419")
2041 spec_.getPrecursors().back().setMetaValue(
"collision gas", termValue);
2043 else if (accession ==
"MS:1000509")
2045 spec_.getPrecursors().back().setActivationEnergy(value.
toDouble());
2047 else if (accession ==
"MS:1000138")
2050 spec_.getPrecursors().back().setMetaValue(
"percent collision energy", termValue);
2052 else if (accession ==
"MS:1000869")
2055 spec_.getPrecursors().back().setMetaValue(
"collision gas pressure", termValue);
2058 else if (accession ==
"MS:1000044")
2062 else if (accession ==
"MS:1000133")
2064 spec_.getPrecursors().back().getActivationMethods().insert(
Precursor::CID);
2066 else if (accession ==
"MS:1000134")
2068 spec_.getPrecursors().back().getActivationMethods().insert(
Precursor::PD);
2070 else if (accession ==
"MS:1000135")
2072 spec_.getPrecursors().back().getActivationMethods().insert(
Precursor::PSD);
2074 else if (accession ==
"MS:1000136")
2076 spec_.getPrecursors().back().getActivationMethods().insert(
Precursor::SID);
2078 else if (accession ==
"MS:1000242")
2080 spec_.getPrecursors().back().getActivationMethods().insert(
Precursor::BIRD);
2082 else if (accession ==
"MS:1000250")
2084 spec_.getPrecursors().back().getActivationMethods().insert(
Precursor::ECD);
2086 else if (accession ==
"MS:1000262")
2088 spec_.getPrecursors().back().getActivationMethods().insert(
Precursor::IMD);
2090 else if (accession ==
"MS:1000282")
2092 spec_.getPrecursors().back().getActivationMethods().insert(
Precursor::SORI);
2094 else if (accession ==
"MS:1000422")
2096 spec_.getPrecursors().back().getActivationMethods().insert(
Precursor::HCID);
2098 else if (accession ==
"MS:1000433")
2100 spec_.getPrecursors().back().getActivationMethods().insert(
Precursor::LCID);
2102 else if (accession ==
"MS:1000435")
2104 spec_.getPrecursors().back().getActivationMethods().insert(
Precursor::PHD);
2106 else if (accession ==
"MS:1000598")
2108 spec_.getPrecursors().back().getActivationMethods().insert(
Precursor::ETD);
2110 else if (accession ==
"MS:1000599")
2112 spec_.getPrecursors().back().getActivationMethods().insert(
Precursor::PQD);
2115 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
2119 if (accession ==
"MS:1000245")
2122 chromatogram_.getPrecursor().setMetaValue(
"charge stripping",
String(
"true"));
2124 else if (accession ==
"MS:1000045")
2127 chromatogram_.getPrecursor().setMetaValue(
"collision energy", termValue);
2129 else if (accession ==
"MS:1000412")
2132 chromatogram_.getPrecursor().setMetaValue(
"buffer gas", termValue);
2134 else if (accession ==
"MS:1000419")
2137 chromatogram_.getPrecursor().setMetaValue(
"collision gas", termValue);
2139 else if (accession ==
"MS:1000509")
2141 chromatogram_.getPrecursor().setActivationEnergy(value.
toDouble());
2143 else if (accession ==
"MS:1000138")
2146 chromatogram_.getPrecursor().setMetaValue(
"percent collision energy", termValue);
2148 else if (accession ==
"MS:1000869")
2151 chromatogram_.getPrecursor().setMetaValue(
"collision gas pressure", termValue);
2154 else if (accession ==
"MS:1000044")
2158 else if (accession ==
"MS:1000133")
2160 chromatogram_.getPrecursor().getActivationMethods().insert(
Precursor::CID);
2162 else if (accession ==
"MS:1000134")
2164 chromatogram_.getPrecursor().getActivationMethods().insert(
Precursor::PD);
2166 else if (accession ==
"MS:1000135")
2168 chromatogram_.getPrecursor().getActivationMethods().insert(
Precursor::PSD);
2170 else if (accession ==
"MS:1000136")
2172 chromatogram_.getPrecursor().getActivationMethods().insert(
Precursor::SID);
2174 else if (accession ==
"MS:1000242")
2176 chromatogram_.getPrecursor().getActivationMethods().insert(
Precursor::BIRD);
2178 else if (accession ==
"MS:1000250")
2180 chromatogram_.getPrecursor().getActivationMethods().insert(
Precursor::ECD);
2182 else if (accession ==
"MS:1000262")
2184 chromatogram_.getPrecursor().getActivationMethods().insert(
Precursor::IMD);
2186 else if (accession ==
"MS:1000282")
2188 chromatogram_.getPrecursor().getActivationMethods().insert(
Precursor::SORI);
2190 else if (accession ==
"MS:1000422")
2192 chromatogram_.getPrecursor().getActivationMethods().insert(
Precursor::HCID);
2194 else if (accession ==
"MS:1000433")
2196 chromatogram_.getPrecursor().getActivationMethods().insert(
Precursor::LCID);
2198 else if (accession ==
"MS:1000435")
2200 chromatogram_.getPrecursor().getActivationMethods().insert(
Precursor::PHD);
2202 else if (accession ==
"MS:1000598")
2204 chromatogram_.getPrecursor().getActivationMethods().insert(
Precursor::ETD);
2206 else if (accession ==
"MS:1000599")
2208 chromatogram_.getPrecursor().getActivationMethods().insert(
Precursor::PQD);
2211 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
2215 else if (parent_tag ==
"isolationWindow")
2217 if (parent_parent_tag ==
"precursor")
2219 if (accession ==
"MS:1000827")
2221 if (in_spectrum_list_)
2223 spec_.getPrecursors().back().setMZ(value.
toDouble());
2227 chromatogram_.getPrecursor().setMZ(value.
toDouble());
2230 else if (accession ==
"MS:1000828")
2232 if (in_spectrum_list_)
2234 spec_.getPrecursors().back().setIsolationWindowLowerOffset(value.
toDouble());
2238 chromatogram_.getPrecursor().setIsolationWindowLowerOffset(value.
toDouble());
2241 else if (accession ==
"MS:1000829")
2243 if (in_spectrum_list_)
2245 spec_.getPrecursors().back().setIsolationWindowUpperOffset(value.
toDouble());
2249 chromatogram_.getPrecursor().setIsolationWindowUpperOffset(value.
toDouble());
2253 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
2255 else if (parent_parent_tag ==
"product")
2257 if (accession ==
"MS:1000827")
2259 if (in_spectrum_list_)
2261 spec_.getProducts().back().setMZ(value.
toDouble());
2265 chromatogram_.getProduct().setMZ(value.
toDouble());
2268 else if (accession ==
"MS:1000829")
2270 if (in_spectrum_list_)
2272 spec_.getProducts().back().setIsolationWindowUpperOffset(value.
toDouble());
2276 chromatogram_.getProduct().setIsolationWindowUpperOffset(value.
toDouble());
2279 else if (accession ==
"MS:1000828")
2281 if (in_spectrum_list_)
2283 spec_.getProducts().back().setIsolationWindowLowerOffset(value.
toDouble());
2287 chromatogram_.getProduct().setIsolationWindowLowerOffset(value.
toDouble());
2291 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
2295 else if (parent_tag ==
"scanList")
2297 if (cv_.isChildOf(accession,
"MS:1000570"))
2299 spec_.getAcquisitionInfo().setMethodOfCombination(cv_.getTerm(accession).name);
2302 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
2305 else if (parent_tag ==
"scan")
2308 if (accession ==
"MS:1000502")
2311 spec_.setMetaValue(
"dwell time", termValue);
2313 else if (accession ==
"MS:1000011")
2316 spec_.setMetaValue(
"mass resolution", termValue);
2318 else if (accession ==
"MS:1000015")
2321 spec_.setMetaValue(
"scan rate", termValue);
2323 else if (accession ==
"MS:1000016")
2325 if (unit_accession ==
"UO:0000031")
2327 spec_.setRT(60.0 * value.
toDouble());
2335 if (options_.hasRTRange() && !options_.getRTRange().encloses(
DPosition<1>(spec_.getRT())))
2337 skip_spectrum_ =
true;
2340 else if (accession ==
"MS:1000826")
2342 if (unit_accession ==
"UO:0000031")
2344 spec_.setMetaValue(
"elution time (seconds)", 60.0 * value.
toDouble());
2348 spec_.setMetaValue(
"elution time (seconds)", value.
toDouble());
2351 else if (accession ==
"MS:1000512")
2354 spec_.setMetaValue(
"filter string", termValue);
2356 else if (accession ==
"MS:1000803")
2359 spec_.setMetaValue(
"analyzer scan offset", termValue);
2361 else if (accession ==
"MS:1000616")
2364 spec_.setMetaValue(
"preset scan configuration", termValue);
2366 else if (accession ==
"MS:1000800")
2369 spec_.setMetaValue(
"mass resolving power", termValue);
2371 else if (accession ==
"MS:1000880")
2374 spec_.setMetaValue(
"interchannel delay", termValue);
2377 else if (accession ==
"MS:1000092")
2380 spec_.setMetaValue(
"scan direction",
String(
"decreasing"));
2382 else if (accession ==
"MS:1000093")
2385 spec_.setMetaValue(
"scan direction",
String(
"increasing"));
2388 else if (accession ==
"MS:1000094")
2391 spec_.setMetaValue(
"scan law",
String(
"exponential"));
2393 else if (accession ==
"MS:1000095")
2396 spec_.setMetaValue(
"scan law",
String(
"linear"));
2398 else if (accession ==
"MS:1000096")
2401 spec_.setMetaValue(
"scan law",
String(
"quadratic"));
2406 spec_.getAcquisitionInfo().back().setMetaValue(accession, termValue);
2410 else if (parent_tag ==
"contact")
2412 if (accession ==
"MS:1000586")
2414 exp_->getContacts().back().setName(value);
2416 else if (accession ==
"MS:1000587")
2418 exp_->getContacts().back().setAddress(value);
2420 else if (accession ==
"MS:1000588")
2422 exp_->getContacts().back().setURL(value);
2424 else if (accession ==
"MS:1000589")
2426 exp_->getContacts().back().setEmail(value);
2428 else if (accession ==
"MS:1000590")
2430 exp_->getContacts().back().setInstitution(value);
2433 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
2436 else if (parent_tag ==
"sourceFile")
2438 if (accession ==
"MS:1000569")
2442 else if (accession ==
"MS:1000568")
2446 else if (cv_.isChildOf(accession,
"MS:1000560"))
2448 source_files_[current_id_].setFileType(cv_.getTerm(accession).name);
2450 else if (cv_.isChildOf(accession,
"MS:1000767"))
2452 source_files_[current_id_].setNativeIDType(cv_.getTerm(accession).name);
2455 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
2458 else if (parent_tag ==
"sample")
2460 if (accession ==
"MS:1000004")
2462 samples_[current_id_].setMass(value.
toDouble());
2464 else if (accession ==
"MS:1000001")
2466 samples_[current_id_].setNumber(value);
2468 else if (accession ==
"MS:1000005")
2470 samples_[current_id_].setVolume(value.
toDouble());
2472 else if (accession ==
"MS:1000006")
2474 samples_[current_id_].setConcentration(value.
toDouble());
2476 else if (accession ==
"MS:1000053")
2479 samples_[current_id_].setMetaValue(
"sample batch", termValue);
2481 else if (accession ==
"MS:1000047")
2485 else if (accession ==
"MS:1000048")
2489 else if (accession ==
"MS:1000049")
2493 else if (accession ==
"MS:1000050")
2497 else if (accession ==
"MS:1000051")
2501 else if (accession ==
"MS:1000052")
2508 samples_[current_id_].setMetaValue(
String(name), termValue);
2513 samples_[current_id_].setMetaValue(
"GO cellular component",
String(name));
2518 samples_[current_id_].setMetaValue(
"brenda source tissue",
String(name));
2521 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
2524 else if (parent_tag ==
"instrumentConfiguration")
2527 if (accession ==
"MS:1000031")
2531 else if (cv_.isChildOf(accession,
"MS:1000031"))
2533 instruments_[current_id_].setName(cv_.getTerm(accession).name);
2536 else if (accession ==
"MS:1000529")
2539 instruments_[current_id_].setMetaValue(
"instrument serial number", termValue);
2541 else if (accession ==
"MS:1000032")
2543 instruments_[current_id_].setCustomizations(value);
2545 else if (accession ==
"MS:1000236")
2548 instruments_[current_id_].setMetaValue(
"transmission", termValue);
2551 else if (accession ==
"MS:1000246")
2555 else if (accession ==
"MS:1000221")
2559 else if (accession ==
"MS:1000275")
2563 else if (accession ==
"MS:1000281")
2567 else if (accession ==
"MS:1000286")
2571 else if (accession ==
"MS:1000300")
2575 else if (accession ==
"MS:1000307")
2579 else if (accession ==
"MS:1000309")
2583 else if (accession ==
"MS:1000310")
2587 else if (accession ==
"MS:1000311")
2591 else if (accession ==
"MS:1000320")
2596 else if (accession ==
"MS:1000304")
2599 instruments_[current_id_].setMetaValue(
"accelerating voltage", termValue);
2601 else if (accession ==
"MS:1000216")
2604 instruments_[current_id_].setMetaValue(
"field-free region",
String(
"true"));
2606 else if (accession ==
"MS:1000308")
2609 instruments_[current_id_].setMetaValue(
"electric field strength", termValue);
2611 else if (accession ==
"MS:1000319")
2614 instruments_[current_id_].setMetaValue(
"space charge effect",
String(
"true"));
2617 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
2619 else if (parent_tag ==
"source")
2622 if (accession ==
"MS:1000055")
2626 else if (accession ==
"MS:1000056")
2628 instruments_[current_id_].getIonSources().back().setInletType(
IonSource::DIRECT);
2630 else if (accession ==
"MS:1000057")
2634 else if (accession ==
"MS:1000058")
2638 else if (accession ==
"MS:1000059")
2642 else if (accession ==
"MS:1000060")
2646 else if (accession ==
"MS:1000061")
2650 else if (accession ==
"MS:1000062")
2654 else if (accession ==
"MS:1000063")
2658 else if (accession ==
"MS:1000064")
2662 else if (accession ==
"MS:1000065")
2666 else if (accession ==
"MS:1000066")
2670 else if (accession ==
"MS:1000067")
2674 else if (accession ==
"MS:1000068")
2676 instruments_[current_id_].getIonSources().back().setInletType(
IonSource::SEPTUM);
2678 else if (accession ==
"MS:1000069")
2682 else if (accession ==
"MS:1000248")
2684 instruments_[current_id_].getIonSources().back().setInletType(
IonSource::BATCH);
2686 else if (accession ==
"MS:1000249")
2690 else if (accession ==
"MS:1000396")
2694 else if (accession ==
"MS:1000485")
2699 else if (accession ==
"MS:1000071")
2701 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::CI);
2703 else if (accession ==
"MS:1000073")
2705 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::ESI);
2707 else if (accession ==
"MS:1000074")
2709 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::FAB);
2711 else if (accession ==
"MS:1000227")
2713 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::MPI);
2715 else if (accession ==
"MS:1000240")
2717 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::API);
2719 else if (accession ==
"MS:1000247")
2721 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::DI);
2723 else if (accession ==
"MS:1000255")
2725 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::FA);
2727 else if (accession ==
"MS:1000258")
2729 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::FII);
2731 else if (accession ==
"MS:1000259")
2733 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::GD_MS);
2735 else if (accession ==
"MS:1000271")
2737 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::NICI);
2739 else if (accession ==
"MS:1000272")
2741 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::NRMS);
2743 else if (accession ==
"MS:1000273")
2745 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::PI);
2747 else if (accession ==
"MS:1000274")
2749 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::PYMS);
2751 else if (accession ==
"MS:1000276")
2753 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::REMPI);
2755 else if (accession ==
"MS:1000380")
2757 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::AI);
2759 else if (accession ==
"MS:1000381")
2761 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::ASI);
2763 else if (accession ==
"MS:1000383")
2765 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::AD);
2767 else if (accession ==
"MS:1000384")
2769 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::AUI);
2771 else if (accession ==
"MS:1000385")
2773 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::CEI);
2775 else if (accession ==
"MS:1000386")
2777 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::CHEMI);
2779 else if (accession ==
"MS:1000388")
2781 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::DISSI);
2783 else if (accession ==
"MS:1000389")
2785 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::EI);
2787 else if (accession ==
"MS:1000395")
2789 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::LSI);
2791 else if (accession ==
"MS:1000399")
2793 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::PEI);
2795 else if (accession ==
"MS:1000400")
2797 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::PD);
2799 else if (accession ==
"MS:1000402")
2801 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::SI);
2803 else if (accession ==
"MS:1000403")
2805 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::SOI);
2807 else if (accession ==
"MS:1000404")
2809 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::SPI);
2811 else if (accession ==
"MS:1000406")
2813 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::SUI);
2815 else if (accession ==
"MS:1000407")
2817 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::TI);
2819 else if (accession ==
"MS:1000408")
2821 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::VI);
2823 else if (accession ==
"MS:1000446")
2825 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::FIB);
2827 else if (accession ==
"MS:1000070")
2829 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::APCI);
2831 else if (accession ==
"MS:1000239")
2833 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::AP_MALDI);
2835 else if (accession ==
"MS:1000382")
2837 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::APPI);
2839 else if (accession ==
"MS:1000075")
2841 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::MALDI);
2843 else if (accession ==
"MS:1000257")
2845 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::FD);
2847 else if (accession ==
"MS:1000387")
2849 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::SILI);
2851 else if (accession ==
"MS:1000393")
2853 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::LD);
2855 else if (accession ==
"MS:1000405")
2857 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::SALDI);
2859 else if (accession ==
"MS:1000397")
2861 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::MESI);
2863 else if (accession ==
"MS:1000398")
2865 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::NESI);
2867 else if (accession ==
"MS:1000278")
2869 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::SELDI);
2871 else if (accession ==
"MS:1000279")
2873 instruments_[current_id_].getIonSources().back().setIonizationMethod(
IonSource::SEND);
2875 else if (accession ==
"MS:1000008")
2880 else if (accession ==
"MS:1000392")
2883 instruments_[current_id_].getIonSources().back().setMetaValue(
"ionization efficiency", termValue);
2885 else if (accession ==
"MS:1000486")
2888 instruments_[current_id_].getIonSources().back().setMetaValue(
"source potential", termValue);
2890 else if (accession ==
"MS:1000875")
2893 instruments_[current_id_].getIonSources().back().setMetaValue(
"declustering potential", termValue);
2895 else if (accession ==
"MS:1000876")
2898 instruments_[current_id_].getIonSources().back().setMetaValue(
"cone voltage", termValue);
2900 else if (accession ==
"MS:1000877")
2903 instruments_[current_id_].getIonSources().back().setMetaValue(
"tube lens", termValue);
2906 else if (accession ==
"MS:1000843")
2909 instruments_[current_id_].getIonSources().back().setMetaValue(
"wavelength", termValue);
2911 else if (accession ==
"MS:1000844")
2914 instruments_[current_id_].getIonSources().back().setMetaValue(
"focus diameter x", termValue);
2916 else if (accession ==
"MS:1000845")
2919 instruments_[current_id_].getIonSources().back().setMetaValue(
"focus diameter y", termValue);
2921 else if (accession ==
"MS:1000846")
2924 instruments_[current_id_].getIonSources().back().setMetaValue(
"pulse energy", termValue);
2926 else if (accession ==
"MS:1000847")
2929 instruments_[current_id_].getIonSources().back().setMetaValue(
"pulse duration", termValue);
2931 else if (accession ==
"MS:1000848")
2934 instruments_[current_id_].getIonSources().back().setMetaValue(
"attenuation", termValue);
2936 else if (accession ==
"MS:1000849")
2939 instruments_[current_id_].getIonSources().back().setMetaValue(
"impact angle", termValue);
2942 else if (accession ==
"MS:1000850")
2945 instruments_[current_id_].getIonSources().back().setMetaValue(
"laser type",
"gas laser");
2947 else if (accession ==
"MS:1000851")
2950 instruments_[current_id_].getIonSources().back().setMetaValue(
"laser type",
"solid-state laser");
2952 else if (accession ==
"MS:1000852")
2955 instruments_[current_id_].getIonSources().back().setMetaValue(
"laser type",
"dye-laser");
2957 else if (accession ==
"MS:1000853")
2960 instruments_[current_id_].getIonSources().back().setMetaValue(
"laser type",
"free electron laser");
2963 else if (accession ==
"MS:1000834")
2966 instruments_[current_id_].getIonSources().back().setMetaValue(
"matrix solution", termValue);
2968 else if (accession ==
"MS:1000835")
2971 instruments_[current_id_].getIonSources().back().setMetaValue(
"matrix solution concentration", termValue);
2974 else if (accession ==
"MS:1000836")
2977 instruments_[current_id_].getIonSources().back().setMetaValue(
"matrix application type",
"dried dropplet");
2979 else if (accession ==
"MS:1000837")
2982 instruments_[current_id_].getIonSources().back().setMetaValue(
"matrix application type",
"printed");
2984 else if (accession ==
"MS:1000838")
2987 instruments_[current_id_].getIonSources().back().setMetaValue(
"matrix application type",
"sprayed");
2989 else if (accession ==
"MS:1000839")
2992 instruments_[current_id_].getIonSources().back().setMetaValue(
"matrix application type",
" precoated plate");
2995 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
2997 else if (parent_tag ==
"analyzer")
3000 if (accession ==
"MS:1000079")
3004 else if (accession ==
"MS:1000080")
3008 else if (accession ==
"MS:1000081")
3012 else if (accession ==
"MS:1000084")
3016 else if (accession ==
"MS:1000254")
3020 else if (accession ==
"MS:1000264")
3022 instruments_[current_id_].getMassAnalyzers().back().setType(
MassAnalyzer::IT);
3024 else if (accession ==
"MS:1000284")
3028 else if (accession ==
"MS:1000288")
3032 else if (accession ==
"MS:1000484")
3036 else if (accession ==
"MS:1000078")
3040 else if (accession ==
"MS:1000082")
3044 else if (accession ==
"MS:1000083")
3048 else if (accession ==
"MS:1000291")
3052 else if (accession ==
"MS:1000443")
3057 else if (accession ==
"MS:1000014")
3059 instruments_[current_id_].getMassAnalyzers().back().setAccuracy(value.
toDouble());
3061 else if (accession ==
"MS:1000022")
3063 instruments_[current_id_].getMassAnalyzers().back().setTOFTotalPathLength(value.
toDouble());
3065 else if (accession ==
"MS:1000024")
3067 instruments_[current_id_].getMassAnalyzers().back().setFinalMSExponent(value.
toInt());
3069 else if (accession ==
"MS:1000025")
3071 instruments_[current_id_].getMassAnalyzers().back().setMagneticFieldStrength(value.
toDouble());
3073 else if (accession ==
"MS:1000105")
3075 instruments_[current_id_].getMassAnalyzers().back().setReflectronState(
MassAnalyzer::OFF);
3077 else if (accession ==
"MS:1000106")
3079 instruments_[current_id_].getMassAnalyzers().back().setReflectronState(
MassAnalyzer::ON);
3082 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
3084 else if (parent_tag ==
"detector")
3087 if (accession ==
"MS:1000107")
3091 else if (accession ==
"MS:1000110")
3095 else if (accession ==
"MS:1000112")
3099 else if (accession ==
"MS:1000114")
3103 else if (accession ==
"MS:1000115")
3107 else if (accession ==
"MS:1000116")
3111 else if (accession ==
"MS:1000253")
3115 else if (accession ==
"MS:1000345")
3119 else if (accession ==
"MS:1000346")
3123 else if (accession ==
"MS:1000347")
3127 else if (accession ==
"MS:1000348")
3131 else if (accession ==
"MS:1000349")
3135 else if (accession ==
"MS:1000350")
3139 else if (accession ==
"MS:1000351")
3143 else if (accession ==
"MS:1000621")
3147 else if (accession ==
"MS:1000624")
3151 else if (accession ==
"MS:1000108")
3155 else if (accession ==
"MS:1000109")
3159 else if (accession ==
"MS:1000111")
3163 else if (accession ==
"MS:1000113")
3167 else if (accession ==
"MS:1000026")
3172 else if (accession ==
"MS:1000028")
3174 instruments_[current_id_].getIonDetectors().back().setResolution(value.
toDouble());
3176 else if (accession ==
"MS:1000029")
3178 instruments_[current_id_].getIonDetectors().back().setADCSamplingFrequency(value.
toDouble());
3181 else if (accession ==
"MS:1000117")
3183 instruments_[current_id_].getIonDetectors().back().setAcquisitionMode(
IonDetector::ADC);
3185 else if (accession ==
"MS:1000118")
3189 else if (accession ==
"MS:1000119")
3191 instruments_[current_id_].getIonDetectors().back().setAcquisitionMode(
IonDetector::TDC);
3193 else if (accession ==
"MS:1000120")
3198 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
3200 else if (parent_tag ==
"processingMethod")
3203 if (accession ==
"MS:1000629")
3205 processing_[current_id_].back()->setMetaValue(
"low_intensity_threshold", termValue);
3207 else if (accession ==
"MS:1000631")
3209 processing_[current_id_].back()->setMetaValue(
"high_intensity_threshold", termValue);
3211 else if (accession ==
"MS:1000787")
3213 processing_[current_id_].back()->setMetaValue(
"inclusive_low_intensity_threshold", termValue);
3215 else if (accession ==
"MS:1000788")
3217 processing_[current_id_].back()->setMetaValue(
"inclusive_high_intensity_threshold", termValue);
3219 else if (accession ==
"MS:1000747")
3221 processing_[current_id_].back()->setCompletionTime(asDateTime_(value));
3224 else if (accession ==
"MS:1000530")
3228 else if (accession ==
"MS:1000544")
3232 else if (accession ==
"MS:1000545")
3236 else if (accession ==
"MS:1000546")
3240 else if (accession ==
"MS:1000741")
3245 else if (accession ==
"MS:1000543")
3249 else if (accession ==
"MS:1000033")
3253 else if (accession ==
"MS:1000034")
3257 else if (accession ==
"MS:1000035" || cv_.isChildOf(accession,
"MS:1000035"))
3261 else if (accession ==
"MS:1000592" || cv_.isChildOf(accession,
"MS:1000592"))
3265 else if (accession ==
"MS:1000778" || cv_.isChildOf(accession,
"MS:1000778"))
3269 else if (accession ==
"MS:1000780" || cv_.isChildOf(accession,
"MS:1000780"))
3273 else if (accession ==
"MS:1000593")
3277 else if (accession ==
"MS:1000745")
3281 else if (accession ==
"MS:1001484")
3285 else if (accession ==
"MS:1001485")
3289 else if (accession ==
"MS:1001486" || cv_.isChildOf(accession,
"MS:1001486"))
3294 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
3296 else if (parent_tag ==
"fileContent")
3298 if (cv_.isChildOf(accession,
"MS:1000524"))
3303 else if (cv_.isChildOf(accession,
"MS:1000525"))
3309 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
3311 else if (parent_tag ==
"software")
3313 if (cv_.isChildOf(accession,
"MS:1000531"))
3315 if (accession ==
"MS:1000799")
3317 software_[current_id_].setName(value);
3321 software_[current_id_].setName(name);
3326 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
3330 else if (parent_tag ==
"chromatogram")
3332 if (accession ==
"MS:1000810")
3336 else if (accession ==
"MS:1000235")
3340 else if (accession ==
"MS:1000627")
3344 else if (accession ==
"MS:1000628")
3348 else if (accession ==
"MS:1001472")
3352 else if (accession ==
"MS:1001473")
3356 else if (accession ==
"MS:1001474")
3360 else if (accession ==
"MS:1000811")
3364 else if (accession ==
"MS:1000812")
3368 else if (accession ==
"MS:1000813")
3372 else if (accession ==
"MS:1000809")
3374 chromatogram_.setName(value);
3377 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
3379 else if (parent_tag ==
"target")
3384 warning(LOAD,
String(
"Unhandled cvParam '") + accession +
"' in tag '" + parent_tag +
"'.");
3387 template <
typename MapType>
3393 if (type ==
"xsd:double" || type ==
"xsd:float")
3398 else if (type ==
"xsd:byte" || type ==
"xsd:decimal" || type ==
"xsd:int" || type ==
"xsd:integer" || type ==
"xsd:long" || type ==
"xsd:negativeInteger" || type ==
"xsd:nonNegativeInteger" || type ==
"xsd:nonPositiveInteger" || type ==
"xsd:positiveInteger" || type ==
"xsd:short" || type ==
"xsd:unsignedByte" || type ==
"xsd:unsignedInt" || type ==
"xsd:unsignedLong" || type ==
"xsd:unsignedShort")
3409 if (parent_tag ==
"run")
3411 exp_->setMetaValue(name, data_value);
3413 else if (parent_tag ==
"instrumentConfiguration")
3415 instruments_[current_id_].setMetaValue(name, data_value);
3417 else if (parent_tag ==
"source")
3419 instruments_[current_id_].getIonSources().back().setMetaValue(name, data_value);
3421 else if (parent_tag ==
"analyzer")
3423 instruments_[current_id_].getMassAnalyzers().back().setMetaValue(name, data_value);
3425 else if (parent_tag ==
"detector")
3427 instruments_[current_id_].getIonDetectors().back().setMetaValue(name, data_value);
3429 else if (parent_tag ==
"sample")
3431 samples_[current_id_].setMetaValue(name, data_value);
3433 else if (parent_tag ==
"software")
3435 software_[current_id_].setMetaValue(name, data_value);
3437 else if (parent_tag ==
"contact")
3439 exp_->getContacts().back().setMetaValue(name, data_value);
3441 else if (parent_tag ==
"sourceFile")
3443 source_files_[current_id_].setMetaValue(name, data_value);
3445 else if (parent_tag ==
"binaryDataArray")
3447 data_.back().meta.setMetaValue(name, data_value);
3449 else if (parent_tag ==
"spectrum")
3451 spec_.setMetaValue(name, data_value);
3453 else if (parent_tag ==
"chromatogram")
3455 chromatogram_.setMetaValue(name, data_value);
3457 else if (parent_tag ==
"scanList")
3459 spec_.getAcquisitionInfo().setMetaValue(name, data_value);
3461 else if (parent_tag ==
"scan")
3463 spec_.getAcquisitionInfo().back().setMetaValue(name, data_value);
3465 else if (parent_tag ==
"scanWindow")
3467 spec_.getInstrumentSettings().getScanWindows().back().setMetaValue(name, data_value);
3469 else if (parent_tag ==
"isolationWindow")
3472 if (parent_parent_tag ==
"precursor")
3474 if (in_spectrum_list_)
3476 spec_.getPrecursors().back().setMetaValue(name, data_value);
3480 chromatogram_.getPrecursor().setMetaValue(name, data_value);
3483 else if (parent_parent_tag ==
"product")
3485 if (in_spectrum_list_)
3487 spec_.getProducts().back().setMetaValue(name, data_value);
3491 chromatogram_.getProduct().setMetaValue(name, data_value);
3495 else if (parent_tag ==
"selectedIon")
3498 if (selected_ion_count_ > 1)
3502 if (in_spectrum_list_)
3504 spec_.getPrecursors().back().setMetaValue(name, data_value);
3508 chromatogram_.getPrecursor().setMetaValue(name, data_value);
3511 else if (parent_tag ==
"activation")
3514 if (in_spectrum_list_)
3516 spec_.getPrecursors().back().setMetaValue(name, data_value);
3520 chromatogram_.getPrecursor().setMetaValue(name, data_value);
3523 else if (parent_tag ==
"processingMethod")
3525 processing_[current_id_].back()->setMetaValue(name, data_value);
3527 else if (parent_tag ==
"fileContent")
3532 warning(LOAD,
String(
"Unhandled userParam '") + name +
"' in tag '" + parent_tag +
"'.");
3535 template <
typename MapType>
3545 return validator.SemanticValidator::locateTerm(path, sc);
3548 template <
typename MapType>
3551 String cvTerm =
"<cvParam cvRef=\"" + c.
id.
prefix(
':') +
"\" accession=\"" + c.
id +
"\" name=\"" + c.
name;
3554 cvTerm +=
"\" value=\"" + writeXMLEscape(metaValue.
toString());
3559 cvTerm +=
"\" unitAccession=\"" + unit.
id +
"\" unitName=\"" + unit.
name +
"\" unitCvRef=\"" + unit.
id.
prefix(2);
3566 template <
typename MapType>
3569 std::vector<String> cvParams;
3570 std::vector<String> userParams;
3572 std::vector<String> keys;
3575 for (std::vector<String>::iterator key = keys.begin(); key != keys.end(); ++key)
3580 if (*key ==
"GO cellular component" || *key ==
"brenda source tissue")
3585 if (cv_.hasTermWithName((
String) metaValue))
3596 bool writtenAsCVTerm =
false;
3597 if (cv_.hasTermWithName(*key))
3600 if (validateCV_(c, path, validator))
3603 cvParams.push_back(writeCV_(c, meta.
getMetaValue(*key)));
3604 writtenAsCVTerm =
true;
3609 if (!writtenAsCVTerm)
3611 String userParam =
"<userParam name=\"" + *key +
"\" type=\"";
3617 userParam +=
"xsd:integer";
3621 userParam +=
"xsd:double";
3625 userParam +=
"xsd:string";
3627 userParam +=
"\" value=\"" + writeXMLEscape(d.
toString()) +
"\"/>" +
"\n";
3628 userParams.push_back(userParam);
3634 for (std::vector<String>::iterator term = cvParams.begin(); term != cvParams.end(); ++term)
3636 os <<
String(indent,
'\t') << *term;
3639 for (std::vector<String>::iterator term = userParams.begin(); term != userParams.end(); ++term)
3641 os <<
String(indent,
'\t') << *term;
3645 template <
typename MapType>
3648 std::set<String> terms;
3649 cv_.getAllChildTerms(terms, parent_accession);
3650 for (std::set<String>::const_iterator it = terms.begin(); it != terms.end(); ++it)
3652 if (cv_.getTerm(*it).name == name)
3654 return cv_.getTerm(*it);
3660 template <
typename MapType>
3663 os <<
"\t\t<software id=\"" <<
id <<
"\" version=\"" << software.
getVersion() <<
"\" >\n";
3665 if (so_term.
id ==
"")
3667 so_term = getChildWithName_(
"MS:1000531", software.
getName() +
" software");
3669 if (so_term.
id ==
"")
3671 so_term = getChildWithName_(
"MS:1000531",
"TOPP " + software.
getName());
3673 if (so_term.
id ==
"MS:1000799")
3675 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000799\" name=\"custom unreleased software tool\" value=\"\" />\n";
3677 else if (so_term.
id !=
"")
3679 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"" << so_term.
id <<
"\" name=\"" << writeXMLEscape(so_term.
name) <<
"\" />\n";
3683 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000799\" name=\"custom unreleased software tool\" value=\"" << writeXMLEscape(software.
getName()) <<
"\" />\n";
3685 writeUserParam_(os, software, 3,
"/mzML/Software/cvParam/@accession", validator);
3686 os <<
"\t\t</software>\n";
3689 template <
typename MapType>
3692 os <<
"\t\t\t<sourceFile id=\"" <<
id <<
"\" name=\"" << writeXMLEscape(source_file.
getNameOfFile()) <<
"\" location=\"" << writeXMLEscape(source_file.
getPathToFile()) <<
"\">\n";
3696 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000569\" name=\"SHA-1\" value=\"" << source_file.
getChecksum() <<
"\" />\n";
3700 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000568\" name=\"MD5\" value=\"" << source_file.
getChecksum() <<
"\" />\n";
3704 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000569\" name=\"SHA-1\" value=\"\" />\n";
3710 ft_term = getChildWithName_(
"MS:1000560", source_file.
getFileType().
chop(4) +
"format");
3712 if (ft_term.
id !=
"")
3714 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"" << ft_term.
id <<
"\" name=\"" << ft_term.
name <<
"\" />\n";
3718 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000564\" name=\"PSI mzData format\" />\n";
3722 if (id_term.
id !=
"")
3724 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"" << id_term.
id <<
"\" name=\"" << id_term.
name <<
"\" />\n";
3728 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000777\" name=\"spectrum identifier nativeID format\" />\n";
3730 writeUserParam_(os, source_file, 4,
"/mzML/fileDescription/sourceFileList/sourceFile/cvParam/@accession", validator);
3731 os <<
"\t\t\t</sourceFile>\n";
3734 template <
typename MapType>
3737 os <<
"\t\t<dataProcessing id=\"" <<
id <<
"\">\n";
3742 os <<
"\t\t\t<processingMethod order=\"0\" softwareRef=\"so_default\">\n";
3743 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000544\" name=\"Conversion to mzML\" />\n";
3744 os <<
"\t\t\t\t<userParam name=\"warning\" type=\"xsd:string\" value=\"fictional processing method used to fulfill format requirements\" />\n";
3745 os <<
"\t\t\t</processingMethod>\n";
3748 bool written =
false;
3749 for (
Size i = 0; i < dps.size(); ++i)
3752 os <<
"\t\t\t<processingMethod order=\"0\" softwareRef=\"so_" <<
id <<
"_pm_" << i <<
"\">\n";
3755 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000543\" name=\"data processing action\" />\n";
3760 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000034\" name=\"charge deconvolution\" />\n";
3765 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000033\" name=\"deisotoping\" />\n";
3770 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000592\" name=\"smoothing\" />\n";
3775 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000778\" name=\"charge state calculation\" />\n";
3780 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000780\" name=\"precursor recalculation\" />\n";
3785 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000593\" name=\"baseline reduction\" />\n";
3790 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000035\" name=\"peak picking\" />\n";
3795 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000745\" name=\"retention time alignment\" />\n";
3800 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1001485\" name=\"m/z calibration\" />\n";
3805 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1001484\" name=\"intensity normalization\" />\n";
3810 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1001486\" name=\"data filtering\" />\n";
3816 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000530\" name=\"file format conversion\" />\n";
3821 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000546\" name=\"Conversion to mzData\" />\n";
3826 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000544\" name=\"Conversion to mzML\" />\n";
3831 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000545\" name=\"Conversion to mzXML\" />\n";
3836 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000741\" name=\"Conversion to dta\" />\n";
3841 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000543\" name=\"data processing action\" />\n";
3845 if (dps[i]->getCompletionTime().isValid())
3847 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000747\" name=\"completion time\" value=\"" << dps[i]->getCompletionTime().toString(
"yyyy-MM-dd+hh:mm").toStdString() <<
"\" />\n";
3850 writeUserParam_(os, *(dps[i].
get()), 4,
"/mzML/dataProcessingList/dataProcessing/processingMethod/cvParam/@accession", validator);
3851 os <<
"\t\t\t</processingMethod>\n";
3854 os <<
"\t\t</dataProcessing>\n";
3857 template <
typename MapType>
3860 os <<
"\t\t\t\t\t<precursor>\n";
3864 os <<
"\t\t\t\t\t\t<isolationWindow>\n";
3865 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000827\" name=\"isolation window target m/z\" value=\"" << precursor.
getMZ() <<
"\" unitAccession=\"MS:1000040\" unitName=\"m/z\" unitCvRef=\"MS\" />\n";
3866 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000828\" name=\"isolation window lower offset\" value=\"" << precursor.
getIsolationWindowLowerOffset() <<
"\" unitAccession=\"MS:1000040\" unitName=\"m/z\" unitCvRef=\"MS\" />\n";
3867 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000829\" name=\"isolation window upper offset\" value=\"" << precursor.
getIsolationWindowUpperOffset() <<
"\" unitAccession=\"MS:1000040\" unitName=\"m/z\" unitCvRef=\"MS\" />\n";
3868 os <<
"\t\t\t\t\t\t</isolationWindow>\n";
3874 os <<
"\t\t\t\t\t\t<selectedIonList count=\"1\">\n";
3875 os <<
"\t\t\t\t\t\t\t<selectedIon>\n";
3876 os <<
"\t\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000744\" name=\"selected ion m/z\" value=\"" << precursor.
getMZ() <<
"\" unitAccession=\"MS:1000040\" unitName=\"m/z\" unitCvRef=\"MS\" />\n";
3877 os <<
"\t\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000041\" name=\"charge state\" value=\"" << precursor.
getCharge() <<
"\" />\n";
3878 os <<
"\t\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000042\" name=\"peak intensity\" value=\"" << precursor.
getIntensity() <<
"\" unitAccession=\"MS:1000132\" unitName=\"percent of base peak\" unitCvRef=\"MS\" />\n";
3881 os <<
"\t\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000633\" name=\"possible charge state\" value=\"" << precursor.
getPossibleChargeStates()[j] <<
"\" />\n";
3884 os <<
"\t\t\t\t\t\t\t</selectedIon>\n";
3885 os <<
"\t\t\t\t\t\t</selectedIonList>\n";
3890 os <<
"\t\t\t\t\t\t<activation>\n";
3891 #pragma clang diagnostic push
3892 #pragma clang diagnostic ignored "-Wfloat-equal"
3894 #pragma clang diagnostic pop
3896 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000509\" name=\"activation energy\" value=\"" << precursor.
getActivationEnergy() <<
"\" unitAccession=\"UO:0000266\" unitName=\"electronvolt\" unitCvRef=\"UO\" />\n";
3900 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000133\" name=\"collision-induced dissociation\" />\n";
3904 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000134\" name=\"plasma desorption\" />\n";
3908 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000135\" name=\"post-source decay\" />\n";
3912 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000136\" name=\"surface-induced dissociation\" />\n";
3916 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000242\" name=\"blackbody infrared radiative dissociation\" />\n";
3920 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000250\" name=\"electron capture dissociation\" />\n";
3924 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000262\" name=\"infrared multiphoton dissociation\" />\n";
3928 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000282\" name=\"sustained off-resonance irradiation\" />\n";
3932 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000422\" name=\"high-energy collision-induced dissociation\" />\n";
3936 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000433\" name=\"low-energy collision-induced dissociation\" />\n";
3940 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000435\" name=\"photodissociation\" />\n";
3944 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000598\" name=\"electron transfer dissociation\" />\n";
3948 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000599\" name=\"pulsed q dissociation\" />\n";
3952 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000044\" name=\"dissociation method\" />\n";
3955 writeUserParam_(os, precursor, 6,
"/mzML/run/spectrumList/spectrum/precursorList/precursor/activation/cvParam/@accession", validator);
3956 os <<
"\t\t\t\t\t\t</activation>\n";
3957 os <<
"\t\t\t\t\t</precursor>\n";
3961 template <
typename MapType>
3964 os <<
"\t\t\t\t\t<product>\n";
3965 os <<
"\t\t\t\t\t\t<isolationWindow>\n";
3966 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000827\" name=\"isolation window target m/z\" value=\"" << product.
getMZ() <<
"\" unitAccession=\"MS:1000040\" unitName=\"m/z\" unitCvRef=\"MS\" />\n";
3967 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000828\" name=\"isolation window lower offset\" value=\"" << product.
getIsolationWindowLowerOffset() <<
"\" unitAccession=\"MS:1000040\" unitName=\"m/z\" unitCvRef=\"MS\" />\n";
3968 os <<
"\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000829\" name=\"isolation window upper offset\" value=\"" << product.
getIsolationWindowUpperOffset() <<
"\" unitAccession=\"MS:1000040\" unitName=\"m/z\" unitCvRef=\"MS\" />\n";
3969 writeUserParam_(os, product, 7,
"/mzML/run/spectrumList/spectrum/productList/product/isolationWindow/cvParam/@accession", validator);
3970 os <<
"\t\t\t\t\t\t</isolationWindow>\n";
3971 os <<
"\t\t\t\t\t</product>\n";
3974 template <
typename MapType>
3977 const MapType& exp = *(cexp_);
3978 logger_.startProgress(0, exp.size() + exp.getChromatograms().size(),
"storing mzML file");
3982 std::vector<std::vector< ConstDataProcessingPtr > > dps;
3986 writeHeader_(os, exp, dps, validator);
3991 if (exp.size() != 0)
3997 os <<
"\t\t<spectrumList count=\"" << exp.size() <<
"\" defaultDataProcessingRef=\"dp_sp_0\">\n";
4000 bool renew_native_ids =
false;
4001 for (
Size s = 0; s < exp.size(); ++s)
4003 if (!exp[s].getNativeID().has(
'='))
4005 renew_native_ids =
true;
4010 if (renew_native_ids)
4012 warning(STORE,
String(
"Invalid native IDs detected. Using spectrum identifier nativeID format (spectrum=xsd:nonNegativeInteger) for all spectra."));
4016 for (
Size s = 0; s < exp.size(); ++s)
4018 logger_.setProgress(progress++);
4020 writeSpectrum_(os, spec, s, validator, renew_native_ids, dps);
4022 os <<
"\t\t</spectrumList>\n";
4028 if (!exp.getChromatograms().empty())
4034 os <<
"\t\t<chromatogramList count=\"" << exp.getChromatograms().size() <<
"\" defaultDataProcessingRef=\"dp_sp_0\">\n";
4035 for (
Size c = 0;
c != exp.getChromatograms().size(); ++
c)
4037 logger_.setProgress(progress++);
4039 writeChromatogram_(os, chromatogram,
c, validator);
4041 os <<
"\t\t</chromatogramList>" <<
"\n";
4045 logger_.endProgress();
4048 template <
typename MapType>
4052 os <<
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
4054 if (options_.getWriteIndex())
4056 os <<
"<indexedmzML xmlns=\"http://psi.hupo.org/ms/mzml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.0_idx.xsd\">\n";
4058 os <<
"<mzML xmlns=\"http://psi.hupo.org/ms/mzml\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.0.xsd\" accession=\"" << writeXMLEscape(exp.getIdentifier()) <<
"\" version=\"" << version_ <<
"\">\n";
4062 os <<
"\t<cvList count=\"5\">\n"
4063 <<
"\t\t<cv id=\"MS\" fullName=\"Proteomics Standards Initiative Mass Spectrometry Ontology\" URI=\"http://psidev.cvs.sourceforge.net/*checkout*/psidev/psi/psi-ms/mzML/controlledVocabulary/psi-ms.obo\"/>\n"
4064 <<
"\t\t<cv id=\"UO\" fullName=\"Unit Ontology\" URI=\"http://obo.cvs.sourceforge.net/obo/obo/ontology/phenotype/unit.obo\"/>\n"
4065 <<
"\t\t<cv id=\"BTO\" fullName=\"BrendaTissue545\" version=\"unknown\" URI=\"http://www.brenda-enzymes.info/ontology/tissue/tree/update/update_files/BrendaTissueOBO\"/>\n"
4066 <<
"\t\t<cv id=\"GO\" fullName=\"Gene Ontology - Slim Versions\" version=\"unknown\" URI=\"http://www.geneontology.org/GO_slims/goslim_goa.obo\"/>\n"
4067 <<
"\t\t<cv id=\"PATO\" fullName=\"Quality ontology\" version=\"unknown\" URI=\"http://obo.cvs.sourceforge.net/*checkout*/obo/obo/ontology/phenotype/quality.obo\"/>\n"
4072 os <<
"\t<fileDescription>\n";
4073 os <<
"\t\t<fileContent>\n";
4075 for (
Size i = 0; i < exp.size(); ++i)
4077 ++file_content[exp[i].getInstrumentSettings().getScanMode()];
4081 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000294\" name=\"mass spectrum\" />\n";
4085 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000579\" name=\"MS1 spectrum\" />\n";
4089 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000580\" name=\"MSn spectrum\" />\n";
4093 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000582\" name=\"SIM spectrum\" />\n";
4097 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000583\" name=\"SRM spectrum\" />\n";
4101 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000581\" name=\"CRM spectrum\" />\n";
4105 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000341\" name=\"precursor ion spectrum\" />\n";
4109 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000325\" name=\"constant neutral gain spectrum\" />\n";
4113 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000326\" name=\"constant neutral loss spectrum\" />\n";
4117 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000804\" name=\"electromagnetic radiation spectrum\" />\n";
4121 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000805\" name=\"emission spectrum\" />\n";
4125 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000806\" name=\"absorption spectrum\" />\n";
4129 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000789\" name=\"enhanced multiply charged spectrum\" />\n";
4133 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000789\" name=\"time-delayed fragmentation spectrum\" />\n";
4137 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000294\" name=\"mass spectrum\" />\n";
4140 os <<
"\t\t</fileContent>\n";
4146 UInt sf_sp_count = 0;
4147 for (
Size i = 0; i < exp.size(); ++i)
4154 if (exp.getSourceFiles().size() > 0 || sf_sp_count > 0)
4156 os <<
"\t\t<sourceFileList count=\"" << exp.getSourceFiles().size() + sf_sp_count <<
"\">\n";
4159 for (
Size i = 0; i < exp.getSourceFiles().size(); ++i)
4161 writeSourceFile_(os,
String(
"sf_ru_") +
String(i), exp.getSourceFiles()[i], validator);
4165 if (sf_sp_count > 0)
4168 for (
Size i = 0; i < exp.size(); ++i)
4170 if (exp[i].getSourceFile() != sf_default)
4172 writeSourceFile_(os,
String(
"sf_sp_") + i, exp[i].getSourceFile(), validator);
4177 os <<
"\t\t</sourceFileList>\n";
4183 for (
Size i = 0; i < exp.getContacts().size(); ++i)
4186 os <<
"\t\t<contact>\n";
4187 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000586\" name=\"contact name\" value=\"" << writeXMLEscape(cp.
getLastName()) <<
", " << writeXMLEscape(cp.
getFirstName()) <<
"\" />\n";
4188 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000590\" name=\"contact affiliation\" value=\"" << writeXMLEscape(cp.
getInstitution()) <<
"\" />\n";
4192 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000587\" name=\"contact address\" value=\"" << writeXMLEscape(cp.
getAddress()) <<
"\" />\n";
4196 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000588\" name=\"contact URL\" value=\"" << writeXMLEscape(cp.
getURL()) <<
"\" />\n";
4200 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000589\" name=\"contact email\" value=\"" << writeXMLEscape(cp.
getEmail()) <<
"\" />\n";
4204 os <<
"\t\t\t<userParam name=\"contact_info\" type=\"xsd:string\" value=\"" << writeXMLEscape(cp.
getContactInfo()) <<
"\" />\n";
4206 writeUserParam_(os, cp, 3,
"/mzML/fileDescription/contact/cvParam/@accession", validator);
4207 os <<
"\t\t</contact>\n";
4209 os <<
"\t</fileDescription>\n";
4214 const Sample& sa = exp.getSample();
4215 os <<
"\t<sampleList count=\"1\">\n";
4216 os <<
"\t\t<sample id=\"sa_0\" name=\"" << writeXMLEscape(sa.
getName()) <<
"\">\n";
4219 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000001\" name=\"sample number\" value=\"" << writeXMLEscape(sa.
getNumber()) <<
"\" />\n";
4221 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000004\" name=\"sample mass\" value=\"" << sa.
getMass() <<
"\" unitAccession=\"UO:0000021\" unitName=\"gram\" unitCvRef=\"UO\" />\n";
4222 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000005\" name=\"sample volume\" value=\"" << sa.
getVolume() <<
"\" unitAccession=\"UO:0000098\" unitName=\"milliliter\" unitCvRef=\"UO\" />\n";
4223 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000006\" name=\"sample concentration\" value=\"" << sa.
getConcentration() <<
"\" unitAccession=\"UO:0000175\" unitName=\"gram per liter\" unitCvRef=\"UO\" />\n";
4226 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000047\" name=\"emulsion\" />\n";
4230 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000048\" name=\"gas\" />\n";
4234 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000049\" name=\"liquid\" />\n";
4238 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000050\" name=\"solid\" />\n";
4242 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000051\" name=\"solution\" />\n";
4246 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000052\" name=\"suspension\" />\n";
4250 os <<
"\t\t\t<userParam name=\"comment\" type=\"xsd:string\" value=\"" << writeXMLEscape(sa.
getComment()) <<
"\" />\n";
4252 writeUserParam_(os, sa, 3,
"/mzML/sampleList/sample/cvParam/@accession", validator);
4253 os <<
"\t\t</sample>\n";
4254 os <<
"\t</sampleList>\n";
4261 Size num_software(2);
4266 for (
Size s = 0; s < exp.size(); ++s)
4268 bool already_present =
false;
4269 for (
Size j = 0; j < dps.size(); j++)
4272 exp[s].getDataProcessing(), dps[j]);
4273 if (already_present)
break;
4275 if (!already_present)
4277 dps.push_back(exp[s].getDataProcessing());
4278 num_software += exp[s].getDataProcessing().size();
4281 for (
Size s = 0; s < exp.getChromatograms().size(); ++s)
4283 bool already_present =
false;
4284 for (
Size j = 0; j < dps.size(); j++)
4287 exp.getChromatograms()[s].getDataProcessing(), dps[j]);
4288 if (already_present)
break;
4290 if (!already_present)
4292 dps.push_back(exp.getChromatograms()[s].getDataProcessing());
4293 num_software += exp.getChromatograms()[s].getDataProcessing().size();
4298 Size num_bi_software(0);
4300 for (
Size s = 0; s < exp.size(); ++s)
4302 for (
Size m = 0; m < exp[s].getFloatDataArrays().size(); ++m)
4304 for (
Size i = 0; i < exp[s].getFloatDataArrays()[m].getDataProcessing().size(); ++i)
4311 os <<
"\t<softwareList count=\"" << num_software + num_bi_software <<
"\">\n";
4314 writeSoftware_(os,
"so_in_0", exp.getInstrument().getSoftware(), validator);
4317 writeSoftware_(os,
"so_default",
Software(), validator);
4320 for (
Size s1 = 0; s1 != dps.size(); ++s1)
4322 for (
Size s2 = 0; s2 != dps[s1].size(); ++s2)
4324 writeSoftware_(os,
String(
"so_dp_sp_") + s1 +
"_pm_" + s2, dps[s1][s2]->getSoftware(), validator);
4329 for (
Size s = 0; s < exp.size(); ++s)
4331 for (
Size m = 0; m < exp[s].getFloatDataArrays().size(); ++m)
4333 for (
Size i = 0; i < exp[s].getFloatDataArrays()[m].getDataProcessing().size(); ++i)
4335 writeSoftware_(os,
String(
"so_dp_sp_") + s +
"_bi_" + m +
"_pm_" + i,
4336 exp[s].getFloatDataArrays()[m].getDataProcessing()[i]->getSoftware(), validator);
4340 os <<
"\t</softwareList>\n";
4346 os <<
"\t<instrumentConfigurationList count=\"1\">\n";
4347 os <<
"\t\t<instrumentConfiguration id=\"ic_0\">\n";
4349 if (in_term.
id !=
"")
4351 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"" << in_term.
id <<
"\" name=\"" << writeXMLEscape(in_term.
name) <<
"\" />\n";
4355 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000031\" name=\"instrument model\" />\n";
4360 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000032\" name=\"customization\" value=\"" << writeXMLEscape(in.
getCustomizations()) <<
"\" />\n";
4366 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000221\" name=\"magnetic deflection\" />\n";
4370 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000246\" name=\"delayed extraction\" />\n";
4374 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000275\" name=\"collision quadrupole\" />\n";
4378 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000281\" name=\"selected ion flow tube\" />\n";
4382 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000286\" name=\"time lag focusing\" />\n";
4386 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000300\" name=\"reflectron\" />\n";
4390 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000307\" name=\"einzel lens\" />\n";
4394 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000309\" name=\"first stability region\" />\n";
4398 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000310\" name=\"fringing field\" />\n";
4402 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000311\" name=\"kinetic energy analyzer\" />\n";
4406 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000320\" name=\"static field\" />\n";
4409 writeUserParam_(os, in, 3,
"/mzML/instrumentConfigurationList/instrumentConfiguration/cvParam/@accession", validator);
4411 if (component_count != 0)
4413 os <<
"\t\t\t<componentList count=\"" << (std::max)((
Size)3, component_count) <<
"\">\n";
4420 os <<
"\t\t\t\t<source order=\"" << so.
getOrder() <<
"\">\n";
4424 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000055\" name=\"continuous flow fast atom bombardment\" />\n";
4428 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000056\" name=\"direct inlet\" />\n";
4432 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000057\" name=\"electrospray inlet\" />\n";
4436 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000058\" name=\"flow injection analysis\" />\n";
4440 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000059\" name=\"inductively coupled plasma\" />\n";
4444 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000060\" name=\"infusion\" />\n";
4448 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000061\" name=\"jet separator\" />\n";
4452 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000062\" name=\"membrane separator\" />\n";
4456 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000063\" name=\"moving belt\" />\n";
4460 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000064\" name=\"moving wire\" />\n";
4464 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000065\" name=\"open split\" />\n";
4468 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000066\" name=\"particle beam\" />\n";
4472 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000067\" name=\"reservoir\" />\n";
4476 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000068\" name=\"septum\" />\n";
4480 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000069\" name=\"thermospray inlet\" />\n";
4484 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000248\" name=\"direct insertion probe\" />\n";
4488 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000249\" name=\"direct liquid introduction\" />\n";
4492 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000396\" name=\"membrane inlet\" />\n";
4496 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000485\" name=\"nanospray inlet\" />\n";
4501 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000070\" name=\"atmospheric pressure chemical ionization\" />\n";
4505 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000071\" name=\"chemical ionization\" />\n";
4509 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000073\" name=\"electrospray ionization\" />\n";
4513 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000074\" name=\"fast atom bombardment ionization\" />\n";
4517 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000075\" name=\"matrix-assisted laser desorption ionization\" />\n";
4521 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000227\" name=\"multiphoton ionization\" />\n";
4525 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000239\" name=\"atmospheric pressure matrix-assisted laser desorption ionization\" />\n";
4529 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000240\" name=\"atmospheric pressure ionization\" />\n";
4533 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000247\" name=\"desorption ionization\" />\n";
4537 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000255\" name=\"flowing afterglow\" />\n";
4541 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000257\" name=\"field desorption\" />\n";
4545 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000258\" name=\"field ionization\" />\n";
4549 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000259\" name=\"glow discharge ionization\" />\n";
4553 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000271\" name=\"Negative ion chemical ionization\" />\n";
4557 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000272\" name=\"neutralization reionization mass spectrometry\" />\n";
4561 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000273\" name=\"photoionization\" />\n";
4565 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000274\" name=\"pyrolysis mass spectrometry\" />\n";
4569 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000276\" name=\"resonance enhanced multiphoton ionization\" />\n";
4573 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000278\" name=\"surface enhanced laser desorption ionization\" />\n";
4577 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000279\" name=\"surface enhanced neat desorption\" />\n";
4581 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000380\" name=\"adiabatic ionization\" />\n";
4585 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000381\" name=\"associative ionization\" />\n";
4589 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000382\" name=\"atmospheric pressure photoionization\" />\n";
4593 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000383\" name=\"autodetachment\" />\n";
4597 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000384\" name=\"autoionization\" />\n";
4601 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000385\" name=\"charge exchange ionization\" />\n";
4605 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000386\" name=\"chemi-ionization\" />\n";
4609 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000387\" name=\"desorption/ionization on silicon\" />\n";
4613 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000388\" name=\"dissociative ionization\" />\n";
4617 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000389\" name=\"electron ionization\" />\n";
4621 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000393\" name=\"laser desorption ionization\" />\n";
4625 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000395\" name=\"liquid secondary ionization\" />\n";
4629 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000397\" name=\"microelectrospray\" />\n";
4633 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000398\" name=\"nanoelectrospray\" />\n";
4637 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000399\" name=\"penning ionization\" />\n";
4641 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000400\" name=\"plasma desorption ionization\" />\n";
4645 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000402\" name=\"secondary ionization\" />\n";
4649 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000403\" name=\"soft ionization\" />\n";
4653 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000404\" name=\"spark ionization\" />\n";
4657 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000405\" name=\"surface-assisted laser desorption ionization\" />\n";
4661 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000406\" name=\"surface ionization\" />\n";
4665 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000407\" name=\"thermal ionization\" />\n";
4669 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000408\" name=\"vertical ionization\" />\n";
4673 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000446\" name=\"fast ion bombardment\" />\n";
4677 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000008\" name=\"ionization type\" />\n";
4680 writeUserParam_(os, so, 5,
"/mzML/instrumentConfigurationList/instrumentConfiguration/componentList/source/cvParam/@accession", validator);
4681 os <<
"\t\t\t\t</source>\n";
4686 os <<
"\t\t\t\t<source order=\"1234\">\n";
4687 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000446\" name=\"fast ion bombardment\" />\n";
4688 os <<
"\t\t\t\t\t<userParam name=\"warning\" type=\"xsd:string\" value=\"invented ion source, to fulfill mzML schema\" />\n";
4689 os <<
"\t\t\t\t</source>\n";
4697 os <<
"\t\t\t\t<analyzer order=\"" << ma.
getOrder() <<
"\">\n";
4699 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000014\" name=\"accuracy\" value=\"" << ma.
getAccuracy() <<
"\" unitAccession=\"UO:0000169\" unitName=\"parts per million\" unitCvRef=\"UO\" />\n";
4701 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000022\" name=\"TOF Total Path Length\" value=\"" << ma.
getTOFTotalPathLength() <<
"\" unitAccession=\"UO:0000008\" unitName=\"meter\" unitCvRef=\"UO\" />\n";
4702 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000024\" name=\"final MS exponent\" value=\"" << ma.
getFinalMSExponent() <<
"\" />\n";
4703 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000025\" name=\"magnetic field strength\" value=\"" << ma.
getMagneticFieldStrength() <<
"\" unitAccession=\"UO:0000228\" unitName=\"tesla\" unitCvRef=\"UO\" />\n";
4707 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000106\" name=\"reflectron on\" />\n";
4712 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000105\" name=\"reflectron off\" />\n";
4717 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000079\" name=\"fourier transform ion cyclotron resonance mass spectrometer\" />\n";
4721 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000080\" name=\"magnetic sector\" />\n";
4725 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000081\" name=\"quadrupole\" />\n";
4729 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000084\" name=\"time-of-flight\" />\n";
4733 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000254\" name=\"electrostatic energy analyzer\" />\n";
4737 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000264\" name=\"ion trap\" />\n";
4741 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000284\" name=\"stored waveform inverse fourier transform\" />\n";
4745 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000288\" name=\"cyclotron\" />\n";
4749 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000484\" name=\"orbitrap\" />\n";
4753 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000078\" name=\"axial ejection linear ion trap\" />\n";
4757 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000082\" name=\"quadrupole ion trap\" />\n";
4761 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000083\" name=\"radial ejection linear ion trap\" />\n";
4765 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000291\" name=\"linear ion trap\" />\n";
4769 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000443\" name=\"mass analyzer type\" />\n";
4772 writeUserParam_(os, ma, 5,
"/mzML/instrumentConfigurationList/instrumentConfiguration/componentList/analyzer/cvParam/@accession", validator);
4773 os <<
"\t\t\t\t</analyzer>\n";
4778 os <<
"\t\t\t\t<analyzer order=\"1234\">\n";
4779 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000288\" name=\"cyclotron\" />\n";
4780 os <<
"\t\t\t\t\t<userParam name=\"warning\" type=\"xsd:string\" value=\"invented mass analyzer, to fulfill mzML schema\" />\n";
4781 os <<
"\t\t\t\t</analyzer>\n";
4789 os <<
"\t\t\t\t<detector order=\"" <<
id.getOrder() <<
"\">\n";
4791 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000028\" name=\"detector resolution\" value=\"" <<
id.getResolution() <<
"\" />\n";
4792 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000029\" name=\"sampling frequency\" value=\"" <<
id.getADCSamplingFrequency() <<
"\" unitAccession=\"UO:0000106\" unitName=\"hertz\" unitCvRef=\"UO\" />\n";
4796 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000117\" name=\"analog-digital converter\" />\n";
4800 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000118\" name=\"pulse counting\" />\n";
4804 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000119\" name=\"time-digital converter\" />\n";
4808 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000120\" name=\"transient recorder\" />\n";
4813 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000107\" name=\"channeltron\" />\n";
4817 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000110\" name=\"daly detector\" />\n";
4821 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000112\" name=\"faraday cup\" />\n";
4825 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000114\" name=\"microchannel plate detector\" />\n";
4829 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000115\" name=\"multi-collector\" />\n";
4833 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000116\" name=\"photomultiplier\" />\n";
4837 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000253\" name=\"electron multiplier\" />\n";
4841 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000345\" name=\"array detector\" />\n";
4845 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000346\" name=\"conversion dynode\" />\n";
4849 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000347\" name=\"dynode\" />\n";
4853 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000348\" name=\"focal plane collector\" />\n";
4857 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000349\" name=\"ion-to-photon detector\" />\n";
4861 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000350\" name=\"point collector\" />\n";
4865 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000351\" name=\"postacceleration detector\" />\n";
4869 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000621\" name=\"photodiode array detector\" />\n";
4873 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000624\" name=\"inductive detector\" />\n";
4877 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000108\" name=\"conversion dynode electron multiplier\" />\n";
4881 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000109\" name=\"conversion dynode photomultiplier\" />\n";
4885 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000111\" name=\"electron multiplier tube\" />\n";
4889 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000113\" name=\"focal plane array\" />\n";
4893 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000026\" name=\"detector type\" />\n";
4896 writeUserParam_(os,
id, 5,
"/mzML/instrumentConfigurationList/instrumentConfiguration/componentList/detector/cvParam/@accession", validator);
4897 os <<
"\t\t\t\t</detector>\n";
4902 os <<
"\t\t\t\t<detector order=\"1234\">\n";
4903 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000107\" name=\"channeltron\" />\n";
4904 os <<
"\t\t\t\t\t<userParam name=\"warning\" type=\"xsd:string\" value=\"invented ion detector, to fulfill mzML schema\" />\n";
4905 os <<
"\t\t\t\t</detector>\n";
4907 os <<
"\t\t\t</componentList>\n";
4909 os <<
"\t\t\t<softwareRef ref=\"so_in_0\" />\n";
4910 os <<
"\t\t</instrumentConfiguration>\n";
4911 os <<
"\t</instrumentConfigurationList>\n";
4919 for (
Size s = 0; s < exp.size(); ++s)
4921 for (
Size m = 0; m < exp[s].getFloatDataArrays().size(); ++m)
4927 os <<
"\t<dataProcessingList count=\"" << (std::max)((
Size)1, dps.size() + num_bi_dps) <<
"\">\n";
4931 std::vector< ConstDataProcessingPtr > dummy;
4932 writeDataProcessing_(os,
"dp_sp_0", dummy, validator);
4935 for (
Size s = 0; s < dps.size(); ++s)
4937 writeDataProcessing_(os,
String(
"dp_sp_") + s, dps[s], validator);
4941 for (
Size s = 0; s < exp.size(); ++s)
4943 for (
Size m = 0; m < exp[s].getFloatDataArrays().size(); ++m)
4945 writeDataProcessing_(os,
String(
"dp_sp_") + s +
"_bi_" + m,
4946 exp[s].getFloatDataArrays()[m].getDataProcessing(), validator);
4950 os <<
"\t</dataProcessingList>\n";
4958 os <<
"\t<run id=\"ru_0\" defaultInstrumentConfigurationRef=\"ic_0\" sampleRef=\"sa_0\"";
4959 if (exp.getDateTime().isValid())
4961 os <<
" startTimeStamp=\"" << exp.getDateTime().get().substitute(
' ',
'T') <<
"\"";
4963 if (exp.getSourceFiles().size() > 0)
4965 os <<
" defaultSourceFileRef=\"sf_ru_0\"";
4970 if (exp.getFractionIdentifier() !=
"")
4972 os <<
"\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000858\" name=\"fraction identifier\" value=\"" << exp.getFractionIdentifier() <<
"\" />\n";
4975 writeUserParam_(os, exp, 2,
"/mzML/run/cvParam/@accession", validator);
4979 template <
typename MapType>
4983 std::vector<std::vector< ConstDataProcessingPtr > >& dps)
4987 if (renew_native_ids)
4989 native_id =
String(
"spectrum=") + s;
4992 long offset = os.tellp();
4993 spectra_offsets.push_back(make_pair(native_id, offset + 3));
4996 os <<
"\t\t\t<spectrum id=\"" << writeXMLEscape(native_id) <<
"\" index=\"" << s <<
"\" defaultArrayLength=\"" << spec.size() <<
"\"";
4999 os <<
" sourceFileRef=\"sf_sp_" << s <<
"\"";
5005 Size dp_ref_num = s;
5008 for (
Size i = 0; i < dps.size(); ++i)
5017 os <<
" dataProcessingRef=\"dp_sp_" << dp_ref_num <<
"\"";
5024 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000127\" name=\"centroid spectrum\" />\n";
5028 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000128\" name=\"profile spectrum\" />\n";
5032 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000525\" name=\"spectrum representation\" />\n";
5038 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000511\" name=\"ms level\" value=\"" << spec.
getMSLevel() <<
"\" />\n";
5042 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000497\" name=\"zoom scan\" />\n";
5048 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000294\" name=\"mass spectrum\" />\n";
5052 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000579\" name=\"MS1 spectrum\" />\n";
5056 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000580\" name=\"MSn spectrum\" />\n";
5060 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000582\" name=\"SIM spectrum\" />\n";
5064 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000583\" name=\"SRM spectrum\" />\n";
5068 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000581\" name=\"CRM spectrum\" />\n";
5072 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000341\" name=\"precursor ion spectrum\" />\n";
5076 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000325\" name=\"constant neutral gain spectrum\" />\n";
5080 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000326\" name=\"constant neutral loss spectrum\" />\n";
5084 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000804\" name=\"electromagnetic radiation spectrum\" />\n";
5088 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000805\" name=\"emission spectrum\" />\n";
5092 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000806\" name=\"absorption spectrum\" />\n";
5096 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000789\" name=\"enhanced multiply charged spectrum\" />\n";
5100 os <<
"\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000789\" name=\"time-delayed fragmentation spectrum\" />\n";
5104 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000294\" name=\"mass spectrum\" />\n";
5110 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000129\" name=\"negative scan\" />\n";
5114 os <<
"\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000130\" name=\"positive scan\" />\n";
5117 writeUserParam_(os, spec, 4,
"/mzML/run/spectrumList/spectrum/cvParam/@accession", validator);
5123 if (ai_term.id !=
"")
5125 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"" << ai_term.
id <<
"\" name=\"" << ai_term.name <<
"\" />\n";
5129 os <<
"\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000795\" name=\"no combination\" />\n";
5131 writeUserParam_(os, spec.
getAcquisitionInfo(), 5,
"/mzML/run/spectrumList/spectrum/scanList/cvParam/@accession", validator);
5139 os <<
"\t\t\t\t\t<scan ";
5141 os <<
"externalSpectrumID=\"" << ac.
getIdentifier() <<
"\"";
5145 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000016\" name=\"scan start time\" value=\"" << spec.
getRT() <<
"\" unitAccession=\"UO:0000010\" unitName=\"second\" unitCvRef=\"UO\" />\n";
5147 writeUserParam_(os, ac, 6,
"/mzML/run/spectrumList/spectrum/scanList/scan/cvParam/@accession", validator);
5154 os <<
"\t\t\t\t\t\t\t<scanWindow>\n";
5155 os <<
"\t\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000501\" name=\"scan window lower limit\" value=\"" << spec.
getInstrumentSettings().
getScanWindows()[
k].begin <<
"\" unitAccession=\"MS:1000040\" unitName=\"m/z\" unitCvRef=\"MS\" />\n";
5156 os <<
"\t\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000500\" name=\"scan window upper limit\" value=\"" << spec.
getInstrumentSettings().
getScanWindows()[
k].end <<
"\" unitAccession=\"MS:1000040\" unitName=\"m/z\" unitCvRef=\"MS\" />\n";
5157 writeUserParam_(os, spec.
getInstrumentSettings().
getScanWindows()[
k], 8,
"/mzML/run/spectrumList/spectrum/scanList/scan/scanWindowList/scanWindow/cvParam/@accession", validator);
5158 os <<
"\t\t\t\t\t\t\t</scanWindow>\n";
5160 os <<
"\t\t\t\t\t\t</scanWindowList>\n";
5162 os <<
"\t\t\t\t\t</scan>\n";
5167 os <<
"\t\t\t\t\t<scan>\n";
5168 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000016\" name=\"scan start time\" value=\"" << spec.
getRT() <<
"\" unitAccession=\"UO:0000010\" unitName=\"second\" unitCvRef=\"UO\" />\n";
5175 os <<
"\t\t\t\t\t\t\t<scanWindow>\n";
5176 os <<
"\t\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000501\" name=\"scan window lower limit\" value=\"" << spec.
getInstrumentSettings().
getScanWindows()[j].begin <<
"\" unitAccession=\"MS:1000040\" unitName=\"m/z\" unitCvRef=\"MS\" />\n";
5177 os <<
"\t\t\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000500\" name=\"scan window upper limit\" value=\"" << spec.
getInstrumentSettings().
getScanWindows()[j].end <<
"\" unitAccession=\"MS:1000040\" unitName=\"m/z\" unitCvRef=\"MS\" />\n";
5178 writeUserParam_(os, spec.
getInstrumentSettings().
getScanWindows()[j], 8,
"/mzML/run/spectrumList/spectrum/scanList/scan/scanWindowList/scanWindow/cvParam/@accession", validator);
5179 os <<
"\t\t\t\t\t\t\t</scanWindow>\n";
5181 os <<
"\t\t\t\t\t\t</scanWindowList>\n";
5183 os <<
"\t\t\t\t\t</scan>\n";
5185 os <<
"\t\t\t\t</scanList>\n";
5192 os <<
"\t\t\t<precursorList count=\"" << spec.
getPrecursors().size() <<
"\">\n";
5197 os <<
"\t\t\t</precursorList>\n";
5205 os <<
"\t\t\t\t<productList count=\"" << spec.
getProducts().size() <<
"\">\n";
5208 writeProduct_(os, spec.
getProducts()[p], validator);
5210 os <<
"\t\t\t\t</productList>\n";
5216 if (spec.size() != 0)
5221 writeContainerData<SpectrumType>(os, options_, spec,
"mz");
5222 writeContainerData<SpectrumType>(os, options_, spec,
"intensity");
5226 for (
Size m = 0; m < spec.getFloatDataArrays().size(); ++m)
5228 const typename SpectrumType::FloatDataArray& array = spec.getFloatDataArrays()[m];
5229 std::vector<double> data64_to_encode(array.size());
5230 for (
Size p = 0; p < array.size(); ++p)
5231 data64_to_encode[p] = array[p];
5234 String data_processing_ref_string =
"";
5235 if (array.getDataProcessing().size() != 0)
5237 data_processing_ref_string =
String(
"dataProcessingRef=\"dp_sp_") + s +
"_bi_" + m +
"\"";
5239 os <<
"\t\t\t\t\t<binaryDataArray arrayLength=\"" << array.size() <<
"\" encodedLength=\"" << encoded_string.size() <<
"\" " << data_processing_ref_string <<
">\n";
5240 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000523\" name=\"64-bit float\" />\n";
5241 os <<
"\t\t\t\t\t\t" << compression_term <<
"\n";
5243 if (bi_term.
id !=
"")
5245 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"" << bi_term.
id <<
"\" name=\"" << bi_term.
name <<
"\" />\n";
5249 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000786\" name=\"non-standard data array\" value=\"" << array.getName() <<
"\" />\n";
5251 writeUserParam_(os, array, 6,
"/mzML/run/spectrumList/spectrum/binaryDataArrayList/binaryDataArray/cvParam/@accession", validator);
5252 os <<
"\t\t\t\t\t\t<binary>" << encoded_string <<
"</binary>\n";
5253 os <<
"\t\t\t\t\t</binaryDataArray>\n";
5256 for (
Size m = 0; m < spec.getIntegerDataArrays().size(); ++m)
5258 const typename SpectrumType::IntegerDataArray& array = spec.getIntegerDataArrays()[m];
5259 std::vector<Int64> data64_to_encode(array.size());
5260 for (
Size p = 0; p < array.size(); ++p)
5261 data64_to_encode[p] = array[p];
5263 String data_processing_ref_string =
"";
5264 if (array.getDataProcessing().size() != 0)
5266 data_processing_ref_string =
String(
"dataProcessingRef=\"dp_sp_") + s +
"_bi_" + m +
"\"";
5268 os <<
"\t\t\t\t\t<binaryDataArray arrayLength=\"" << array.size() <<
"\" encodedLength=\"" << encoded_string.size() <<
"\" " << data_processing_ref_string <<
">\n";
5269 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000522\" name=\"64-bit integer\" />\n";
5270 os <<
"\t\t\t\t\t\t" << compression_term <<
"\n";
5272 if (bi_term.
id !=
"")
5274 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"" << bi_term.
id <<
"\" name=\"" << bi_term.
name <<
"\" />\n";
5278 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000786\" name=\"non-standard data array\" value=\"" << array.getName() <<
"\" />\n";
5280 writeUserParam_(os, array, 6,
"/mzML/run/spectrumList/spectrum/binaryDataArrayList/binaryDataArray/cvParam/@accession", validator);
5281 os <<
"\t\t\t\t\t\t<binary>" << encoded_string <<
"</binary>\n";
5282 os <<
"\t\t\t\t\t</binaryDataArray>\n";
5285 for (
Size m = 0; m < spec.getStringDataArrays().size(); ++m)
5287 const typename SpectrumType::StringDataArray& array = spec.getStringDataArrays()[m];
5288 std::vector<String> data_to_encode;
5289 data_to_encode.resize(array.size());
5290 for (
Size p = 0; p < array.size(); ++p)
5291 data_to_encode[p] = array[p];
5292 decoder_.encodeStrings(data_to_encode, encoded_string, options_.getCompression());
5293 String data_processing_ref_string =
"";
5294 if (array.getDataProcessing().size() != 0)
5296 data_processing_ref_string =
String(
"dataProcessingRef=\"dp_sp_") + s +
"_bi_" + m +
"\"";
5298 os <<
"\t\t\t\t\t<binaryDataArray arrayLength=\"" << array.size() <<
"\" encodedLength=\"" << encoded_string.size() <<
"\" " << data_processing_ref_string <<
">\n";
5299 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1001479\" name=\"null-terminated ASCII string\" />\n";
5300 os <<
"\t\t\t\t\t\t" << compression_term <<
"\n";
5301 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000786\" name=\"non-standard data array\" value=\"" << array.getName() <<
"\" />\n";
5302 writeUserParam_(os, array, 6,
"/mzML/run/spectrumList/spectrum/binaryDataArrayList/binaryDataArray/cvParam/@accession", validator);
5303 os <<
"\t\t\t\t\t\t<binary>" << encoded_string <<
"</binary>\n";
5304 os <<
"\t\t\t\t\t</binaryDataArray>\n";
5306 os <<
"\t\t\t\t</binaryDataArrayList>\n";
5309 os <<
"\t\t\t</spectrum>\n";
5312 template <
typename MapType>
5316 long offset = os.tellp();
5317 chromatograms_offsets.push_back(make_pair(chromatogram.
getNativeID(), offset + 6));
5321 os <<
" <chromatogram id=\"" << writeXMLEscape(chromatogram.
getNativeID()) <<
"\" index=\"" << c <<
"\" defaultArrayLength=\"" << chromatogram.size() <<
"\">" <<
"\n";
5326 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000810\" name=\"mass chromatogram\" />\n";
5330 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000235\" name=\"total ion current chromatogram\" />\n";
5334 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000627\" name=\"selected ion current chromatogram\" />\n";
5338 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000628\" name=\"basepeak chromatogram\" />\n";
5342 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1001472\" name=\"selected ion monitoring chromatogram\" />\n";
5346 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1001473\" name=\"selected reaction monitoring chromatogram\" />\n";
5350 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000811\" name=\"electromagnetic radiation chromatogram\" />\n";
5354 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000812\" name=\"absorption chromatogram\" />\n";
5358 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000813\" name=\"emission chromatogram\" />\n";
5364 writePrecursor_(os, chromatogram.
getPrecursor(), validator);
5365 writeProduct_(os, chromatogram.
getProduct(), validator);
5374 writeContainerData<ChromatogramType>(os, options_, chromatogram,
"time");
5375 writeContainerData<ChromatogramType>(os, options_, chromatogram,
"intensity");
5379 for (
Size m = 0; m < chromatogram.getFloatDataArrays().size(); ++m)
5381 const typename ChromatogramType::FloatDataArray& array = chromatogram.getFloatDataArrays()[m];
5382 std::vector<double> data64_to_encode(array.size());
5383 for (
Size p = 0; p < array.size(); ++p)
5384 data64_to_encode[p] = array[p];
5387 String data_processing_ref_string =
"";
5388 if (array.getDataProcessing().size() != 0)
5390 data_processing_ref_string =
String(
"dataProcessingRef=\"dp_sp_") + c +
"_bi_" + m +
"\"";
5392 os <<
"\t\t\t\t\t<binaryDataArray arrayLength=\"" << array.size() <<
"\" encodedLength=\"" << encoded_string.size() <<
"\" " << data_processing_ref_string <<
">\n";
5393 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000523\" name=\"64-bit float\" />\n";
5394 os <<
"\t\t\t\t\t\t" << compression_term <<
"\n";
5396 if (bi_term.
id !=
"")
5398 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"" << bi_term.
id <<
"\" name=\"" << bi_term.
name <<
"\" />\n";
5402 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000786\" name=\"non-standard data array\" value=\"" << array.getName() <<
"\" />\n";
5404 writeUserParam_(os, array, 6,
"/mzML/run/chromatogramList/chromatogram/binaryDataArrayList/binaryDataArray/cvParam/@accession", validator);
5405 os <<
"\t\t\t\t\t\t<binary>" << encoded_string <<
"</binary>\n";
5406 os <<
"\t\t\t\t\t</binaryDataArray>\n";
5409 for (
Size m = 0; m < chromatogram.getIntegerDataArrays().size(); ++m)
5411 const typename ChromatogramType::IntegerDataArray& array = chromatogram.getIntegerDataArrays()[m];
5412 std::vector<Int64> data64_to_encode(array.size());
5413 for (
Size p = 0; p < array.size(); ++p)
5414 data64_to_encode[p] = array[p];
5416 String data_processing_ref_string =
"";
5417 if (array.getDataProcessing().size() != 0)
5419 data_processing_ref_string =
String(
"dataProcessingRef=\"dp_sp_") + c +
"_bi_" + m +
"\"";
5421 os <<
"\t\t\t\t\t<binaryDataArray arrayLength=\"" << array.size() <<
"\" encodedLength=\"" << encoded_string.size() <<
"\" " << data_processing_ref_string <<
">\n";
5422 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000522\" name=\"64-bit integer\" />\n";
5423 os <<
"\t\t\t\t\t\t" << compression_term <<
"\n";
5425 if (bi_term.
id !=
"")
5427 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"" << bi_term.
id <<
"\" name=\"" << bi_term.
name <<
"\" />\n";
5431 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000786\" name=\"non-standard data array\" value=\"" << array.getName() <<
"\" />\n";
5433 writeUserParam_(os, array, 6,
"/mzML/run/chromatogramList/chromatogram/binaryDataArrayList/binaryDataArray/cvParam/@accession", validator);
5434 os <<
"\t\t\t\t\t\t<binary>" << encoded_string <<
"</binary>\n";
5435 os <<
"\t\t\t\t\t</binaryDataArray>\n";
5438 for (
Size m = 0; m < chromatogram.getStringDataArrays().size(); ++m)
5440 const typename ChromatogramType::StringDataArray& array = chromatogram.getStringDataArrays()[m];
5441 std::vector<String> data_to_encode;
5442 data_to_encode.resize(array.size());
5443 for (
Size p = 0; p < array.size(); ++p)
5444 data_to_encode[p] = array[p];
5445 decoder_.encodeStrings(data_to_encode, encoded_string, options_.getCompression());
5446 String data_processing_ref_string =
"";
5447 if (array.getDataProcessing().size() != 0)
5449 data_processing_ref_string =
String(
"dataProcessingRef=\"dp_sp_") + c +
"_bi_" + m +
"\"";
5451 os <<
"\t\t\t\t\t<binaryDataArray arrayLength=\"" << array.size() <<
"\" encodedLength=\"" << encoded_string.size() <<
"\" " << data_processing_ref_string <<
">\n";
5452 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1001479\" name=\"null-terminated ASCII string\" />\n";
5453 os <<
"\t\t\t\t\t\t" << compression_term <<
"\n";
5454 os <<
"\t\t\t\t\t\t<cvParam cvRef=\"MS\" accession=\"MS:1000786\" name=\"non-standard data array\" value=\"" << array.getName() <<
"\" />\n";
5455 writeUserParam_(os, array, 6,
"/mzML/run/chromatogramList/chromatogram/binaryDataArrayList/binaryDataArray/cvParam/@accession", validator);
5456 os <<
"\t\t\t\t\t\t<binary>" << encoded_string <<
"</binary>\n";
5457 os <<
"\t\t\t\t\t</binaryDataArray>\n";
5459 os <<
"\t\t\t\t</binaryDataArrayList>\n";
5460 os <<
"\t\t\t</chromatogram>" <<
"\n";
const String & getPathToFile() const
returns the file path
String chop(Size n) const
Returns a substring where n characters were removed from the end of the string.
const String & getNativeID() const
returns the native identifier for the spectrum, used by the acquisition software. ...
Description of the applied preprocessing steps.
Definition: DataProcessing.h:52
const String & getCustomizations() const
returns a description of customizations
ChecksumType getChecksumType() const
returns the checksum type
Class to encode and decode data encoded with MSNumpress.
Definition: MSNumpressCoder.h:55
NumpressCompression np_compression
check error tolerance after encoding, guarantee abs(1.0-(encoded/decoded)) <= this, 0=do not guarantee anything
Definition: MSNumpressCoder.h:73
static const VersionDetails EMPTY
Definition: VersionInfo.h:93
PeakFileOptions options_
Options that can be set for loading/storing.
Definition: MzMLHandler.h:904
Description of a MS instrument.
Definition: Instrument.h:64
bool getSkipXMLChecks() const
returns whether to skip some XML checks and be fast instead
bool hasUnit() const
Check if the value has a unit.
Definition: DataValue.h:370
Definition: MzMLHandlerHelper.h:64
bool hasMZRange() const
returns true if an MZ range has been set
void populateSpectraWithData()
Populate all spectra on the stack with data from input.
Definition: MzMLHandler.h:324
integer value
Definition: DataValue.h:69
double getIsolationWindowLowerOffset() const
Returns the lower offset from the target m/z.
const String & getNameOfFile() const
returns the file name
bool getSortChromatogramsByRT() const
gets whether or not peaks in chromatograms should be sorted
static String getXRefTypeName(XRefType type)
Definition: MzMLHandlerHelper.h:61
static String absolutePath(const String &file)
Replaces the relative path in the argument with the absolute path.
String accession
Definition: SemanticValidator.h:75
Representation of a CV term.
Definition: ControlledVocabulary.h:60
std::vector< SpectrumData > spectrum_data_
Vector of spectrum data stored for later parallel processing.
Definition: MzMLHandler.h:951
String writeCV_(const ControlledVocabulary::CVTerm &c, const DataValue &metaValue) const
Helper method to write an CV based on a meta value.
Definition: MzMLHandler.h:3549
A more convenient string class.
Definition: String.h:57
Precursor meta information.
Definition: Precursor.h:56
Class to encode and decode Base64.
Definition: Base64.h:64
const String & getNumber() const
returns the sample number (default: "")
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:104
void warning(const xercesc::SAXParseException &exception)
const std::vector< IonSource > & getIonSources() const
returns a const reference to the ion source list
bool getAlwaysAppendData() const
returns whether or not to always append the data to the given map (even if a consumer is given) ...
ControlledVocabulary cv_
Controlled vocabulary (psi-ms from OpenMS/share/OpenMS/CV/psi-ms.obo)
Definition: MzMLHandler.h:998
bool encloses(const PositionType &position) const
Checks whether this range contains a certain point.
Definition: DRange.h:172
UInt getMSLevel() const
Returns the MS level.
Definition: MSSpectrum.h:259
InletType getInletType() const
returns the inlet type
String version_
Schema version.
Definition: XMLHandler.h:190
bool hasIntensityRange() const
returns true if an intensity range has been set
IntensityType getIntensity() const
Definition: Peak1D.h:109
Product meta information.
Definition: Product.h:49
void set(UInt month, UInt day, UInt year, UInt hour, UInt minute, UInt second)
sets data from six integers
void writeSpectrum_(std::ostream &os, const SpectrumType &spec, Size s, Internal::MzMLValidator &validator, bool renew_native_ids, std::vector< std::vector< ConstDataProcessingPtr > > &dps)
Definition: MzMLHandler.h:4980
bool has(const Key &key) const
Test whether the map contains the given key.
Definition: Map.h:109
double getMass() const
returns the mass (in gram) (default: 0.0)
String id
Identifier.
Definition: ControlledVocabulary.h:83
bool rt_set_
Definition: MzMLHandler.h:995
const DRange< 1 > & getIntensityRange() const
returns the intensity range
const String & getNativeIDType() const
Returns the native ID type of the spectra.
bool hasSuffix(const String &string) const
true if String ends with string, false otherwise
static const DataValue EMPTY
Empty data value for comparisons.
Definition: DataValue.h:63
Data necessary to generate a single spectrum.
Definition: MzMLHandler.h:942
Semantically validates MzXML files.
Definition: MzMLValidator.h:52
virtual void startElement(const XMLCh *const , const XMLCh *const , const XMLCh *const qname, const xercesc::Attributes &attributes)
Parsing method for opening tags.
Definition: MzMLHandler.h:1081
static String path(const String &file)
Returns the path of the file (without the file name).
const std::vector< MassAnalyzer > & getMassAnalyzers() const
returns a const reference to the mass analyzer list
String toString() const
Conversion to String.
Map< String, std::vector< DataProcessingPtr > > processing_
The data processing list: id => Instrument.
Definition: MzMLHandler.h:931
SpectrumType spec_
The current spectrum.
Definition: MzMLHandler.h:909
ChromatogramPeakT ChromatogramPeakType
Chromatogram peak type.
Definition: MSExperiment.h:83
const AcquisitionInfo & getAcquisitionInfo() const
returns a const reference to the acquisition info
CoordinateType getMZ() const
Non-mutable access to m/z.
Definition: Peak1D.h:114
bool hasRTRange() const
returns true if an RT range has been set
IonizationMethod getIonizationMethod() const
returns the ionization method
std::vector< BinaryData > data
Definition: MzMLHandler.h:962
AnalyzerType getType() const
returns the analyzer type
IonOpticsType getIonOptics() const
returns the ion optics type
const StringDataArrays & getStringDataArrays() const
Returns a const reference to the string meta data arrays.
Definition: MSChromatogram.h:262
Int getCharge() const
Non-mutable access to the charge.
Base class for XML handlers.
Definition: XMLHandler.h:99
void populateSpectraWithData_(std::vector< MzMLHandlerHelper::BinaryData > &input_data, Size &default_arr_length, const PeakFileOptions &peak_file_options, SpectrumType &spectrum)
Fill a single spectrum with data from input.
Definition: MzMLHandler.h:497
bool getSortSpectraByMZ() const
gets whether or not peaks in spectra should be sorted
bool getIntensity32Bit() const
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:135
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
double getAccuracy() const
returns the mass accuracy i.e. how much the theoretical mass may differ from the measured mass (in pp...
Binary data representation.
Definition: MzMLHandlerHelper.h:58
Little endian type.
Definition: Base64.h:79
void addSpectrumMetaData_(const std::vector< MzMLHandlerHelper::BinaryData > &input_data, const Size n, SpectrumType &spectrum) const
Definition: MzMLHandler.h:443
Description of the software used for processing.
Definition: Software.h:49
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
bool getCompression() const
const IntegerDataArrays & getIntegerDataArrays() const
Returns a const reference to the integer meta data arrays.
Definition: MSSpectrum.h:322
static String find(const String &filename, StringList directories=StringList())
Looks up the location of the file filename.
std::vector< std::pair< std::string, long > > spectra_offsets
Definition: MzMLHandler.h:973
const String & getUnit() const
Return the unit associated to this DataValue.
MzMLHandler(const MapType &exp, const String &filename, const String &version, const ProgressLogger &logger)
Constructor for a write-only handler.
Definition: MzMLHandler.h:155
ChromatogramType chromatogram_
The current chromatogram.
Definition: MzMLHandler.h:911
void writeContainerData(std::ostream &os, const PeakFileOptions &pf_options_, const ContainerT &container, String array_type)
Definition: MzMLHandler.h:272
static bool isDirectory(const String &path)
Return true if the given path specifies a directory.
void populateChromatogramsWithData()
Populate all chromatograms on the stack with data from input.
Definition: MzMLHandler.h:389
bool obsolete
Flag that indicates of the term is obsolete.
Definition: ControlledVocabulary.h:86
Configuration class for MSNumpress.
Definition: MSNumpressCoder.h:69
Int getOrder() const
returns the position of this part in the whole Instrument.
Map< String, SourceFile > source_files_
The source files: id => SourceFile.
Definition: MzMLHandler.h:923
const ProgressLogger & logger_
Progress logger.
Definition: MzMLHandler.h:981
Map< String, Software > software_
The software list: id => Software.
Definition: MzMLHandler.h:927
double getActivationEnergy() const
returns the activation energy (in electronvolt)
#define LOG_ERROR
Macro to be used if non-fatal error are reported (processing continues)
Definition: LogStream.h:447
SpectrumType getType() const
returns the spectrum type
const String & getIdentifier() const
return the identifier/index/number of the acquisition
double toDouble() const
Conversion to double.
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:57
double getIsolationWindowUpperOffset() const
Returns the upper offset from the target m/z.
bool getZoomScan() const
return if this scan is a zoom (enhanced resolution) scan
ScanMode getScanMode() const
returns the scan mode
double getTOFTotalPathLength() const
returns the path length for a TOF mass analyzer (in meter)
const std::set< ActivationMethod > & getActivationMethods() const
returns a const reference to the activation methods
double getMZ() const
returns the target m/z
virtual void endElement(const XMLCh *const , const XMLCh *const , const XMLCh *const qname)
Parsing method for closing tags.
Definition: MzMLHandler.h:1542
String unit_accession
Definition: SemanticValidator.h:79
MSExperiment< Peak1D > MapType
Definition: PeakPickerIterative.cpp:87
Representation of a controlled vocabulary.
Definition: ControlledVocabulary.h:54
double getMagneticFieldStrength() const
returns the strength of the magnetic field (in T)
Size default_array_length
Definition: MzMLHandler.h:945
bool cmpPtrContainer(const ContainerType &a, const ContainerType &b)
Helper function to compare two pointer-containers for equality of all elements.
Definition: Helpers.h:84
Size default_array_length_
The default number of peaks in the current spectrum.
Definition: MzMLHandler.h:915
Data necessary to generate a single chromatogram.
Definition: MzMLHandler.h:960
SpectrumType spectrum
Definition: MzMLHandler.h:946
void load(const String &filename, CVMappings &cv_mappings, bool strip_namespaces=false)
loads CvMappings from the given file
XML handler for MzMLFile.
Definition: MzMLHandler.h:110
void loadFromOBO(const String &name, const String &filename)
Loads the CV from an OBO file.
void writeSourceFile_(std::ostream &os, const String &id, const SourceFile &software, Internal::MzMLValidator &validator)
Helper method that writes a source file.
Definition: MzMLHandler.h:3690
Int toInt() const
Conversion to int.
bool has_unit_accession
Definition: SemanticValidator.h:80
const Precursor & getPrecursor() const
returns a const reference to the precursors
const std::vector< ScanWindow > & getScanWindows() const
returns a const reference to the m/z scan windows
const SourceFile & getSourceFile() const
returns a const reference to the source file
Representation of a parsed CV term.
Definition: SemanticValidator.h:73
MapType * exp_
map pointer for reading
Definition: MzMLHandler.h:899
bool skip_spectrum_
Definition: MzMLHandler.h:992
Base64 decoder_
Decoder/Encoder for Base64-data in MzML.
Definition: MzMLHandler.h:978
DataType valueType() const
returns the type of value stored
Definition: DataValue.h:351
const DRange< 1 > & getRTRange() const
returns the RT range
Map< String, Sample > samples_
The sample list: id => Sample.
Definition: MzMLHandler.h:925
double getIsolationWindowLowerOffset() const
returns the lower offset from the target m/z
MapType::ChromatogramPeakType ChromatogramPeakType
Chromatogram peak type.
Definition: MzMLHandler.h:257
void writeBinaryDataArray(std::ostream &os, const PeakFileOptions &pf_options_, std::vector< DataType > data_to_encode, bool is32bit, String array_type)
Definition: MzMLHandler.h:823
String default_processing_
id of the default data processing (used when no processing is defined)
Definition: MzMLHandler.h:933
PeakFileOptions & getOptions()
Get the peak file options.
Definition: MzMLHandler.h:232
boost::shared_ptr< DataProcessing > DataProcessingPtr
Definition: DataProcessing.h:127
String & trim()
removes whitespaces (space, tab, line feed, carriage return) at the beginning and the end of the stri...
Interfaces::IMSDataConsumer< MapType > * consumer_
Consumer class to work on spectra.
Definition: MzMLHandler.h:984
CVMappings mapping_
Definition: MzMLHandler.h:999
A 1-dimensional raw data point or peak.
Definition: Peak1D.h:55
Scan window description.
Definition: ScanWindow.h:47
double getRT() const
Definition: MSSpectrum.h:243
static void writeFooter_(std::ostream &os, const PeakFileOptions &options_, std::vector< std::pair< std::string, long > > &spectra_offsets, std::vector< std::pair< std::string, long > > &chromatograms_offsets)
Write the mzML footer the appropriate compression term given the PeakFileOptions and the NumpressConf...
ReflectronState getReflectronState() const
returns the reflectron state (for TOF)
static void computeDataProperties_(std::vector< BinaryData > &data_, bool &precision_64, SignedSize &index, String index_name)
XRefType xref_type
xref value-type for the CV-term
Definition: ControlledVocabulary.h:90
Meta information about the sample.
Definition: Sample.h:60
MSChromatogram< ChromatogramPeakType > ChromatogramType
Spectrum type.
Definition: MzMLHandler.h:261
MSSpectrum< PeakType > SpectrumType
Spectrum type.
Definition: MzMLHandler.h:259
String file_
File name.
Definition: XMLHandler.h:187
std::vector< BinaryData > data_
The spectrum data (or chromatogram data)
Definition: MzMLHandler.h:913
Description of a ion detector (part of a MS Instrument)
Definition: IonDetector.h:47
String name
Definition: SemanticValidator.h:76
double getIsolationWindowUpperOffset() const
returns the upper offset from the target m/z
Information about one raw data spectrum that was combined with several other raw data spectra...
Definition: Acquisition.h:50
String name
if it is a score type, lookup has_order
Definition: ControlledVocabulary.h:82
virtual void writeTo(std::ostream &os)
Writes the contents to a stream.
Definition: MzMLHandler.h:3975
Definition: VersionInfo.h:63
void populateChromatogramsWithData_(std::vector< MzMLHandlerHelper::BinaryData > &input_data, Size &default_arr_length, const PeakFileOptions &peak_file_options, ChromatogramType &inp_chromatogram)
Fill a single chromatogram with data from input.
Definition: MzMLHandler.h:673
static String getCompressionTerm_(const PeakFileOptions &opt, MSNumpressCoder::NumpressConfig np_compression, bool use_numpress=false)
Returns the appropriate compression term given the PeakFileOptions and the NumpressConfig.
const String & getName() const
returns the name of the software
void setUnit(const String &unit)
Sets the unit to the given String.
ChromatogramType getChromatogramType() const
returns the chromatogram type, e.g. a SRM chromatogram
MSNumpressCoder::NumpressConfig getNumpressConfigurationMassTime() const
Set numpress configuration options for m/z or rt dimension.
void writePrecursor_(std::ostream &os, const Precursor &precursor, Internal::MzMLValidator &validator)
Helper method that write precursor information from spectra and chromatograms.
Definition: MzMLHandler.h:3858
const Product & getProduct() const
returns a const reference to the products
Invalid conversion exception.
Definition: Exception.h:363
void fatalError(const xercesc::SAXParseException &exception)
bool isEmpty() const
test if the value is empty
Definition: DataValue.h:360
Loading a file.
Definition: XMLHandler.h:118
const String & getComment() const
returns the comment (default: "")
static String basename(const String &file)
Returns the basename of the file (without the path).
MSNumpressCoder::NumpressConfig getNumpressConfigurationIntensity() const
Set numpress configuration options for intensity dimension.
Definition: MzMLHandlerHelper.h:64
bool in_spectrum_list_
Flag that indicates that we're inside a spectrum (in contrast to a chromatogram)
Definition: MzMLHandler.h:917
PeakType PeakType
Peak type.
Definition: MSSpectrum.h:105
const String & getFileType() const
returns the file type
std::vector< DataProcessingPtr > & getDataProcessing()
returns a mutable reference to the description of the applied processing
Invalid value exception.
Definition: Exception.h:336
bool getFillData() const
returns whether to fill the actual data into the container (spectrum/chromatogram) ...
void getCounts(Size &spectra_counts, Size &chromatogram_counts)
Get the spectra and chromatogram counts of a file.
Definition: MzMLHandler.h:240
std::vector< ChromatogramData > chromatogram_data_
Vector of chromatogram data stored for later parallel processing.
Definition: MzMLHandler.h:968
const IntegerDataArrays & getIntegerDataArrays() const
Returns a const reference to the integer meta data arrays.
Definition: MSChromatogram.h:274
const StringDataArrays & getStringDataArrays() const
Returns a const reference to the string meta data arrays.
Definition: MSSpectrum.h:310
UInt scan_count
Counting spectra and chromatograms.
Definition: MzMLHandler.h:987
String value
Definition: SemanticValidator.h:77
const String & getVersion() const
returns the software version
IonSource::Polarity getPolarity() const
returns the polarity
bool skip_chromatogram_
Flag that indicates whether this spectrum should be skipped (due to options)
Definition: MzMLHandler.h:991
static VersionDetails create(const String &version)
parse String and return as proper struct
const String & getMethodOfCombination() const
returns the method of combination
The interface of a consumer of spectra and chromatograms.
Definition: IMSDataConsumer.h:68
String prefix(SizeType length) const
returns the prefix of length length
static void decodeBase64Arrays(std::vector< BinaryData > &data_, bool skipXMLCheck=false)
const String & getChecksum() const
returns the file's checksum
void writeSoftware_(std::ostream &os, const String &id, const Software &software, Internal::MzMLValidator &validator)
Helper method that writes a software.
Definition: MzMLHandler.h:3661
DateTime Class.
Definition: DateTime.h:55
String & substitute(char from, char to)
Replaces all occurrences of the character from by the character to.
OPENMS_INT64_TYPE Int64
Signed integer type (64bit)
Definition: Types.h:71
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:55
UInt selected_ion_count_
Count of selected ions.
Definition: MzMLHandler.h:1003
const std::vector< Product > & getProducts() const
returns a const reference to the products
const String & getName() const
returns the name of the instrument
Int getFinalMSExponent() const
returns the final MS exponent
ControlledVocabulary::CVTerm getChildWithName_(const String &parent_accession, const String &name) const
Looks up a child CV term of parent_accession with the name name. If no such term is found...
Definition: MzMLHandler.h:3646
void setIdentifier(const String &identifier)
sets the index/number of the scan
MapType::PeakType PeakType
Peak type.
Definition: MzMLHandler.h:255
void encode(std::vector< FromType > &in, ByteOrder to_byte_order, String &out, bool zlib_compression=false)
Encodes a vector of floating point numbers to a Base64 string.
Definition: Base64.h:210
void setOptions(const PeakFileOptions &opt)
Set the peak file options.
Definition: MzMLHandler.h:224
double value
Definition: DataValue.h:70
Definition: MSNumpressCoder.h:60
const InstrumentSettings & getInstrumentSettings() const
returns a const reference to the instrument settings of the current spectrum
void writeUserParam_(std::ostream &os, const MetaInfoInterface &meta, UInt indent, String path, Internal::MzMLValidator &validator) const
Writes user terms.
Definition: MzMLHandler.h:3567
void encodeNP(const std::vector< double > &in, String &result, bool zlib_compression, const NumpressConfig &config)
Encodes a vector of floating point numbers into a Base64 string using numpress.
Definition: MSNumpressCoder.h:129
std::vector< Int > & getPossibleChargeStates()
Mutable access to possible charge states.
static bool handleBinaryDataArrayCVParam(std::vector< BinaryData > &data_, const String &accession, const String &value, const String &name)
bool has_unit_name
Definition: SemanticValidator.h:82
void fillChromatogramData_()
Fills the current chromatogram with data points and meta data.
Size getMaxDataPoolSize() const
Get maximal size of the data pool.
MzMLHandler(MapType &exp, const String &filename, const String &version, ProgressLogger &logger)
Constructor for a read-only handler.
Definition: MzMLHandler.h:118
const DRange< 1 > & getMZRange() const
returns the MZ range
std::vector< std::pair< std::string, long > > chromatograms_offsets
Definition: MzMLHandler.h:974
void handleUserParam_(const String &parent_parent_tag, const String &parent_tag, const String &name, const String &type, const String &value)
Handles user terms.
Definition: MzMLHandler.h:3388
MzMLHandlerHelper::BinaryData BinaryData
Definition: MzMLHandler.h:263
void writeProduct_(std::ostream &os, const Product &product, Internal::MzMLValidator &validator)
Helper method that write precursor information from spectra and chromatograms.
Definition: MzMLHandler.h:3962
Map< String, Instrument > instruments_
The data processing list: id => Instrument.
Definition: MzMLHandler.h:929
const FloatDataArrays & getFloatDataArrays() const
Definition: MSChromatogram.h:250
String current_id_
Id of the current list. Used for referencing param group, source file, sample, software, ...
Definition: MzMLHandler.h:919
std::vector< BinaryData > data
Definition: MzMLHandler.h:944
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
Representation of controlled vocabulary mapping rules (for PSI formats)
Definition: CVMappings.h:57
Options for loading files containing peak data.
Definition: PeakFileOptions.h:48
Map< String, std::vector< SemanticValidator::CVTerm > > ref_param_
The referencing param groups: id => array (accession, value)
Definition: MzMLHandler.h:921
void writeDataProcessing_(std::ostream &os, const String &id, const std::vector< ConstDataProcessingPtr > &dps, Internal::MzMLValidator &validator)
Helper method that writes a data processing list.
Definition: MzMLHandler.h:3735
const FloatDataArrays & getFloatDataArrays() const
Returns a const reference to the float meta data arrays.
Definition: MSSpectrum.h:298
Int getOrder() const
returns the position of this part in the whole Instrument.
const String & getNativeID() const
returns the native identifier for the spectrum, used by the acquisition software. ...
void writeChromatogram_(std::ostream &os, const ChromatogramType &chromatogram, Size c, Internal::MzMLValidator &validator)
Definition: MzMLHandler.h:5313
bool skip_data
Definition: MzMLHandler.h:947
void setMSDataConsumer(Interfaces::IMSDataConsumer< MapType > *consumer)
Set the IMSDataConsumer consumer which will consume the read data.
Definition: MzMLHandler.h:247
int Int
Signed integer type.
Definition: Types.h:103
Map class based on the STL map (containing several convenience functions)
Definition: Map.h:51
Description of a mass analyzer (part of a MS Instrument)
Definition: MassAnalyzer.h:48
Description of an ion source (part of a MS Instrument)
Definition: IonSource.h:47
Definition: MzMLHandlerHelper.h:64
const MapType * cexp_
map pointer for writing
Definition: MzMLHandler.h:901
const String & getName() const
returns the sample name (default: "")
void writeHeader_(std::ostream &os, const MapType &exp, std::vector< std::vector< ConstDataProcessingPtr > > &dps, Internal::MzMLValidator &validator)
Definition: MzMLHandler.h:4049
ChromatogramType chromatogram
Definition: MzMLHandler.h:964
void handleCVParam_(const String &parent_parent_tag, const String &parent_tag, const String &accession, const String &name, const String &value, const String &unit_accession="")
Handles CV terms.
Definition: MzMLHandler.h:1646
virtual ~MzMLHandler()
Destructor.
Definition: MzMLHandler.h:192
double getConcentration() const
returns the concentration (in g/l) (default: 0.0)
SampleState getState() const
returns the state of aggregation (default: SAMPLENULL)
UInt chromatogram_count
Definition: MzMLHandler.h:988
bool validateCV_(const ControlledVocabulary::CVTerm &c, const String &path, const Internal::MzMLValidator &validator) const
Helper method to validate if the given CV is allowed in the current location (path) ...
Definition: MzMLHandler.h:3536
bool hasPrefix(const String &string) const
true if String begins with string, false otherwise
Parse Error exception.
Definition: Exception.h:608
virtual void characters(const XMLCh *const chars, const XMLSize_t length)
Parsing method for character data.
Definition: MzMLHandler.h:1050
Size default_array_length
Definition: MzMLHandler.h:963
double getVolume() const
returns the volume (in ml) (default: 0.0)
Used to load CvMapping files.
Definition: CVMappingFile.h:57