Read in the fragmentation_rules file.
#include "msparser.hpp"
#include <iostream>
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;
}
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;
}
ms_fragmentationrules instrument = *file.getInstrumentByName("ESI-QUAD-TOF");
instrument.setSeriesUsed(23, true);
file.updateInstrumentByName("ESI-QUAD-TOF", instrument);
file.deleteInstrumentByName("MALDI-QIT-TOF");
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;
}