49 template <
typename FeatureMapType>
50 void load(
const std::string& filename, FeatureMapType& feature_map)
60 if (it == input.
end())
return;
65 for (; it != input.
end(); ++it)
67 std::string line = *it;
69 std::vector<std::string> parts;
70 StringUtils::split(line,
'\t', parts);
74 throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"",
"Failed to convert line" + StringUtils::toStr((it - input.
begin()) + 1) +
"not enough columns (expected 5 or more, got " + StringUtils::toStr(parts.size()) +
")");
80 f.
setMZ(StringUtils::toDouble(parts[0]));
81 f.
setRT(StringUtils::toDouble(parts[1]) * 60.0);
83 f.
setCharge(StringUtils::toInt32(parts[3]));
88 throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"",
"Failed to convert value into a number (line '" + StringUtils::toStr((it - input.
begin()) + 1) +
")");
90 feature_map.push_back(f);
101 template <
typename SpectrumType>
104 std::cerr <<
"Store() for SpecArrayFile not implemented. Filename was: " << filename <<
", spec of size " << spectrum.size() <<
"\n";
void setCharge(const ChargeType &ch)
Set charge state.
Exception base class.
Definition Exception.h:63
Not implemented exception.
Definition Exception.h:400
Parse Error exception.
Definition Exception.h:593
An LC-MS feature.
Definition Feature.h:46
The representation of a 1D spectrum.
Definition MSSpectrum.h:44
void setMZ(CoordinateType coordinate)
Mutable access to the m/z coordinate (index 1)
Definition Peak2D.h:179
void setRT(CoordinateType coordinate)
Mutable access to the RT coordinate (index 0)
Definition Peak2D.h:191
void setIntensity(IntensityType intensity)
Sets data point intensity (height)
Definition Peak2D.h:149
File adapter for SpecArray (.pepList) files.
Definition SpecArrayFile.h:34
SpecArrayFile()
Default constructor.
void store(const std::string &filename, const SpectrumType &spectrum) const
Stores a featureXML as a SpecArray file.
Definition SpecArrayFile.h:102
virtual ~SpecArrayFile()
Destructor.
void load(const std::string &filename, FeatureMapType &feature_map)
Loads a SpecArray file into a featureXML.
Definition SpecArrayFile.h:50
ConstIterator end() const
Gives access to the underlying text buffer.
std::vector< std::string >::const_iterator ConstIterator
Non-mutable iterator.
Definition TextFile.h:30
ConstIterator begin() const
Gives access to the underlying text buffer.
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19