50 void load(
const std::string& filename, FeatureMapType& feature_map)
59 bool first_line =
true;
62 std::string line = *it;
65 if (line.empty() || line[0] ==
'#')
continue;
75 std::vector<std::string> parts;
76 StringUtils::split(line,
'\t', parts);
78 if (parts.size() < 18)
80 throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"",
"Failed to convert line " + StringUtils::toStr((it - input.
begin()) + 1) +
". Not enough columns (expected 18 or more, got " + StringUtils::toStr(parts.size()) +
")");
85 Size column_to_convert = 0;
88 column_to_convert = 1;
89 f.
setRT(StringUtils::toDouble(parts[1]));
90 column_to_convert = 2;
91 f.
setMZ(StringUtils::toDouble(parts[2]));
92 column_to_convert = 5;
94 column_to_convert = 6;
95 f.
setCharge(StringUtils::toInt32(parts[6]));
96 column_to_convert = 8;
99 column_to_convert = 3;
101 column_to_convert = 4;
102 f.
setMetaValue(
"mass", StringUtils::toDouble(parts[4]));
103 column_to_convert = 7;
104 f.
setMetaValue(
"chargeStates", StringUtils::toInt32(parts[7]));
105 column_to_convert = 9;
106 f.
setMetaValue(
"background", StringUtils::toDouble(parts[9]));
107 column_to_convert = 10;
108 f.
setMetaValue(
"median", StringUtils::toDouble(parts[10]));
109 column_to_convert = 11;
110 f.
setMetaValue(
"peaks", StringUtils::toInt32(parts[11]));
111 column_to_convert = 12;
112 f.
setMetaValue(
"scanFirst", StringUtils::toInt32(parts[12]));
113 column_to_convert = 13;
114 f.
setMetaValue(
"scanLast", StringUtils::toInt32(parts[13]));
115 column_to_convert = 14;
116 f.
setMetaValue(
"scanCount", StringUtils::toInt32(parts[14]));
117 column_to_convert = 15;
118 f.
setMetaValue(
"totalIntensity", StringUtils::toDouble(parts[15]));
119 column_to_convert = 16;
120 f.
setMetaValue(
"sumSquaresDist", StringUtils::toDouble(parts[16]));
124 throw Exception::ParseError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"",
"Failed to convert value in column " + StringUtils::toStr(column_to_convert + 1) +
" into a number (line '" + StringUtils::toStr((it - input.
begin()) + 1) +
")");
127 feature_map.push_back(f);