76 template <
typename FeatureMapType>
77 void load(
const String& filename, FeatureMapType& feature_map)
86 bool first_line =
true;
92 if (line.empty() || line[0] ==
'#')
continue;
102 std::vector<String> parts;
103 line.
split(
'\t', parts);
105 if (parts.size() < 18)
107 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()) +
")");
112 Size column_to_convert = 0;
115 column_to_convert = 1;
116 f.
setRT(parts[1].toDouble());
117 column_to_convert = 2;
118 f.
setMZ(parts[2].toDouble());
119 column_to_convert = 5;
121 column_to_convert = 6;
123 column_to_convert = 8;
126 column_to_convert = 3;
128 column_to_convert = 4;
130 column_to_convert = 7;
132 column_to_convert = 9;
134 column_to_convert = 10;
136 column_to_convert = 11;
138 column_to_convert = 12;
140 column_to_convert = 13;
142 column_to_convert = 14;
144 column_to_convert = 15;
146 column_to_convert = 16;
151 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) +
")");
154 feature_map.push_back(f);
166 template <
typename SpectrumType>
169 std::cerr <<
"Store() for MsInspectFile not implemented. Filename was: " << filename <<
", spec of size " << spectrum.size() <<
"\n";
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:202
void load(const String &filename, FeatureMapType &feature_map)
Loads a MsInspect file into a featureXML.
Definition: MsInspectFile.h:77
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
void setIntensity(IntensityType intensity)
Non-mutable access to the data point intensity (height)
Definition: Peak2D.h:172
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
void setRT(CoordinateType coordinate)
Mutable access to the RT coordinate (index 0)
Definition: Peak2D.h:214
std::vector< String >::const_iterator ConstIterator
Non-mutable iterator.
Definition: TextFile.h:56
ConstIterator end() const
Gives access to the underlying text buffer.
Exception base class.
Definition: Exception.h:89
An LC-MS feature.
Definition: Feature.h:70
void setOverallQuality(QualityType q)
Set the overall quality.
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
void store(const String &filename, const SpectrumType &spectrum) const
Stores a featureXML as a MsInspect file.
Definition: MsInspectFile.h:167
void setCharge(const ChargeType &ch)
Set charge state.
ConstIterator begin() const
Gives access to the underlying text buffer.
File adapter for MsInspect files.
Definition: MsInspectFile.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.
Not implemented exception.
Definition: Exception.h:436
This class provides some basic file handling methods for text files.
Definition: TextFile.h:46
Parse Error exception.
Definition: Exception.h:622