35 #ifndef OPENMS_FORMAT_HANDLERS_MZDATAHANDLER_H
36 #define OPENMS_FORMAT_HANDLERS_MZDATAHANDLER_H
59 template <
typename MapType>
103 virtual void endElement(
const XMLCh *
const ,
const XMLCh *
const ,
const XMLCh *
const qname);
106 virtual void startElement(
const XMLCh *
const ,
const XMLCh *
const ,
const XMLCh *
const qname,
const xercesc::Attributes & attributes);
109 virtual void characters(
const XMLCh *
const chars,
const XMLSize_t length);
112 void writeTo(std::ostream & os);
145 String(
";ESI;EI;CI;FAB;TSP;LD;FD;FI;PD;SI;TI;API;ISI;CID;CAD;HN;APCI;APPI;ICP").
split(
';',
cv_terms_[10]);
147 String(
";Direct;Batch;Chromatography;ParticleBeam;MembraneSeparator;OpenSplit;JetSeparator;Septum;Reservoir;MovingBelt;MovingWire;FlowInjectionAnalysis;ElectrosprayInlet;ThermosprayInlet;Infusion;ContinuousFlowFastAtomBombardment;InductivelyCoupledPlasma").
split(
';',
cv_terms_[11]);
151 String(
";EM;Photomultiplier;FocalPlaneArray;FaradayCup;ConversionDynodeElectronMultiplier;ConversionDynodePhotomultiplier;Multi-Collector;ChannelElectronMultiplier").
split(
';',
cv_terms_[13]);
153 String(
";Quadrupole;PaulIonTrap;RadialEjectionLinearIonTrap;AxialEjectionLinearIonTrap;TOF;Sector;FourierTransform;IonStorage").
split(
';',
cv_terms_[14]);
226 os <<
String(indent,
'\t') <<
"<cvParam cvLabel=\"psi\" accession=\"PSI:" << acc <<
"\" name=\"" << name <<
"\" value=\"" << value <<
"\"/>\n";
245 os <<
String(indent,
'\t') <<
"<cvParam cvLabel=\"psi\" accession=\"PSI:" << acc <<
"\" name=\"" << name <<
"\" value=\"" << value <<
"\"/>\n";
267 warning(
STORE,
String(
"Cannot find map '") + map +
"' needed to write CV term '" + name +
"' with accession '" + acc +
"'.");
273 warning(
STORE,
String(
"Cannot find value '") + value +
"' needed to write CV term '" + name +
"' with accession '" + acc +
"'.");
282 std::vector<String> keys;
284 for (std::vector<String>::const_iterator it = keys.begin(); it != keys.end(); ++it)
288 os <<
String(indent,
'\t') <<
"<userParam name=\"" << *it <<
"\" value=\"" << meta.
getMetaValue(*it) <<
"\"/>\n";
310 os <<
"\t\t\t<" << tag;
311 if (tag ==
"supDataArrayBinary" || tag ==
"supDataArray")
313 os <<
" id=\"" <<
id <<
"\"";
316 if (tag ==
"supDataArrayBinary" || tag ==
"supDataArray")
318 os <<
"\t\t\t\t<arrayName>" << name <<
"</arrayName>\n";
323 data_to_encode_.clear();
324 os <<
"\t\t\t\t<data precision=\"32\" endian=\"little\" length=\""
327 <<
"</data>\n\t\t\t</" << tag <<
">\n";
337 template <
typename MapType>
344 char * transcoded_chars = sm_.convert(chars);
347 const String & current_tag = open_tags_.back();
351 if (open_tags_.size() > 1)
352 parent_tag = *(open_tags_.end() - 2);
355 if (current_tag ==
"sampleName")
357 exp_->getSample().setName(sm_.convert(chars));
359 else if (current_tag ==
"instrumentName")
361 exp_->getInstrument().setName(sm_.convert(chars));
363 else if (current_tag ==
"version")
365 data_processing_.getSoftware().setVersion(sm_.convert(chars));
367 else if (current_tag ==
"institution")
369 exp_->getContacts().back().setInstitution(sm_.convert(chars));
371 else if (current_tag ==
"contactInfo")
373 exp_->getContacts().back().setContactInfo(sm_.convert(chars));
375 else if (current_tag ==
"name" && parent_tag ==
"contact")
377 exp_->getContacts().back().setName(sm_.convert(chars));
379 else if (current_tag ==
"name" && parent_tag ==
"software")
381 data_processing_.getSoftware().setName(sm_.convert(chars));
383 else if (current_tag ==
"comments" && parent_tag ==
"software")
385 data_processing_.getSoftware().setMetaValue(
"comment",
String(sm_.convert(chars)));
387 else if (current_tag ==
"comments" && parent_tag ==
"spectrumDesc")
389 spec_.setComment(transcoded_chars);
391 else if (current_tag ==
"data")
394 data_to_decode_.back() += transcoded_chars;
396 else if (current_tag ==
"arrayName" && parent_tag ==
"supDataArrayBinary")
398 spec_.getFloatDataArrays().back().setName(transcoded_chars);
400 else if (current_tag ==
"nameOfFile" && parent_tag ==
"sourceFile")
402 exp_->getSourceFiles().back().setNameOfFile(sm_.convert(chars));
404 else if (current_tag ==
"nameOfFile" && parent_tag ==
"supSourceFile")
408 else if (current_tag ==
"pathToFile" && parent_tag ==
"sourceFile")
410 exp_->getSourceFiles().back().setPathToFile(sm_.convert(chars));
412 else if (current_tag ==
"pathToFile" && parent_tag ==
"supSourceFile")
416 else if (current_tag ==
"fileType" && parent_tag ==
"sourceFile")
418 exp_->getSourceFiles().back().setFileType(sm_.convert(chars));
420 else if (current_tag ==
"fileType" && parent_tag ==
"supSourceFile")
426 String trimmed_transcoded_chars = transcoded_chars;
427 trimmed_transcoded_chars.
trim();
428 if (trimmed_transcoded_chars !=
"")
430 warning(LOAD,
String(
"Unhandled character content in tag '") + current_tag +
"': " + trimmed_transcoded_chars);
435 template <
typename MapType>
438 static const XMLCh * s_name = xercesc::XMLString::transcode(
"name");
439 static const XMLCh * s_accession = xercesc::XMLString::transcode(
"accession");
440 static const XMLCh * s_value = xercesc::XMLString::transcode(
"value");
441 static const XMLCh * s_id = xercesc::XMLString::transcode(
"id");
442 static const XMLCh * s_count = xercesc::XMLString::transcode(
"count");
443 static const XMLCh * s_spectrumtype = xercesc::XMLString::transcode(
"spectrumType");
444 static const XMLCh * s_methodofcombination = xercesc::XMLString::transcode(
"methodOfCombination");
445 static const XMLCh * s_acqnumber = xercesc::XMLString::transcode(
"acqNumber");
446 static const XMLCh * s_mslevel = xercesc::XMLString::transcode(
"msLevel");
447 static const XMLCh * s_mzrangestart = xercesc::XMLString::transcode(
"mzRangeStart");
448 static const XMLCh * s_mzrangestop = xercesc::XMLString::transcode(
"mzRangeStop");
449 static const XMLCh * s_supdataarrayref = xercesc::XMLString::transcode(
"supDataArrayRef");
450 static const XMLCh * s_precision = xercesc::XMLString::transcode(
"precision");
451 static const XMLCh * s_endian = xercesc::XMLString::transcode(
"endian");
452 static const XMLCh * s_length = xercesc::XMLString::transcode(
"length");
453 static const XMLCh * s_comment = xercesc::XMLString::transcode(
"comment");
454 static const XMLCh * s_accessionnumber = xercesc::XMLString::transcode(
"accessionNumber");
456 String tag = sm_.convert(qname);
457 open_tags_.push_back(tag);
462 if (open_tags_.size() > 1)
463 parent_tag = *(open_tags_.end() - 2);
466 if (tag !=
"spectrum" && skip_spectrum_)
471 if (tag ==
"sourceFile")
473 exp_->getSourceFiles().push_back(
SourceFile());
475 if (tag ==
"contact")
477 exp_->getContacts().resize(exp_->getContacts().size() + 1);
479 else if (tag ==
"source")
481 exp_->getInstrument().getIonSources().resize(1);
483 else if (tag ==
"detector")
485 exp_->getInstrument().getIonDetectors().resize(1);
487 else if (tag ==
"analyzer")
489 exp_->getInstrument().getMassAnalyzers().resize(exp_->getInstrument().getMassAnalyzers().size() + 1);
491 else if (tag ==
"software")
494 if (attributes.getIndex(sm_.convert(
"completionTime")) != -1)
496 data_processing_.setCompletionTime(asDateTime_(sm_.convert(attributes.getValue(sm_.convert(
"completionTime")))));
499 else if (tag ==
"precursor")
501 spec_.getPrecursors().push_back(
Precursor());
503 else if (tag ==
"cvParam")
505 String accession = attributeAsString_(attributes, s_accession);
507 optionalAttributeAsString_(value, attributes, s_value);
508 cvParam_(accession, value);
510 else if (tag ==
"supDataDesc")
513 if (optionalAttributeAsString_(comment, attributes, s_comment))
515 meta_id_descs_.back().second.setMetaValue(
"comment", comment);
518 else if (tag ==
"userParam")
520 String name = attributeAsString_(attributes, s_name);
522 optionalAttributeAsString_(value, attributes, s_value);
524 if (parent_tag ==
"spectrumInstrument")
526 spec_.getInstrumentSettings().setMetaValue(name, value);
528 else if (parent_tag ==
"acquisition")
530 spec_.getAcquisitionInfo().back().setMetaValue(name, value);
532 else if (parent_tag ==
"ionSelection")
534 spec_.getPrecursors().back().setMetaValue(name, value);
536 else if (parent_tag ==
"activation")
538 spec_.getPrecursors().back().setMetaValue(name, value);
540 else if (parent_tag ==
"supDataDesc")
542 meta_id_descs_.back().second.setMetaValue(name, value);
544 else if (parent_tag ==
"detector")
546 exp_->getInstrument().getIonDetectors().back().setMetaValue(name, value);
548 else if (parent_tag ==
"source")
550 exp_->getInstrument().getIonSources().back().setMetaValue(name, value);
552 else if (parent_tag ==
"sampleDescription")
554 exp_->getSample().setMetaValue(name, value);
556 else if (parent_tag ==
"analyzer")
558 exp_->getInstrument().getMassAnalyzers().back().setMetaValue(name, value);
560 else if (parent_tag ==
"additional")
562 exp_->getInstrument().setMetaValue(name, value);
564 else if (parent_tag ==
"processingMethod")
566 data_processing_.setMetaValue(name, value);
570 warning(LOAD,
"Invalid userParam: name=\"" + name +
", value=\"" + value +
"\"");
573 else if (tag ==
"supDataArrayBinary")
577 typename MapType::SpectrumType::FloatDataArray mda;
579 String id = attributeAsString_(attributes, s_id);
580 for (
Size i = 0; i < meta_id_descs_.size(); ++i)
582 if (meta_id_descs_[i].first ==
id)
584 mda.MetaInfoDescription::operator=(meta_id_descs_[i].second);
589 spec_.getFloatDataArrays().push_back(mda);
591 else if (tag ==
"spectrum")
594 spec_.setNativeID(
String(
"spectrum=") + attributeAsString_(attributes, s_id));
595 spec_.getDataProcessing().push_back(data_processing_);
597 else if (tag ==
"spectrumList")
599 if (options_.getMetadataOnly())
602 UInt count = attributeAsInt_(attributes, s_count);
603 exp_->reserve(count);
604 logger_.startProgress(0, count,
"loading mzData file");
607 else if (tag ==
"mzData")
610 exp_->setIdentifier(attributeAsString_(attributes, s_accessionnumber));
612 else if (tag ==
"acqSpecification")
614 String tmp_type = attributeAsString_(attributes, s_spectrumtype);
615 if (tmp_type ==
"discrete")
619 else if (tmp_type ==
"continuous")
626 warning(LOAD,
String(
"Invalid spectrum type '") + tmp_type +
"'.");
629 spec_.getAcquisitionInfo().setMethodOfCombination(attributeAsString_(attributes, s_methodofcombination));
631 else if (tag ==
"acquisition")
633 spec_.getAcquisitionInfo().insert(spec_.getAcquisitionInfo().end(),
Acquisition());
634 spec_.getAcquisitionInfo().back().setIdentifier(attributeAsString_(attributes, s_acqnumber));
636 else if (tag ==
"spectrumInstrument" || tag ==
"acqInstrument")
638 spec_.setMSLevel(attributeAsInt_(attributes, s_mslevel));
640 optionalAttributeAsDouble_(window.
begin, attributes, s_mzrangestart);
641 optionalAttributeAsDouble_(window.
end, attributes, s_mzrangestop);
642 if (window.
begin != 0.0 || window.
end != 0.0)
644 spec_.getInstrumentSettings().getScanWindows().push_back(window);
647 if (options_.hasMSLevels() && !options_.containsMSLevel(spec_.getMSLevel()))
649 skip_spectrum_ =
true;
652 else if (tag ==
"supDesc")
654 meta_id_descs_.push_back(std::make_pair(attributeAsString_(attributes, s_supdataarrayref),
MetaInfoDescription()));
656 else if (tag ==
"data")
659 precisions_.push_back(attributeAsString_(attributes, s_precision));
660 endians_.push_back(attributeAsString_(attributes, s_endian));
663 if (parent_tag ==
"mzArrayBinary")
665 peak_count_ = attributeAsInt_(attributes, s_length);
666 spec_.reserve(peak_count_);
669 else if (tag ==
"mzArrayBinary")
671 data_to_decode_.resize(data_to_decode_.size() + 1);
673 else if (tag ==
"intenArrayBinary")
675 data_to_decode_.resize(data_to_decode_.size() + 1);
677 else if (tag ==
"arrayName" && parent_tag ==
"supDataArrayBinary")
680 data_to_decode_.resize(data_to_decode_.size() + 1);
685 template <
typename MapType>
688 static UInt scan_count = 0;
690 static const XMLCh * s_spectrum = xercesc::XMLString::transcode(
"spectrum");
691 static const XMLCh * s_mzdata = xercesc::XMLString::transcode(
"mzData");
693 open_tags_.pop_back();
696 if (equal_(qname, s_spectrum))
701 exp_->addSpectrum(spec_);
703 skip_spectrum_ =
false;
704 logger_.setProgress(++scan_count);
705 decoded_list_.clear();
706 decoded_double_list_.clear();
707 data_to_decode_.clear();
710 meta_id_descs_.clear();
712 else if (equal_(qname, s_mzdata))
714 logger_.endProgress();
721 template <
typename MapType>
724 std::vector<float> decoded;
725 std::vector<double> decoded_double;
731 for (
Size i = 0; i < data_to_decode_.size(); ++i)
735 data_to_decode_[i].removeWhitespaces();
737 if (precisions_[i] ==
"64")
739 if (endians_[i] ==
"big")
752 decoded_double_list_.push_back(decoded_double);
753 decoded_list_.push_back(std::vector<float>());
757 if (endians_[i] ==
"big")
768 decoded_list_.push_back(decoded);
769 decoded_double_list_.push_back(std::vector<double>());
776 bool mz_precision_64 =
true;
777 if (precisions_[0] ==
"32")
779 mz_precision_64 =
false;
781 bool int_precision_64 =
true;
782 if (precisions_[1] ==
"32")
784 int_precision_64 =
false;
788 for (
Size i = 0; i < spec_.getFloatDataArrays().size(); ++i)
790 spec_.getFloatDataArrays()[i].reserve(peak_count_);
794 for (
Size n = 0; n < peak_count_; ++n)
796 double mz = mz_precision_64 ? decoded_double_list_[0][n] : decoded_list_[0][n];
797 double intensity = int_precision_64 ? decoded_double_list_[1][n] : decoded_list_[1][n];
798 if ((!options_.hasMZRange() || options_.getMZRange().encloses(
DPosition<1>(mz)))
799 && (!options_.hasIntensityRange() || options_.getIntensityRange().encloses(
DPosition<1>(intensity))))
804 spec_.push_back(tmp);
806 for (
Size i = 0; i < spec_.getFloatDataArrays().size(); ++i)
808 spec_.getFloatDataArrays()[i].push_back(precisions_[2 + i] ==
"64" ? decoded_double_list_[2 + i][n] : decoded_list_[2 + i][n]);
815 template <
typename MapType>
818 logger_.startProgress(0, cexp_->size(),
"storing mzData file");
820 os <<
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"
821 <<
"<mzData version=\"1.05\" accessionNumber=\"" << cexp_->getIdentifier() <<
"\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://psidev.sourceforge.net/ms/xml/mzdata/mzdata.xsd\">\n";
825 const Sample & sm = cexp_->getSample();
826 os <<
"\t<description>\n"
828 <<
"\t\t\t<sampleName>"
830 <<
"</sampleName>\n";
832 #pragma clang diagnostic push
833 #pragma clang diagnostic ignored "-Wconversion"
835 #pragma clang diagnostic pop
837 os <<
"\t\t\t<sampleDescription>\n";
838 writeCVS_(os, sm.
getNumber(),
"1000001",
"SampleNumber");
839 writeCVS_(os, sm.
getState(), 0,
"1000003",
"SampleState");
840 writeCVS_(os, sm.
getMass(),
"1000004",
"SampleMass");
841 writeCVS_(os, sm.
getVolume(),
"1000005",
"SampleVolume");
843 writeUserParam_(os, cexp_->getSample());
844 os <<
"\t\t\t</sampleDescription>\n";
847 if (cexp_->getSourceFiles().size() >= 1)
849 os <<
"\t\t\t<sourceFile>\n"
850 <<
"\t\t\t\t<nameOfFile>" << cexp_->getSourceFiles()[0].getNameOfFile() <<
"</nameOfFile>\n"
851 <<
"\t\t\t\t<pathToFile>" << cexp_->getSourceFiles()[0].getPathToFile() <<
"</pathToFile>\n";
852 if (cexp_->getSourceFiles()[0].getFileType() !=
"")
853 os <<
"\t\t\t\t<fileType>" << cexp_->getSourceFiles()[0].getFileType() <<
"</fileType>\n";
854 os <<
"\t\t\t</sourceFile>\n";
856 if (cexp_->getSourceFiles().size() > 1)
858 warning(STORE,
"The MzData format can store only one source file. Only the first one is stored!");
861 for (
Size i = 0; i < cexp_->getContacts().size(); ++i)
863 os <<
"\t\t\t<contact>\n"
864 <<
"\t\t\t\t<name>" << cexp_->getContacts()[i].getFirstName() <<
" " << cexp_->getContacts()[i].getLastName() <<
"</name>\n"
865 <<
"\t\t\t\t<institution>" << cexp_->getContacts()[i].getInstitution() <<
"</institution>\n";
866 if (cexp_->getContacts()[i].getContactInfo() !=
"")
867 os <<
"\t\t\t\t<contactInfo>" << cexp_->getContacts()[i].getContactInfo() <<
"</contactInfo>\n";
868 os <<
"\t\t\t</contact>\n";
871 if (cexp_->getContacts().empty())
873 os <<
"\t\t\t<contact>\n"
874 <<
"\t\t\t\t<name></name>\n"
875 <<
"\t\t\t\t<institution></institution>\n";
876 os <<
"\t\t\t</contact>\n";
879 os <<
"\t\t</admin>\n";
880 const Instrument & inst = cexp_->getInstrument();
881 os <<
"\t\t<instrument>\n"
882 <<
"\t\t\t<instrumentName>" << inst.
getName() <<
"</instrumentName>\n"
883 <<
"\t\t\t<source>\n";
886 writeCVS_(os, inst.
getIonSources()[0].getInletType(), 11,
"1000007",
"InletType");
887 writeCVS_(os, inst.
getIonSources()[0].getIonizationMethod(), 10,
"1000008",
"IonizationType");
888 writeCVS_(os, inst.
getIonSources()[0].getPolarity(), 1,
"1000009",
"IonizationMode");
893 warning(STORE,
"The MzData format can store only one ion source. Only the first one is stored!");
895 os <<
"\t\t\t</source>\n";
900 os <<
"\t\t\t<analyzerList count=\"1\">\n"
901 <<
"\t\t\t\t<analyzer>\n"
902 <<
"\t\t\t\t</analyzer>\n";
906 os <<
"\t\t\t<analyzerList count=\"" << inst.
getMassAnalyzers().size() <<
"\">\n";
909 os <<
"\t\t\t\t<analyzer>\n";
911 writeCVS_(os, ana.
getType(), 14,
"1000010",
"AnalyzerType", 5);
912 writeCVS_(os, ana.
getResolution(),
"1000011",
"MassResolution", 5);
915 writeCVS_(os, ana.
getAccuracy(),
"1000014",
"Accuracy", 5);
916 writeCVS_(os, ana.
getScanRate(),
"1000015",
"ScanRate", 5);
917 writeCVS_(os, ana.
getScanTime(),
"1000016",
"ScanTime", 5);
919 writeCVS_(os, ana.
getScanLaw(), 6,
"1000019",
"ScanLaw", 5);
925 writeUserParam_(os, ana, 5);
926 os <<
"\t\t\t\t</analyzer>\n";
929 os <<
"\t\t\t</analyzerList>\n";
931 os <<
"\t\t\t<detector>\n";
934 writeCVS_(os, inst.
getIonDetectors()[0].getType(), 13,
"1000026",
"DetectorType");
935 writeCVS_(os, inst.
getIonDetectors()[0].getAcquisitionMode(), 9,
"1000027",
"DetectorAcquisitionMode");
936 writeCVS_(os, inst.
getIonDetectors()[0].getResolution(),
"1000028",
"DetectorResolution");
937 writeCVS_(os, inst.
getIonDetectors()[0].getADCSamplingFrequency(),
"1000029",
"SamplingFrequency");
942 warning(STORE,
"The MzData format can store only one ion detector. Only the first one is stored!");
944 os <<
"\t\t\t</detector>\n";
947 os <<
"\t\t\t<additional>\n";
948 writeCVS_(os, inst.
getVendor(),
"1000030",
"Vendor");
949 writeCVS_(os, inst.
getModel(),
"1000031",
"Model");
951 writeUserParam_(os, inst);
952 os <<
"\t\t\t</additional>\n";
954 os <<
"\t\t</instrument>\n";
957 if (cexp_->size() == 0 || (*cexp_)[0].getDataProcessing().empty())
959 os <<
"\t\t<dataProcessing>\n"
960 <<
"\t\t\t<software>\n"
961 <<
"\t\t\t\t<name></name>\n"
962 <<
"\t\t\t\t<version></version>\n"
963 <<
"\t\t\t</software>\n"
964 <<
"\t\t</dataProcessing>\n";
968 const DataProcessing & data_processing = (*cexp_)[0].getDataProcessing()[0];
969 os <<
"\t\t<dataProcessing>\n"
970 <<
"\t\t\t<software";
973 os <<
" completionTime=\"" << data_processing.
getCompletionTime().
get().substitute(
' ',
'T') <<
"\"";
978 os <<
"\t\t\t</software>\n"
979 <<
"\t\t\t<processingMethod>\n";
982 os <<
"\t\t\t\t<cvParam cvLabel=\"psi\" name=\"Deisotoping\" accession=\"PSI:1000033\" />\n";
986 os <<
"\t\t\t\t<cvParam cvLabel=\"psi\" name=\"ChargeDeconvolution\" accession=\"PSI:1000034\" />\n";
990 os <<
"\t\t\t\t<cvParam cvLabel=\"psi\" name=\"Centroid Mass Spectrum\" accession=\"PSI:1000127\"/>\n";
992 writeUserParam_(os, data_processing);
993 os <<
"\t\t\t</processingMethod>\n"
994 <<
"\t\t</dataProcessing>\n";
996 os <<
"\t</description>\n";
1000 if (cexp_->size() != 0)
1004 bool all_numbers =
true;
1005 bool all_empty =
true;
1006 bool all_prefixed_numbers =
true;
1007 for (
Size s = 0; s < cexp_->size(); s++)
1009 String native_id = (*cexp_)[s].getNativeID();
1012 all_prefixed_numbers =
false;
1016 native_id = native_id.
substr(9);
1024 all_numbers =
false;
1025 all_prefixed_numbers =
false;
1026 if (native_id !=
"")
1033 if (!all_numbers && !all_empty)
1035 warning(STORE,
"Not all spectrum native IDs are numbers or correctly prefixed with 'spectrum='. The spectra are renumbered and the native IDs are lost!");
1040 os <<
"\t<spectrumList count=\"" << cexp_->size() <<
"\">\n";
1041 for (
Size s = 0; s < cexp_->size(); ++s)
1043 logger_.setProgress(s);
1046 Size spectrum_id = s + 1;
1047 if (all_prefixed_numbers)
1051 else if (all_numbers)
1055 os <<
"\t\t<spectrum id=\"" << spectrum_id <<
"\">\n"
1056 <<
"\t\t\t<spectrumDesc>\n"
1057 <<
"\t\t\t\t<spectrumSettings>\n";
1061 os <<
"\t\t\t\t\t<acqSpecification spectrumType=\"";
1072 warning(STORE,
"Spectrum type is unknown, assuming 'discrete'");
1091 warning(STORE,
String(
"Could not convert acquisition identifier '") + ac.
getIdentifier() +
"' to an integer. Using '0' instead!");
1094 os <<
"\t\t\t\t\t\t<acquisition acqNumber=\"" << acq_number <<
"\">\n";
1095 writeUserParam_(os, ac, 7);
1096 os <<
"\t\t\t\t\t\t</acquisition>\n";
1098 os <<
"\t\t\t\t\t</acqSpecification>\n";
1102 os <<
"\t\t\t\t\t<spectrumInstrument msLevel=\"" << spec.
getMSLevel() <<
"\"";
1111 warning(STORE,
"The MzData format can store only one scan window for each scan. Only the first one is stored!");
1127 os <<
"\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000036\" name=\"ScanMode\" value=\"Zoom\"/>\n";
1131 os <<
"\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000036\" name=\"ScanMode\" value=\"MassScan\"/>\n";
1136 os <<
"\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000036\" name=\"ScanMode\" value=\"SelectedIonDetection\"/>\n";
1140 os <<
"\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000036\" name=\"ScanMode\" value=\"SelectedReactionMonitoring\"/>\n";
1144 os <<
"\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000036\" name=\"ScanMode\" value=\"ConsecutiveReactionMonitoring\"/>\n";
1148 os <<
"\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000036\" name=\"ScanMode\" value=\"ConstantNeutralGainScan\"/>\n";
1152 os <<
"\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000036\" name=\"ScanMode\" value=\"ConstantNeutralLossScan\"/>\n";
1156 os <<
"\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000036\" name=\"ScanMode\" value=\"PrecursorIonScan\"/>\n";
1160 os <<
"\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000036\" name=\"ScanMode\" value=\"PhotodiodeArrayDetector\"/>\n";
1164 os <<
"\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000036\" name=\"ScanMode\" value=\"EnhancedMultiplyChargedScan\"/>\n";
1168 os <<
"\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000036\" name=\"ScanMode\" value=\"TimeDelayedFragmentationScan\"/>\n";
1172 os <<
"\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000036\" name=\"ScanMode\" value=\"MassScan\"/>\n";
1179 os <<
String(6,
'\t') <<
"<cvParam cvLabel=\"psi\" accession=\"PSI:1000037\" name=\"Polarity\" value=\"Positive\"/>\n";
1183 os <<
String(6,
'\t') <<
"<cvParam cvLabel=\"psi\" accession=\"PSI:1000037\" name=\"Polarity\" value=\"Negative\"/>\n";
1187 writeCVS_(os, spec.
getRT(),
"1000039",
"TimeInSeconds", 6);
1189 os <<
"\t\t\t\t\t</spectrumInstrument>\n\t\t\t\t</spectrumSettings>\n";
1195 if (level_id.
has(precursor_ms_level))
1197 precursor_id = level_id[precursor_ms_level];
1199 os <<
"\t\t\t\t<precursorList count=\"" << spec.
getPrecursors().size() <<
"\">\n";
1203 os <<
"\t\t\t\t\t<precursor msLevel=\"" << precursor_ms_level <<
"\" spectrumRef=\"" << precursor_id <<
"\">\n";
1204 os <<
"\t\t\t\t\t\t<ionSelection>\n";
1207 writeCVS_(os, precursor.
getMZ(),
"1000040",
"MassToChargeRatio", 7);
1208 writeCVS_(os, precursor.
getCharge(),
"1000041",
"ChargeState", 7);
1209 writeCVS_(os, precursor.
getIntensity(),
"1000042",
"Intensity", 7);
1210 os <<
"\t\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000043\" name=\"IntensityUnit\" value=\"NumberOfCounts\"/>\n";
1211 writeUserParam_(os, precursor, 7);
1213 os <<
"\t\t\t\t\t\t</ionSelection>\n";
1214 os <<
"\t\t\t\t\t\t<activation>\n";
1219 writeCVS_(os, *(precursor.
getActivationMethods().begin()), 18,
"1000044",
"ActivationMethod", 7);
1222 os <<
"\t\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000046\" name=\"EnergyUnit\" value=\"eV\"/>\n";
1224 os <<
"\t\t\t\t\t\t</activation>\n";
1225 os <<
"\t\t\t\t\t</precursor>\n";
1227 os <<
"\t\t\t\t</precursorList>\n";
1229 os <<
"\t\t\t</spectrumDesc>\n";
1232 if (options_.getWriteSupplementalData())
1238 os <<
"\t\t\t<supDesc supDataArrayRef=\"" << (i + 1) <<
"\">\n";
1241 os <<
"\t\t\t\t<supDataDesc>\n";
1242 writeUserParam_(os, desc, 5);
1243 os <<
"\t\t\t\t</supDataDesc>\n";
1245 os <<
"\t\t\t</supDesc>\n";
1250 data_to_encode_.clear();
1251 for (
Size i = 0; i < spec.size(); i++)
1253 data_to_encode_.push_back(spec[i].getPosition()[0]);
1256 writeBinary_(os, spec.size(),
"mzArrayBinary");
1259 data_to_encode_.clear();
1260 for (
Size i = 0; i < spec.size(); i++)
1262 data_to_encode_.push_back(spec[i].getIntensity());
1265 writeBinary_(os, spec.size(),
"intenArrayBinary");
1268 if (options_.getWriteSupplementalData())
1273 const typename MapType::SpectrumType::FloatDataArray & mda = spec.
getFloatDataArrays()[i];
1275 if (mda.size() != spec.size())
1277 error(LOAD,
String(
"Length of meta data array (index:'") + i +
"' name:'" + mda.getName() +
"') differs from spectrum length. meta data array: " + mda.size() +
" / spectrum: " + spec.size() +
" .");
1280 data_to_encode_.clear();
1281 for (
Size j = 0; j < mda.size(); j++)
1283 data_to_encode_.push_back(mda[j]);
1286 writeBinary_(os, mda.size(),
"supDataArrayBinary", mda.getName(), i + 1);
1290 os <<
"\t\t</spectrum>\n";
1295 os <<
"\t<spectrumList count=\"1\">\n";
1296 os <<
"\t\t<spectrum id=\"1\">\n";
1297 os <<
"\t\t\t<spectrumDesc>\n";
1298 os <<
"\t\t\t\t<spectrumSettings>\n";
1299 os <<
"\t\t\t\t\t<spectrumInstrument msLevel=\"1\"/>\n";
1300 os <<
"\t\t\t\t</spectrumSettings>\n";
1301 os <<
"\t\t\t</spectrumDesc>\n";
1302 os <<
"\t\t\t<mzArrayBinary>\n";
1303 os <<
"\t\t\t\t<data length=\"0\" endian=\"little\" precision=\"32\"></data>\n";
1304 os <<
"\t\t\t</mzArrayBinary>\n";
1305 os <<
"\t\t\t<intenArrayBinary>\n";
1306 os <<
"\t\t\t\t<data length=\"0\" endian=\"little\" precision=\"32\"></data>\n";
1307 os <<
"\t\t\t</intenArrayBinary>\n";
1308 os <<
"\t\t</spectrum>\n";
1310 os <<
"\t</spectrumList>\n</mzData>\n";
1312 logger_.endProgress();
1315 template <
typename MapType>
1322 if (open_tags_.size() > 1)
1323 parent_tag = *(open_tags_.end() - 2);
1325 if (parent_tag ==
"spectrumInstrument")
1327 if (accession ==
"PSI:1000036")
1329 if (value ==
"Zoom")
1331 spec_.getInstrumentSettings().setZoomScan(
true);
1334 else if (value ==
"MassScan")
1338 else if (value ==
"SelectedIonDetection")
1342 else if (value ==
"SelectedReactionMonitoring")
1346 else if (value ==
"ConsecutiveReactionMonitoring")
1350 else if (value ==
"ConstantNeutralGainScan")
1354 else if (value ==
"ConstantNeutralLossScan")
1358 else if (value ==
"ProductIonScan")
1361 spec_.setMSLevel(2);
1363 else if (value ==
"PrecursorIonScan")
1367 else if (value ==
"EnhancedResolutionScan")
1369 spec_.getInstrumentSettings().setZoomScan(
true);
1374 if (spec_.getMSLevel() >= 2)
1381 warning(LOAD,
String(
"Unknown scan mode '") + value +
"'. Assuming full scan");
1385 else if (accession ==
"PSI:1000038")
1387 spec_.setRT(asDouble_(value) * 60);
1388 if (options_.hasRTRange() && !options_.getRTRange().encloses(
DPosition<1>(spec_.getRT())))
1390 skip_spectrum_ =
true;
1393 else if (accession ==
"PSI:1000039")
1395 spec_.setRT(asDouble_(value));
1396 if (options_.hasRTRange() && !options_.getRTRange().encloses(
DPosition<1>(spec_.getRT())))
1398 skip_spectrum_ =
true;
1401 else if (accession ==
"PSI:1000037")
1403 if (value ==
"Positive" || value ==
"positive" || value ==
"+")
1407 else if (value ==
"Negative" || value ==
"negative" || value ==
"-")
1413 warning(LOAD,
String(
"Invalid scan polarity (PSI:1000037) detected: \"") + value +
"\". Valid are 'Positive' or 'Negative'.");
1418 error =
"SpectrumDescription.SpectrumSettings.SpectrumInstrument";
1421 else if (parent_tag ==
"ionSelection")
1423 if (accession ==
"PSI:1000040")
1425 spec_.getPrecursors().back().setMZ(asDouble_(value));
1427 else if (accession ==
"PSI:1000041")
1429 if (spec_.getPrecursors().back().getCharge() != 0)
1431 warning(LOAD,
String(
"Multiple precursor charges detected, expected only one! Ignoring this charge settings! accession=\"") + accession +
"\", value=\"" + value +
"\"");
1432 spec_.getPrecursors().back().setCharge(0);
1436 spec_.getPrecursors().back().setCharge(asInt_(value));
1439 else if (accession ==
"PSI:1000042")
1441 spec_.getPrecursors().back().setIntensity(asDouble_(value));
1443 else if (accession ==
"PSI:1000043")
1449 error =
"PrecursorList.Precursor.IonSelection.UserParam";
1452 else if (parent_tag ==
"activation")
1454 if (accession ==
"PSI:1000044")
1456 spec_.getPrecursors().back().getActivationMethods().insert((
Precursor::ActivationMethod)cvStringToEnum_(18, value,
"activation method"));
1458 else if (accession ==
"PSI:1000045")
1460 spec_.getPrecursors().back().setActivationEnergy(asDouble_(value));
1462 else if (accession ==
"PSI:1000046")
1468 error =
"PrecursorList.Precursor.Activation.UserParam";
1471 else if (parent_tag ==
"supDataDesc")
1474 error =
"supDataDesc.UserParam";
1476 else if (parent_tag ==
"acquisition")
1479 error =
"spectrumDesc.spectrumSettings.acquisitionSpecification.acquisition.UserParam";
1481 else if (parent_tag ==
"detector")
1483 if (accession ==
"PSI:1000026")
1485 exp_->getInstrument().getIonDetectors().back().setType((
IonDetector::Type)cvStringToEnum_(13, value,
"detector type"));
1487 else if (accession ==
"PSI:1000028")
1489 exp_->getInstrument().getIonDetectors().back().setResolution(asDouble_(value));
1491 else if (accession ==
"PSI:1000029")
1493 exp_->getInstrument().getIonDetectors().back().setADCSamplingFrequency(asDouble_(value));
1495 else if (accession ==
"PSI:1000027")
1497 exp_->getInstrument().getIonDetectors().back().setAcquisitionMode((
IonDetector::AcquisitionMode)cvStringToEnum_(9, value,
"acquisition mode"));
1501 error =
"Description.Instrument.Detector.UserParam";
1504 else if (parent_tag ==
"source")
1506 if (accession ==
"PSI:1000008")
1508 exp_->getInstrument().getIonSources().back().setIonizationMethod((
IonSource::IonizationMethod)cvStringToEnum_(10, value,
"ion source"));
1510 else if (accession ==
"PSI:1000007")
1512 exp_->getInstrument().getIonSources().back().setInletType((
IonSource::InletType)cvStringToEnum_(11, value,
"inlet type"));
1514 else if (accession ==
"PSI:1000009")
1516 exp_->getInstrument().getIonSources().back().setPolarity((
IonSource::Polarity)cvStringToEnum_(1, value,
"polarity"));
1520 error =
"Description.Instrument.Source.UserParam";
1523 else if (parent_tag ==
"sampleDescription")
1525 if (accession ==
"PSI:1000001")
1527 exp_->getSample().setNumber(value);
1529 else if (accession ==
"PSI:1000003")
1531 exp_->getSample().setState((
Sample::SampleState)cvStringToEnum_(0, value,
"sample state"));
1533 else if (accession ==
"PSI:1000004")
1535 exp_->getSample().setMass(asDouble_(value));
1537 else if (accession ==
"PSI:1000005")
1539 exp_->getSample().setVolume(asDouble_(value));
1541 else if (accession ==
"PSI:1000006")
1543 exp_->getSample().setConcentration(asDouble_(value));
1547 error =
"Description.Admin.SampleDescription.UserParam";
1550 else if (parent_tag ==
"analyzer")
1552 if (accession ==
"PSI:1000010")
1554 exp_->getInstrument().getMassAnalyzers().back().setType((
MassAnalyzer::AnalyzerType)cvStringToEnum_(14, value,
"analyzer type"));
1556 else if (accession ==
"PSI:1000011")
1558 exp_->getInstrument().getMassAnalyzers().back().setResolution(asDouble_(value));
1560 else if (accession ==
"PSI:1000012")
1562 exp_->getInstrument().getMassAnalyzers().back().setResolutionMethod((
MassAnalyzer::ResolutionMethod)cvStringToEnum_(2, value,
"resolution method"));
1564 else if (accession ==
"PSI:1000013")
1566 exp_->getInstrument().getMassAnalyzers().back().setResolutionType((
MassAnalyzer::ResolutionType)cvStringToEnum_(3, value,
"resolution type"));
1568 else if (accession ==
"PSI:1000014")
1570 exp_->getInstrument().getMassAnalyzers().back().setAccuracy(asDouble_(value));
1572 else if (accession ==
"PSI:1000015")
1574 exp_->getInstrument().getMassAnalyzers().back().setScanRate(asDouble_(value));
1576 else if (accession ==
"PSI:1000016")
1578 exp_->getInstrument().getMassAnalyzers().back().setScanTime(asDouble_(value));
1580 else if (accession ==
"PSI:1000018")
1582 exp_->getInstrument().getMassAnalyzers().back().setScanDirection((
MassAnalyzer::ScanDirection)cvStringToEnum_(5, value,
"scan direction"));
1584 else if (accession ==
"PSI:1000019")
1586 exp_->getInstrument().getMassAnalyzers().back().setScanLaw((
MassAnalyzer::ScanLaw)cvStringToEnum_(6, value,
"scan law"));
1588 else if (accession ==
"PSI:1000020")
1592 else if (accession ==
"PSI:1000021")
1594 exp_->getInstrument().getMassAnalyzers().back().setReflectronState((
MassAnalyzer::ReflectronState)cvStringToEnum_(8, value,
"reflectron state"));
1596 else if (accession ==
"PSI:1000022")
1598 exp_->getInstrument().getMassAnalyzers().back().setTOFTotalPathLength(asDouble_(value));
1600 else if (accession ==
"PSI:1000023")
1602 exp_->getInstrument().getMassAnalyzers().back().setIsolationWidth(asDouble_(value));
1604 else if (accession ==
"PSI:1000024")
1606 exp_->getInstrument().getMassAnalyzers().back().setFinalMSExponent(asInt_(value));
1608 else if (accession ==
"PSI:1000025")
1610 exp_->getInstrument().getMassAnalyzers().back().setMagneticFieldStrength(asDouble_(value));
1612 else if (accession ==
"PSI:1000017")
1618 error =
"AnalyzerList.Analyzer.UserParam";
1621 else if (parent_tag ==
"additional")
1623 if (accession ==
"PSI:1000030")
1625 exp_->getInstrument().setVendor(value);
1627 else if (accession ==
"PSI:1000031")
1629 exp_->getInstrument().setModel(value);
1631 else if (accession ==
"PSI:1000032")
1633 exp_->getInstrument().setCustomizations(value);
1637 error =
"Description.Instrument.Additional";
1640 else if (parent_tag ==
"processingMethod")
1642 if (accession ==
"PSI:1000033")
1646 else if (accession ==
"PSI:1000034")
1650 else if (accession ==
"PSI:1000127")
1654 else if (accession ==
"PSI:1000035")
1660 error =
"DataProcessing.DataProcessing.UserParam";
1665 warning(LOAD,
String(
"Unexpected cvParam: accession=\"") + accession +
"\" value=\"" + value +
"\" in tag " + parent_tag);
1670 warning(LOAD,
String(
"Invalid cvParam: accession=\"") + accession +
"\" value=\"" + value +
"\" in " + error);
Description of the applied preprocessing steps.
Definition: DataProcessing.h:51
const String & getCustomizations() const
returns a description of customizations
double getIsolationWidth() const
returns the isolation width i.e. in which m/z range the precursor ion is selected for MS to the n (in...
Big endian type.
Definition: Base64.h:78
Description of a MS instrument.
Definition: Instrument.h:64
XML handler for MzDataFile.
Definition: MzDataHandler.h:60
Description of the settings a MS Instrument was run with.
Definition: InstrumentSettings.h:48
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 ProgressLogger & logger_
Progress logger.
Definition: MzDataHandler.h:204
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
UInt getMSLevel() const
Returns the MS level.
Definition: MSSpectrum.h:259
void setOptions(const PeakFileOptions &options)
Sets the options.
Definition: MzDataHandler.h:115
void writeCVS_(std::ostream &os, UInt value, UInt map, const String &acc, const String &name, UInt indent=4)
write cvParam element to stream
Definition: MzDataHandler.h:262
IntensityType getIntensity() const
Definition: Peak1D.h:109
ScanDirection getScanDirection() const
returns the direction of scanning
bool skip_spectrum_
Flag that indicates whether this spectrum should be skipped (due to options)
Definition: MzDataHandler.h:201
std::vector< std::pair< String, MetaInfoDescription > > meta_id_descs_
An array of pairs MetaInfodescriptions and their ids.
Definition: MzDataHandler.h:186
bool has(const Key &key) const
Test whether the map contains the given key.
Definition: Map.h:109
const std::set< ProcessingAction > & getProcessingActions() const
returns a const reference to the applied processing actions
double getMass() const
returns the mass (in gram) (default: 0.0)
std::vector< String > data_to_decode_
encoded data which is read and has to be decoded
Definition: MzDataHandler.h:188
virtual void characters(const XMLCh *const chars, const XMLSize_t length)
Parsing method for character data.
Definition: MzDataHandler.h:338
DataProcessing data_processing_
Definition: MzDataHandler.h:331
const std::vector< MassAnalyzer > & getMassAnalyzers() const
returns a const reference to the mass analyzer list
const AcquisitionInfo & getAcquisitionInfo() const
returns a const reference to the acquisition info
void writeBinary_(std::ostream &os, Size size, const String &tag, const String &name="", SignedSize id=-1)
write binary data to stream (first one)
Definition: MzDataHandler.h:308
CoordinateType getMZ() const
Non-mutable access to m/z.
Definition: Peak1D.h:114
AnalyzerType getType() const
returns the analyzer type
Int getCharge() const
Non-mutable access to the charge.
Base class for XML handlers.
Definition: XMLHandler.h:99
Base64 decoder_
Decoder/Encoder for Base64-data in MzData.
Definition: MzDataHandler.h:198
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:128
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
void writeCVS_(std::ostream &os, const String &value, const String &acc, const String &name, UInt indent=4) const
write cvParam containing strings to stream
Definition: MzDataHandler.h:241
double begin
Begin of the window.
Definition: ScanWindow.h:62
double getAccuracy() const
returns the mass accuracy i.e. how much the theoretical mass may differ from the measured mass (in pp...
XMLHandler()
Not implemented.
Little endian type.
Definition: Base64.h:79
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
void setMZ(CoordinateType mz)
Mutable access to m/z.
Definition: Peak1D.h:120
void setIntensity(IntensityType intensity)
Mutable access to the data point intensity (height)
Definition: Peak1D.h:111
void init_()
Definition: MzDataHandler.h:121
double getResolution() const
returns the resolution
PeakFileOptions options_
Options that can be set for loading/storing.
Definition: MzDataHandler.h:177
std::vector< std::vector< double > > decoded_double_list_
Definition: MzDataHandler.h:192
double getActivationEnergy() const
returns the activation energy (in electronvolt)
SpectrumType getType() const
returns the spectrum type
const String & getIdentifier() const
return the identifier/index/number of the acquisition
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
void writeUserParam_(std::ostream &os, const MetaInfoInterface &meta, UInt indent=4)
Writing the MetaInfo as UserParam to the file.
Definition: MzDataHandler.h:280
ScanLaw getScanLaw() const
returns the scan law
MSExperiment< Peak1D > MapType
Definition: PeakPickerIterative.cpp:87
void get(UInt &month, UInt &day, UInt &year, UInt &hour, UInt &minute, UInt &second) const
Fills the arguments with the date and the time.
double getMagneticFieldStrength() const
returns the strength of the magnetic field (in T)
virtual void startElement(const XMLCh *const , const XMLCh *const , const XMLCh *const qname, const xercesc::Attributes &attributes)
Parsing method for opening tags.
Definition: MzDataHandler.h:436
Int toInt() const
Conversion to int.
const std::vector< ScanWindow > & getScanWindows() const
returns a const reference to the m/z scan windows
std::vector< String > precisions_
Definition: MzDataHandler.h:193
ResolutionMethod getResolutionMethod() const
returns the method used for determination of the resolution
void fillData_()
fills the current spectrum with peaks and meta data
Definition: MzDataHandler.h:722
MapType * exp_
map pointer for reading
Definition: MzDataHandler.h:172
Storing a file.
Definition: XMLHandler.h:119
MSSpectrum< PeakType > SpectrumType
Spectrum type.
Definition: MzDataHandler.h:169
const String & getModel() const
returns the instrument model
String & trim()
removes whitespaces (space, tab, line feed, carriage return) at the beginning and the end of the stri...
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
const String & getVendor() const
returns the instrument vendor
ReflectronState getReflectronState() const
returns the reflectron state (for TOF)
MzDataHandler(const MapType &exp, const String &filename, const String &version, const ProgressLogger &logger)
Constructor for a read-only handler.
Definition: MzDataHandler.h:81
void writeCVS_(std::ostream &os, double value, const String &acc, const String &name, UInt indent=4) const
write cvParam containing strings to stream
Definition: MzDataHandler.h:222
MapType::PeakType PeakType
Peak type.
Definition: MzDataHandler.h:167
Meta information about the sample.
Definition: Sample.h:60
Information about one raw data spectrum that was combined with several other raw data spectra...
Definition: Acquisition.h:50
const MapType * cexp_
map pointer for writing
Definition: MzDataHandler.h:174
const Software & getSoftware() const
returns a const reference to the software used for processing
virtual ~MzDataHandler()
Destructor.
Definition: MzDataHandler.h:95
const String & getName() const
returns the name of the software
Invalid conversion exception.
Definition: Exception.h:363
MzDataHandler(MapType &exp, const String &filename, const String &version, ProgressLogger &logger)
Constructor for a write-only handler.
Definition: MzDataHandler.h:67
double end
End of the window.
Definition: ScanWindow.h:64
std::vector< String > endians_
Definition: MzDataHandler.h:194
UInt peak_count_
The number of peaks in the current spectrum.
Definition: MzDataHandler.h:182
const String & getVersion() const
returns the software version
const DateTime & getCompletionTime() const
returns the time of completion of the processing
IonSource::Polarity getPolarity() const
returns the polarity
SpectrumType spec_
The current spectrum.
Definition: MzDataHandler.h:184
std::vector< float > data_to_encode_
floating point numbers which have to be encoded and written
Definition: MzDataHandler.h:190
double getScanTime() const
returns the scan time for a single scan (in s)
const String & getMethodOfCombination() const
returns the method of combination
DateTime Class.
Definition: DateTime.h:55
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:55
const String & getName() const
returns the name of the instrument
Int getFinalMSExponent() const
returns the final MS exponent
String substr(size_t pos=0, size_t n=npos) const
Wrapper for the STL substr() method. Returns a String object with its contents initialized to a subst...
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:207
const InstrumentSettings & getInstrumentSettings() const
returns a const reference to the instrument settings of the current spectrum
double getScanRate() const
returns the scan rate (in s)
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
Options for loading files containing peak data.
Definition: PeakFileOptions.h:48
std::vector< std::vector< String > > cv_terms_
Array of CV term lists (one sublist denotes one term and it's children)
Definition: XMLHandler.h:220
const FloatDataArrays & getFloatDataArrays() const
Returns a const reference to the float meta data arrays.
Definition: MSSpectrum.h:298
static const std::string NamesOfScanMode[SIZE_OF_SCANMODE]
Names of scan modes.
Definition: InstrumentSettings.h:74
const String & getNativeID() const
returns the native identifier for the spectrum, used by the acquisition software. ...
int Int
Signed integer type.
Definition: Types.h:96
virtual void endElement(const XMLCh *const , const XMLCh *const , const XMLCh *const qname)
Parsing method for closing tags.
Definition: MzDataHandler.h:686
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
bool split(const char splitter, std::vector< String > &substrings, bool quote_protect=false) const
Splits a string into substrings using splitter as delimiter.
const String & getName() const
returns the sample name (default: "")
void cvParam_(const String &name, const String &value)
read attributes of MzData's cvParamType
Definition: MzDataHandler.h:1316
std::vector< std::vector< float > > decoded_list_
Definition: MzDataHandler.h:191
ResolutionType getResolutionType() const
returns the resolution type
double getConcentration() const
returns the concentration (in g/l) (default: 0.0)
SampleState getState() const
returns the state of aggregation (default: SAMPLENULL)
void writeTo(std::ostream &os)
Writes the contents to a stream.
Definition: MzDataHandler.h:816
bool hasPrefix(const String &string) const
true if String begins with string, false otherwise
double getVolume() const
returns the volume (in ml) (default: 0.0)