75 template <
typename FeatureMapType>
76 void load(
const String& filename, FeatureMapType& feature_map)
85 bool first_line =
true;
91 if (line.empty() || line[0] ==
'#')
continue;
101 std::vector<String> parts;
102 line.
split(
'\t', parts);
104 if (parts.size() < 18)
106 throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"",
String(
"Failed to convert line ") +
String((it - input.
begin()) + 1) +
". Not enough columns (expected 18 or more, got " +
String(parts.size()) +
")");
111 Size column_to_convert = 0;
114 column_to_convert = 1;
116 column_to_convert = 2;
118 column_to_convert = 5;
120 column_to_convert = 6;
122 column_to_convert = 8;
125 column_to_convert = 3;
127 column_to_convert = 4;
129 column_to_convert = 7;
131 column_to_convert = 9;
133 column_to_convert = 10;
135 column_to_convert = 11;
137 column_to_convert = 12;
139 column_to_convert = 13;
141 column_to_convert = 14;
143 column_to_convert = 15;
145 column_to_convert = 16;
150 throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"",
String(
"Failed to convert value in column ") +
String(column_to_convert + 1) +
" into a number (line '" +
String((it - input.
begin()) + 1) +
")");
153 feature_map.push_back(f);
165 template <
typename SpectrumType>
168 std::cerr <<
"Store() for MsInspectFile 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:91
Not implemented exception.
Definition: Exception.h:430
Parse Error exception.
Definition: Exception.h:624
An LC-MS feature.
Definition: Feature.h:72
void setOverallQuality(QualityType q)
Set the overall quality.
The representation of a 1D spectrum.
Definition: MSSpectrum.h:70
File adapter for MsInspect files.
Definition: MsInspectFile.h:60
virtual ~MsInspectFile()
Destructor.
void store(const String &filename, const SpectrumType &spectrum) const
Stores a featureXML as a MsInspect file.
Definition: MsInspectFile.h:166
void load(const String &filename, FeatureMapType &feature_map)
Loads a MsInspect file into a featureXML.
Definition: MsInspectFile.h:76
MsInspectFile()
Default constructor.
void setMZ(CoordinateType coordinate)
Mutable access to the m/z coordinate (index 1)
Definition: Peak2D.h:202
void setRT(CoordinateType coordinate)
Mutable access to the RT coordinate (index 0)
Definition: Peak2D.h:214
void setIntensity(IntensityType intensity)
Sets data point intensity (height)
Definition: Peak2D.h:172
A more convenient string class.
Definition: String.h:60
bool split(const char splitter, std::vector< String > &substrings, bool quote_protect=false) const
Splits a string into substrings using splitter as delimiter.
This class provides some basic file handling methods for text files.
Definition: TextFile.h:47
std::vector< String >::const_iterator ConstIterator
Non-mutable iterator.
Definition: TextFile.h:56
ConstIterator end() const
Gives access to the underlying text buffer.
ConstIterator begin() const
Gives access to the underlying text buffer.
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
static Int toInt(const String &this_s)
Definition: StringUtils.h:206
static double toDouble(const String &this_s)
Definition: StringUtils.h:216
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47