Read in the fragmentation_rules file.
/* ############################################################################## # file: config_fragrules.cpp # # 'msparser' toolkit example code # ############################################################################## # COPYRIGHT NOTICE # # Copyright 1998-2005 Matrix Science Limited All Rights Reserved. # # # ############################################################################## # $Source: parser/examples/test_cxx/config_fragrules.cpp $ # # $Author: villek@matrixscience.com $ # # $Date: 2018-07-30 16:23:53 +0100 $ # # $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $ # # $NoKeywords:: $ # ############################################################################## */ #include "msparser.hpp" #include <iostream> // All the classes are part of the matrix_science namespace using namespace matrix_science; int main(int argc, char * argv[]) { if ( argc < 2 ) { std::cout << "The location of fragmentation_rules file has to be specified as a parameter" << std::endl; std::cout << "The location should either be the full path to the fragmentation_rules file" << std::endl; std::cout << "or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi" << std::endl; return 1; } // A sessionID can optionally be passed as the second parameter // This will only be required if the 'file' is a URL ms_connection_settings cs; if (argc > 2) { cs.setSessionID(argv[2]); } ms_fragrulesfile file(argv[1], &cs); if ( !file.isValid() ) { std::cout << "There are errors. Cannot continue. The last error description:" << std::endl; std::cout << file.getLastErrorString() << std::endl; return 1; } int n = file.getNumberOfInstruments(); std::cout << n << " instruments are configured:" << std::endl; int i; for(i=0; i < n; i++) { std::cout << file.getInstrumentName(i) << std::endl; } // Now change ESI-QUAD-TOF ms_fragmentationrules instrument = *file.getInstrumentByName("ESI-QUAD-TOF"); instrument.setSeriesUsed(23, true); // Add v series file.updateInstrumentByName("ESI-QUAD-TOF", instrument); // And delete MALDI-QIT-TOF file.deleteInstrumentByName("MALDI-QIT-TOF"); //Finally, save the file under a new name - but only if not http: if (strncmp("http:", argv[1], 5) != 0) { std::string filename = argv[1]; filename += ".new"; file.setFileName(filename.c_str()); file.save_file(); } std::cout << "There are now " << file.getNumberOfInstruments() << " instruments configured." << std::endl; return 0; } /* will give the output: # config_fragrules.exe ../config/fragmentation_rules 11 instruments are configured: Default ESI-QUAD-TOF MALDI-TOF-PSD ESI-TRAP ESI-QUAD ESI-FTICR MALDI-TOF-TOF ESI-4SECTOR FTMS-ECD MALDI-QUAD-TOF LCQ There are now 10 instruments configured. */
Copyright © 2022 Matrix Science Ltd. All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29 |