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

Method startElement

src/openms/source/FORMAT/PepXMLFile.cpp:1084–1971  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1082 */
1083
1084 void PepXMLFile::startElement(const XMLCh* const /*uri*/,
1085 const XMLCh* const /*local_name*/,
1086 const XMLCh* const qname,
1087 const xercesc::Attributes& attributes)
1088 {
1089 String element = sm_.convert(qname);
1090
1091 // cout << "Start: " << element << "\n";
1092
1093 if (element == "msms_run_summary") // parent: "msms_pipeline_analysis"
1094 {
1095 if (!exp_name_.empty())
1096 {
1097 String base_name = attributeAsString_(attributes, "base_name");
1098 if (!base_name.empty())
1099 {
1100 wrong_experiment_ = !base_name.hasSuffix(exp_name_);
1101 seen_experiment_ = seen_experiment_ || !wrong_experiment_;
1102 checked_base_name_ = true;
1103 }
1104 else // really shouldn't happen, but does for Mascot export to pepXML
1105 {
1106 error(LOAD, "'base_name' attribute of 'msms_run_summary' element is empty");
1107 // continue for now, but check later in 'search_summary':
1108 wrong_experiment_ = false;
1109 checked_base_name_ = false;
1110 }
1111 }
1112 if (wrong_experiment_) return;
1113
1114 // create a ProteinIdentification in case "search_summary" is missing:
1115 ProteinIdentification protein;
1116 protein.setDateTime(date_);
1117 prot_id_ = "unknown_" + date_.getDate();
1118 enzyme_ = "unknown_enzyme";
1119 // "prot_id_" will be overwritten if elem. "search_summary" is present
1120 protein.setIdentifier(prot_id_);
1121 proteins_->push_back(protein);
1122 current_proteins_.clear();
1123 current_proteins_.push_back(--proteins_->end());
1124 }
1125 else if (element == "analysis_summary") // parent: "msms_pipeline_analysis"
1126 {
1127 // this element can contain "search summary" elements, which we only
1128 // expect as subelements of "msms_run_summary", so skip the whole thing
1129 analysis_summary_ = true;
1130 }
1131 else if (wrong_experiment_ || analysis_summary_)
1132 {
1133 // do nothing here (this case exists to prevent parsing of elements for
1134 // experiments we're not interested in or for analysis summaries)
1135 }
1136 // now, elements occurring more frequently are generally closer to the top
1137 else if (element == "search_score") // parent: "search_hit"
1138 {
1139 String name = attributeAsString_(attributes, "name");
1140 double value;
1141

Callers

nothing calls this directly

Calls 15

attributeAsString_Function · 0.85
attributeAsDouble_Function · 0.85
attributeAsInt_Function · 0.85
optionalAttributeAsUInt_Function · 0.85
getInstanceFunction · 0.85
SearchParametersFunction · 0.85
DigestionEnzymeFunction · 0.85
SpecificityEnum · 0.85
asDateTime_Function · 0.85
getDateMethod · 0.80

Tested by

no test coverage detected