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>
355 if (current_tag ==
"sampleName")
359 else if (current_tag ==
"instrumentName")
363 else if (current_tag ==
"version")
367 else if (current_tag ==
"institution")
371 else if (current_tag ==
"contactInfo")
375 else if (current_tag ==
"name" && parent_tag ==
"contact")
379 else if (current_tag ==
"name" && parent_tag ==
"software")
383 else if (current_tag ==
"comments" && parent_tag ==
"software")
387 else if (current_tag ==
"comments" && parent_tag ==
"spectrumDesc")
391 else if (current_tag ==
"data")
396 else if (current_tag ==
"arrayName" && parent_tag ==
"supDataArrayBinary")
400 else if (current_tag ==
"nameOfFile" && parent_tag ==
"sourceFile")
404 else if (current_tag ==
"nameOfFile" && parent_tag ==
"supSourceFile")
408 else if (current_tag ==
"pathToFile" && parent_tag ==
"sourceFile")
412 else if (current_tag ==
"pathToFile" && parent_tag ==
"supSourceFile")
416 else if (current_tag ==
"fileType" && parent_tag ==
"sourceFile")
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");
471 if (tag ==
"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)
499 else if (tag ==
"precursor")
503 else if (tag ==
"cvParam")
510 else if (tag ==
"supDataDesc")
518 else if (tag ==
"userParam")
524 if (parent_tag ==
"spectrumInstrument")
528 else if (parent_tag ==
"acquisition")
532 else if (parent_tag ==
"ionSelection")
536 else if (parent_tag ==
"activation")
540 else if (parent_tag ==
"supDataDesc")
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")
570 warning(
LOAD,
"Invalid userParam: name=\"" + name +
", value=\"" + value +
"\"");
573 else if (tag ==
"supDataArrayBinary")
577 typename MapType::SpectrumType::FloatDataArray mda;
591 else if (tag ==
"spectrum")
597 else if (tag ==
"spectrumList")
603 exp_->reserve(count);
607 else if (tag ==
"mzData")
612 else if (tag ==
"acqSpecification")
615 if (tmp_type ==
"discrete")
619 else if (tmp_type ==
"continuous")
631 else if (tag ==
"acquisition")
636 else if (tag ==
"spectrumInstrument" || tag ==
"acqInstrument")
642 if (window.
begin != 0.0 || window.
end != 0.0)
652 else if (tag ==
"supDesc")
656 else if (tag ==
"data")
663 if (parent_tag ==
"mzArrayBinary")
669 else if (tag ==
"mzArrayBinary")
673 else if (tag ==
"intenArrayBinary")
677 else if (tag ==
"arrayName" && parent_tag ==
"supDataArrayBinary")
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");
696 if (
equal_(qname, s_spectrum))
712 else if (
equal_(qname, s_mzdata))
721 template <
typename MapType>
724 std::vector<float> decoded;
725 std::vector<double> decoded_double;
776 bool mz_precision_64 =
true;
779 mz_precision_64 =
false;
781 bool int_precision_64 =
true;
784 int_precision_64 =
false;
804 spec_.push_back(tmp);
815 template <
typename MapType>
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";
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";
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";
881 os <<
"\t\t<instrument>\n" 882 <<
"\t\t\t<instrumentName>" << inst.
getName() <<
"</instrumentName>\n" 883 <<
"\t\t\t<source>\n";
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";
926 os <<
"\t\t\t\t</analyzer>\n";
929 os <<
"\t\t\t</analyzerList>\n";
931 os <<
"\t\t\t<detector>\n";
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";
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";
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)
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'");
1094 os <<
"\t\t\t\t\t\t<acquisition acqNumber=\"" << acq_number <<
"\">\n";
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";
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);
1210 os <<
"\t\t\t\t\t\t\t<cvParam cvLabel=\"psi\" accession=\"PSI:1000043\" name=\"IntensityUnit\" value=\"NumberOfCounts\"/>\n";
1213 os <<
"\t\t\t\t\t\t</ionSelection>\n";
1214 os <<
"\t\t\t\t\t\t<activation>\n";
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";
1238 os <<
"\t\t\t<supDesc supDataArrayRef=\"" << (i + 1) <<
"\">\n";
1241 os <<
"\t\t\t\t<supDataDesc>\n";
1243 os <<
"\t\t\t\t</supDataDesc>\n";
1245 os <<
"\t\t\t</supDesc>\n";
1251 for (
Size i = 0; i < spec.size(); i++)
1260 for (
Size i = 0; i < spec.size(); i++)
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() +
" .");
1281 for (
Size j = 0; j < mda.size(); 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";
1315 template <
typename MapType>
1325 if (parent_tag ==
"spectrumInstrument")
1327 if (accession ==
"PSI:1000036")
1329 if (value ==
"Zoom")
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")
1363 else if (value ==
"PrecursorIonScan")
1367 else if (value ==
"EnhancedResolutionScan")
1385 else if (accession ==
"PSI:1000038")
1393 else if (accession ==
"PSI:1000039")
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")
1427 else if (accession ==
"PSI:1000041")
1431 warning(
LOAD,
String(
"Multiple precursor charges detected, expected only one! Ignoring this charge settings! accession=\"") + accession +
"\", value=\"" + value +
"\"");
1439 else if (accession ==
"PSI:1000042")
1443 else if (accession ==
"PSI:1000043")
1449 error =
"PrecursorList.Precursor.IonSelection.UserParam";
1452 else if (parent_tag ==
"activation")
1454 if (accession ==
"PSI:1000044")
1458 else if (accession ==
"PSI:1000045")
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")
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")
1501 error =
"Description.Instrument.Detector.UserParam";
1504 else if (parent_tag ==
"source")
1506 if (accession ==
"PSI:1000008")
1510 else if (accession ==
"PSI:1000007")
1514 else if (accession ==
"PSI:1000009")
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")
1533 else if (accession ==
"PSI:1000004")
1537 else if (accession ==
"PSI:1000005")
1541 else if (accession ==
"PSI:1000006")
1547 error =
"Description.Admin.SampleDescription.UserParam";
1550 else if (parent_tag ==
"analyzer")
1552 if (accession ==
"PSI:1000010")
1556 else if (accession ==
"PSI:1000011")
1558 exp_->getInstrument().getMassAnalyzers().back().setResolution(
asDouble_(value));
1560 else if (accession ==
"PSI:1000012")
1564 else if (accession ==
"PSI:1000013")
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")
1584 else if (accession ==
"PSI:1000019")
1588 else if (accession ==
"PSI:1000020")
1592 else if (accession ==
"PSI:1000021")
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);
Deisotoping.
Definition: DataProcessing.h:62
Description of the applied preprocessing steps.
Definition: DataProcessing.h:51
std::vector< String > open_tags_
Stack of open XML tags.
Definition: XMLHandler.h:200
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
bool hasMZRange() const
returns true if an MZ range has been set
bool getWriteSupplementalData() const
returns whether or not to write supplemental peak data in MzData files
bool optionalAttributeAsString_(String &value, const xercesc::Attributes &a, const char *name) const
Assigns the attribute content to the String value if the attribute is present.
Definition: XMLHandler.h:415
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
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
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
void setZoomScan(bool zoom_scan)
sets if this scan is a zoom (enhanced resolution) scan
bool hasIntensityRange() const
returns true if an intensity range has been set
IntensityType getIntensity() const
Definition: Peak1D.h:109
ScanDirection getScanDirection() const
returns the direction of scanning
AcquisitionMode
Acquisition mode.
Definition: IonDetector.h:82
SignedSize cvStringToEnum_(const Size section, const String &term, const char *message, const SignedSize result_on_error=0)
Definition: XMLHandler.h:224
Peak data (also called centroided data or stick data)
Definition: SpectrumSettings.h:74
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)
const DRange< 1 > & getIntensityRange() const
returns the intensity range
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
Negative polarity.
Definition: IonSource.h:144
bool hasMSLevels() const
returns true, if MS levels have been set
DataProcessing data_processing_
Definition: MzDataHandler.h:331
const std::vector< MassAnalyzer > & getMassAnalyzers() const
returns a const reference to the mass analyzer list
void clear()
Frees memory of all owned strings.
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
Enhanced multiply charged scan.
Definition: InstrumentSettings.h:65
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
void setScanMode(ScanMode scan_mode)
sets the scan mode
Positive polarity.
Definition: IonSource.h:143
void setComment(const String &comment)
sets the free-text comment
AnalyzerType getType() const
returns the analyzer type
void error(const xercesc::SAXParseException &exception)
Int getCharge() const
Non-mutable access to the charge.
Base class for XML handlers.
Definition: XMLHandler.h:99
DateTime asDateTime_(String date_string)
Conversion of a xs:datetime string to a DataTime value.
Definition: XMLHandler.h:340
void setPolarity(IonSource::Polarity polarity)
sets the polarity
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
Raw data (also called profile data)
Definition: SpectrumSettings.h:75
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.
Int attributeAsInt_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to a Int.
Definition: XMLHandler.h:374
Little endian type.
Definition: Base64.h:79
bool containsMSLevel(int level) const
returns true, if MS level level has been set
ScanDirection
direction of scanning
Definition: MassAnalyzer.h:103
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
MS2+ mass spectrum, is a "mass spectrum".
Definition: InstrumentSettings.h:58
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
InletType
inlet type
Definition: IonSource.h:52
Type
Detector type.
Definition: IonDetector.h:52
Unknown spectrum type.
Definition: SpectrumSettings.h:73
std::vector< std::vector< double > > decoded_double_list_
Definition: MzDataHandler.h:192
Selected reaction monitoring scan Synonyms: 'Multiple reaction monitoring scan', 'SRM scan', 'MRM scan'.
Definition: InstrumentSettings.h:60
ResolutionType
Resolution type.
Definition: MassAnalyzer.h:92
double getActivationEnergy() const
returns the activation energy (in electronvolt)
SpectrumType getType() const
returns the spectrum type
const std::vector< DataProcessing > & getDataProcessing() const
returns a const reference to the description of the applied processing
const String & getIdentifier() const
return the identifier/index/number of the acquisition
bool equal_(const XMLCh *a, const XMLCh *b) const
Returns if two xerces strings are equal.
Definition: XMLHandler.h:203
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.
ResolutionMethod
resolution method
Definition: MassAnalyzer.h:80
double getMagneticFieldStrength() const
returns the strength of the magnetic field (in T)
void setCompletionTime(const DateTime &completion_time)
sets the time of completion taking a DateTime object
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
void endProgress() const
Ends the progress display.
ResolutionMethod getResolutionMethod() const
returns the method used for determination of the resolution
const DRange< 1 > & getRTRange() const
returns the RT range
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...
XMLCh * convert(const char *str) const
Transcode the supplied C string to XMLCh* and take ownership of the XMLCh*.
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
void setMSLevel(UInt ms_level)
Sets the MS level.
Definition: MSSpectrum.h:265
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
ReflectronState
Reflectron state.
Definition: MassAnalyzer.h:126
full scan mass spectrum, is a "mass spectrum" Synonyms: 'full spectrum', 'Q1 spectrum', 'Q3 spectrum', 'Single-Stage Mass Spectrometry'
Definition: InstrumentSettings.h:57
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
char * attributeAsString_(const xercesc::Attributes &a, const char *name) const
Converts an attribute to a String.
Definition: XMLHandler.h:366
virtual ~MzDataHandler()
Destructor.
Definition: MzDataHandler.h:95
IonizationMethod
ionization method
Definition: IonSource.h:80
const String & getName() const
returns the name of the software
Selected ion monitoring scan Synonyms: 'Multiple ion monitoring scan', 'SIM scan', 'MIM scan'.
Definition: InstrumentSettings.h:59
Constant neutral loss scan Synonyms: 'CNG scan'.
Definition: InstrumentSettings.h:63
Time-delayed fragmentation scan.
Definition: InstrumentSettings.h:66
Invalid conversion exception.
Definition: Exception.h:363
void setRT(double rt)
Sets the absolute retention time (is seconds)
Definition: MSSpectrum.h:249
Loading a file.
Definition: XMLHandler.h:118
MzDataHandler(MapType &exp, const String &filename, const String &version, ProgressLogger &logger)
Constructor for a write-only handler.
Definition: MzDataHandler.h:67
void setVersion(const String &version)
sets the software version
double end
End of the window.
Definition: ScanWindow.h:64
double asDouble_(const String &in)
Conversion of a String to a double value.
Definition: XMLHandler.h:287
StringManager sm_
Helper class for string conversion.
Definition: XMLHandler.h:193
Consecutive reaction monitoring scan Synonyms: 'CRM scan'.
Definition: InstrumentSettings.h:61
void setType(SpectrumType type)
sets the spectrum type
std::vector< String > endians_
Definition: MzDataHandler.h:194
UInt peak_count_
The number of peaks in the current spectrum.
Definition: MzDataHandler.h:182
void setMethodOfCombination(const String &method_of_combination)
sets the method of combination
SampleState
state of aggregation of the sample
Definition: Sample.h:65
const String & getVersion() const
returns the software version
const DateTime & getCompletionTime() const
returns the time of completion of the processing
bool optionalAttributeAsDouble_(double &value, const xercesc::Attributes &a, const char *name) const
Assigns the attribute content to the double value if the attribute is present.
Definition: XMLHandler.h:463
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)
Int asInt_(const String &in)
Conversion of a String to an integer value.
Definition: XMLHandler.h:246
const String & getMethodOfCombination() const
returns the method of combination
Unknown scan method.
Definition: InstrumentSettings.h:55
Absorbtion scan.
Definition: InstrumentSettings.h:69
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
void startProgress(SignedSize begin, SignedSize end, const String &label) const
Initializes the progress display.
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
void setProgress(SignedSize value) const
Sets the current progress.
const InstrumentSettings & getInstrumentSettings() const
returns a const reference to the instrument settings of the current spectrum
Peak picking (conversion from raw to peak data)
Definition: DataProcessing.h:67
Precursor ion scan.
Definition: InstrumentSettings.h:64
void setNativeID(const String &native_id)
sets the native identifier for the spectrum, used by the acquisition software.
general spectrum type
Definition: InstrumentSettings.h:56
const DRange< 1 > & getMZRange() const
returns the MZ range
double getScanRate() const
returns the scan rate (in s)
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
Constant neutral gain scan Synonyms: 'CNG scan'.
Definition: InstrumentSettings.h:62
void setName(const String &name)
sets the name of the software
ActivationMethod
Method of activation.
Definition: Precursor.h:64
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
AnalyzerType
analyzer type
Definition: MassAnalyzer.h:53
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. ...
ScanLaw
Scan law.
Definition: MassAnalyzer.h:114
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: "")
Charge deconvolution.
Definition: DataProcessing.h:61
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
void decode(const String &in, ByteOrder from_byte_order, std::vector< ToType > &out, bool zlib_compression=false)
Decodes a Base64 string to a vector of floating point numbers.
Definition: Base64.h:334
Polarity
Polarity of the ion source.
Definition: IonSource.h:140
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)
bool getMetadataOnly() const
returns whether or not to load only meta data