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

Method checkFormula_

src/openms/source/DATASTRUCTURES/Adduct.cpp:178–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176 }
177
178 String Adduct::checkFormula_(const String& formula)
179 {
180 EmpiricalFormula ef(formula);
181 if (ef.getCharge() != 0)
182 {
183 std::cerr << "Warning: Adduct contains explicit charge (alternating mass)! (" << formula << ")\n";
184 }
185 if (ef.isEmpty())
186 {
187 std::cerr << "Warning: Adduct was given empty formula! (" << formula << ")\n";
188 }
189 if ((ef.getNumberOfAtoms() > 1) && (std::distance(ef.begin(), ef.end()) == 1))
190 {
191 std::cerr << "Warning: Adduct was given only a single element but with an abundance>1. This might lead to errors! (" << formula << ")\n";
192 }
193
194 return ef.toString();
195 }
196
197 ///Print the contents of an Adduct to a stream.
198 OPENMS_DLLAPI std::ostream& operator<<(std::ostream& os, const Adduct& a)

Callers

nothing calls this directly

Calls 6

getNumberOfAtomsMethod · 0.80
getChargeMethod · 0.45
isEmptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected