MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / readRTMZCharge_

Method readRTMZCharge_

src/openms/source/FORMAT/PepXMLFile.cpp:923–962  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

921 }
922
923 void PepXMLFile::readRTMZCharge_(const xercesc::Attributes& attributes)
924 {
925 double mass = attributeAsDouble_(attributes, "precursor_neutral_mass");
926 charge_ = attributeAsInt_(attributes, "assumed_charge");
927 mz_ = (mass + hydrogen_mass_ * charge_) / charge_;
928 rt_ = 0;
929 // assume only one scan, i.e. ignore "end_scan":
930 // "start and end_scan" are 1-based. "index" is 0-based
931 scannr_ = attributeAsInt_(attributes, "start_scan");
932 Size endscan = attributeAsInt_(attributes, "start_scan");
933 if (scannr_ != endscan)
934 {
935 error(LOAD, "endscan not equal to startscan. Merged spectrum queries not supported. Parsing start scan nr. only.");
936 }
937
938 bool rt_present = optionalAttributeAsDouble_(rt_, attributes, "retention_time_sec");
939
940 if (!rt_present) // get RT from experiment
941 {
942 if (lookup_ == nullptr || lookup_->empty())
943 {
944 // no lookup given, report non-fatal error
945 error(LOAD, "Cannot get RT information - no spectra given");
946 return;
947 }
948
949 Size index = (scannr_ != 0) ? lookup_->findByScanNumber(scannr_) :
950 lookup_->findByReference(attributeAsString_(attributes, "spectrum"));
951 SpectrumMetaDataLookup::SpectrumMetaData meta;
952 lookup_->getSpectrumMetaData(index, meta);
953 if (meta.ms_level == 2)
954 {
955 rt_ = meta.rt;
956 }
957 else
958 {
959 error(LOAD, "Cannot get RT information - scan mapping is incorrect");
960 }
961 }
962 }
963
964 void PepXMLFile::setParseUnknownScores(bool parse_unknown_scores)
965 {

Callers

nothing calls this directly

Calls 8

attributeAsDouble_Function · 0.85
attributeAsInt_Function · 0.85
attributeAsString_Function · 0.85
findByScanNumberMethod · 0.80
findByReferenceMethod · 0.80
getSpectrumMetaDataMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected