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

Method main_

src/topp/IDFileConverter.cpp:239–795  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

237 }
238
239 ExitCodes main_(int, const char**) override
240 {
241 //-------------------------------------------------------------
242 // general variables and data
243 //-------------------------------------------------------------
244 FileHandler fh;
245 vector<PeptideIdentification> peptide_identifications;
246 vector<ProteinIdentification> protein_identifications;
247 SpectrumMetaDataLookup lookup;
248 IdentificationData id_data;
249
250 //-------------------------------------------------------------
251 // reading input
252 //-------------------------------------------------------------
253 const String in = getStringOption_("in");
254 const String mz_file = getStringOption_("mz_file");
255 FileTypes::Type in_type = FileTypes::UNKNOWN; // set below if 'in' isn't a directory
256
257 const String out = getStringOption_("out");
258 FileTypes::Type out_type = FileHandler::getConsistentOutputfileType(out, getStringOption_("out_type"));
259 if (out_type == FileTypes::UNKNOWN)
260 {
261 writeLogError_("Error: Could not determine output file type!");
262 return PARSE_ERROR;
263 }
264
265 ProgressLogger logger;
266 logger.setLogType(ProgressLogger::CMD);
267 logger.startProgress(0, 1, "Loading...");
268
269 if (File::isDirectory(in))
270 {
271 const String in_directory = File::absolutePath(in).ensureLastChar('/');
272 const bool ignore_proteins_per_peptide = getFlag_("ignore_proteins_per_peptide");
273
274 UInt i = 0;
275 FileTypes::Type type;
276 PeakMap msexperiment;
277 // Note: we had issues with leading zeroes, so let us represent scan numbers as Int (next line used to be map<String, float> num_and_rt;) However, now String::toInt() might throw.
278 map<Int, float> num_and_rt;
279 vector<String> NativeID;
280
281 // The mz-File (if given)
282 if (!mz_file.empty())
283 {
284 type = fh.getTypeByFileName(mz_file);
285 fh.loadExperiment(mz_file, msexperiment, type, log_type_, false, false);
286
287 for (PeakMap::Iterator spectra_it = msexperiment.begin(); spectra_it != msexperiment.end(); ++spectra_it)
288 {
289 String(spectra_it->getNativeID()).split('=', NativeID);
290 try
291 {
292 num_and_rt[NativeID[1].toInt()] = spectra_it->getRT();
293 // cout << "num_and_rt: " << NativeID[1] << " = " << NativeID[1].toInt() << " : " << num_and_rt[NativeID[1].toInt()] << endl; // CG debuggging 2009-07-01
294 }
295 catch (Exception::ConversionError& e)
296 {

Callers

nothing calls this directly

Calls 15

concatenateFunction · 0.85
setLogTypeMethod · 0.80
getTypeByFileNameMethod · 0.80
loadExperimentMethod · 0.80
getNativeIDMethod · 0.80
toIntMethod · 0.80
addMSLevelMethod · 0.80
setSearchEngineMethod · 0.80
getMetaValueMethod · 0.80
getPrecursorsMethod · 0.80
readSpectraMethod · 0.80

Tested by

no test coverage detected