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

Function write_out_body_

src/topp/OpenSwathFeatureXMLToTSV.cpp:112–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void write_out_body_(std::ostream &os, Feature *feature_it, TargetedExperiment &transition_exp,
113 std::vector<String> &meta_value_names, int run_id, bool short_format, String identifier, String filename)
114{
115
116 String peptide_ref = feature_it->getMetaValue("PeptideRef");
117 String precursor_mz = feature_it->getMetaValue("PrecursorMZ");
118
119 String sequence;
120 String full_peptide_name = "NA";
121 String protein_name = "NA";
122 String decoy = "NA";
123 String charge = "NA";
124
125 if (!transition_exp.hasPeptide(peptide_ref))
126 {
127 throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
128 "Did not find the peptide " + peptide_ref + " in the targeted experiment.");
129 }
130
131 const OpenMS::TargetedExperiment::Peptide &pep = transition_exp.getPeptideByRef(peptide_ref);
132
133 sequence = pep.sequence;
134 if (!pep.protein_refs.empty())
135 {
136 // For now just take the first one, assuming the protein name is the id
137 protein_name = pep.protein_refs[0];
138 }
139
140 // handle charge
141 if (pep.hasCVTerm("MS:1000041"))
142 {
143 charge = pep.getCVTerms().at("MS:1000041")[0].getValue().toString();
144 }
145 else if (pep.hasCharge())
146 {
147 charge = (String)pep.getChargeState();
148 }
149 if (charge == "NA" && !full_peptide_name.empty())
150 {
151 // deal with FullPeptideNames like PEPTIDE/2
152 std::vector<String> substrings;
153 full_peptide_name.split("/", substrings);
154 if (substrings.size() == 2)
155 {
156 charge = substrings[1];
157 }
158 }
159
160 // handle decoy tag
161 if (peptide_transition_map.find(peptide_ref) != peptide_transition_map.end() && !peptide_transition_map[peptide_ref].empty())
162 {
163 const ReactionMonitoringTransition *transition = peptide_transition_map[peptide_ref][0];
164#if 1
165 const auto& terms = transition->getCVTerms();
166 if (terms.find("decoy") != terms.end())
167 {
168 decoy = transition->getCVTerms().at("decoy")[0].getValue().toString();
169 }

Callers 2

write_out_bodyMethod · 0.85

Calls 15

writtenDigitsFunction · 0.85
getMetaValueMethod · 0.80
hasPeptideMethod · 0.80
atMethod · 0.80
getChargeStateMethod · 0.80
metaValueExistsMethod · 0.80
getUniqueIdMethod · 0.80
substrMethod · 0.80
precisionMethod · 0.80
StringClass · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected