35 #ifndef OPENMS_FORMAT_SPECARRAYFILE_H 36 #define OPENMS_FORMAT_SPECARRAYFILE_H 77 template <
typename FeatureMapType>
78 void load(
const String& filename, FeatureMapType& feature_map)
88 if (it == input.
end())
return;
93 for (; it != input.
end(); ++it)
97 std::vector<String> parts;
98 line.
split(
'\t', parts);
100 if (parts.size() < 5)
102 throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"",
String(
"Failed to convert line") +
String((it - input.
begin()) + 1) +
"not enough columns (expected 5 or more, got " +
String(parts.size()) +
")");
108 f.
setMZ(parts[0].toDouble());
109 f.
setRT(parts[1].toDouble() * 60.0);
118 feature_map.push_back(f);
129 template <
typename SpectrumType>
132 std::cerr <<
"Store() for SpecArrayFile not implemented. Filename was: " << filename <<
", spec of size " << spectrum.size() <<
"\n";
139 #endif // OPENMS_FORMAT_SPECARRAYFILE_H
A more convenient string class.
Definition: String.h:57
void setMZ(CoordinateType coordinate)
Mutable access to the m/z coordinate (index 1)
Definition: Peak2D.h:203
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
void setIntensity(IntensityType intensity)
Non-mutable access to the data point intensity (height)
Definition: Peak2D.h:173
File adapter for SpecArray (.pepList) files.
Definition: SpecArrayFile.h:61
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
void setRT(CoordinateType coordinate)
Mutable access to the RT coordinate (index 0)
Definition: Peak2D.h:215
std::vector< String >::const_iterator ConstIterator
Non-mutable iterator.
Definition: TextFile.h:57
ConstIterator end() const
Gives access to the underlying text buffer.
Exception base class.
Definition: Exception.h:90
An LC-MS feature.
Definition: Feature.h:70
void store(const String &filename, const SpectrumType &spectrum) const
Stores a featureXML as a SpecArray file.
Definition: SpecArrayFile.h:130
void setCharge(const ChargeType &ch)
Set charge state.
ConstIterator begin() const
Gives access to the underlying text buffer.
void load(const String &filename, FeatureMapType &feature_map)
Loads a SpecArray file into a featureXML.
Definition: SpecArrayFile.h:78
bool split(const char splitter, std::vector< String > &substrings, bool quote_protect=false) const
Splits a string into substrings using splitter as delimiter.
Not implemented exception.
Definition: Exception.h:437
This class provides some basic file handling methods for text files.
Definition: TextFile.h:47
Parse Error exception.
Definition: Exception.h:623