MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / writeFeature_

Method writeFeature_

src/openms/source/FORMAT/HANDLERS/MzQuantMLHandler.cpp:1284–1382  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1282 }
1283
1284 void MzQuantMLHandler::writeFeature_(String& feature_xml, const std::vector<FeatureMap >& fm, UInt indentation_level)
1285 {
1286 //TODO: remove dummy
1287 //os << "\n featurewriter: " << identifier_prefix << "-" << String(identifier) << "-" << String(indentation_level) << "\n";
1288 //TODO: remove dummy
1289
1290 std::vector<UInt64> fid;
1291 std::vector<float> fin, fwi, fqu;
1292// std::vector<std::vector<std::vector<UInt64> > > cid; //per consensusmap - per consensus - per feature (first entry is consensus idref) TODO removed unused variables
1293// std::vector<std::vector<float> > f2i;
1294 std::vector<UInt64> idvec;
1295 idvec.push_back(UniqueIdGenerator::getUniqueId());
1296
1297 for (const FeatureMap& fat : fm)
1298 {
1299 for (const Feature& fit : fat)
1300 {
1301 fid.push_back(UniqueIdGenerator::getUniqueId());
1302 idvec.push_back(fid.back());
1303 fin.push_back(fit.getIntensity());
1304 fwi.push_back(fit.getWidth());
1305 fqu.push_back(fit.getOverallQuality());
1306 feature_xml += String(indentation_level, '\t') + "<Feature id=\"f_" + String(fid.back()) + "\" rt=\"" + String(fit.getRT()) + "\" mz=\"" + String(fit.getMZ()) + "\" charge=\"" + String(fit.getCharge()) + "\">\n";
1307 //~ writeUserParam_(os, *jt, UInt(2)); // FeatureHandle has no MetaInfoInterface!!!
1308 //~ feature_xml += "\t\t\t<userParam name=\"feature_index\" value=\"" + String(fit->getUniqueId()) + "\"/>\n";
1309 feature_xml += String(indentation_level, '\t') + "</Feature>\n";
1310 for (const ConvexHull2D& cit : fit.getConvexHulls())
1311 {
1312 feature_xml += String(indentation_level, '\t') + "\t<MassTrace>";
1313 feature_xml += String(cit.getBoundingBox().minX()) + " " + String(cit.getBoundingBox().minY()) + " " + String(cit.getBoundingBox().maxX()) + " " + String(cit.getBoundingBox().maxY());
1314 feature_xml += "</MassTrace>\n";
1315 }
1316 }
1317 }
1318 //~ cmid.push_back(idvec); TODO return this and care for IDs in features
1319
1320 feature_xml += String(indentation_level, '\t') + String("<FeatureQuantLayer id=\"") + String("q_") + String(UniqueIdGenerator::getUniqueId()) + String("\">\n");
1321 feature_xml += String(indentation_level, '\t') + String("\t<ColumnDefinition>\n");
1322 feature_xml += String(indentation_level, '\t') + String("\t\t<Column index=\"0\">\n") + String(indentation_level, '\t') + String("\t\t\t<DataType>\n") + String(indentation_level, '\t') + String("\t\t\t\t<cvParam cvRef=\"PSI-MS\" accession=\"MS:1001141\" name=\"intensity of precursor ion\"/>\n") + String(indentation_level, '\t') + String("\t\t\t</DataType>\n") + String(indentation_level, '\t') + String("\t\t</Column>\n");
1323 feature_xml += String(indentation_level, '\t') + String("\t\t<Column index=\"1\">\n") + String(indentation_level, '\t') + String("\t\t\t<DataType>\n") + String(indentation_level, '\t') + String("\t\t\t\t<cvParam cvRef=\"PSI-MS\" accession=\"MS:1000086\" name=\"full width at half-maximum\"/>\n") + String(indentation_level, '\t') + String("\t\t\t</DataType>\n") + String(indentation_level, '\t') + String("\t\t</Column>\n");
1324 feature_xml += String(indentation_level, '\t') + String("\t\t<Column index=\"2\">\n") + String(indentation_level, '\t') + String("\t\t\t<DataType>\n") + String(indentation_level, '\t') + String("\t\t\t\t<cvParam cvRef=\"PSI-MS\" accession=\"TODO\" name=\"quality\"/>\n") + String(indentation_level, '\t') + String("\t\t\t</DataType>\n") + String(indentation_level, '\t') + String("\t\t</Column>\n");
1325 feature_xml += String(indentation_level, '\t') + String("\t</ColumnDefinition>\n");
1326 feature_xml += String(indentation_level, '\t') + String("\t<DataMatrix>\n");
1327 for (Size i = 0; i < fid.size(); ++i)
1328 {
1329 feature_xml += String(indentation_level, '\t') + String("\t\t<Row object_ref=\"f_") + String(fid[i]) + String("\">");
1330 feature_xml += String(fin[i]) + String(" ") + String(fwi[i]) + " " + String(fqu[i]);
1331 feature_xml += String("</Row>\n");
1332 }
1333 feature_xml += String(indentation_level, '\t') + String("\t</DataMatrix>\n");
1334 feature_xml += String(indentation_level, '\t') + String("</FeatureQuantLayer>\n");
1335
1336 //~ os << "\t\t\t<Masstrace>";
1337 //~ vector<ConvexHull2D> hulls = feat.getConvexHulls();
1338 //~ vector<ConvexHull2D>::iterator citer = hulls.begin();
1339 //~ Size hulls_count = hulls.size();
1340
1341 //~ for (Size i = 0;i < hulls_count; i++)

Callers

nothing calls this directly

Calls 15

getUniqueIdFunction · 0.85
backMethod · 0.80
getOverallQualityMethod · 0.80
getConvexHullsMethod · 0.80
minXMethod · 0.80
getBoundingBoxMethod · 0.80
minYMethod · 0.80
maxXMethod · 0.80
maxYMethod · 0.80
StringClass · 0.50
push_backMethod · 0.45
getIntensityMethod · 0.45

Tested by

no test coverage detected