Read in the fragmentation_rules file.
using System;
using System.IO;
using matrix_science.msparser;
namespace MsParserExamples
{
public class config_fragrules
{
public static void Main(string[] argv)
{
if (argv.Length < 1)
{
Console.Error.WriteLine(@"The location of the 'fragmentation_rules' file has to be specified as a parameter
The location should either be the full path to the fragmentation_rules file
or a URL to a Mascot server - e.g. http://mascot-searver/mascot/cgi
A Mascot security sessionID can optionally be passed as a second
parameter");
return;
}
ms_fragrulesfile file;
if (argv.Length > 1)
{
ms_connection_settings cs = new ms_connection_settings();
cs.setProxyServerType(ms_connection_settings.PROXY_TYPE.PROXY_TYPE_AUTO);
cs.setSessionID(argv[1]);
file = new ms_fragrulesfile(argv[0], cs);
}
else file = new ms_fragrulesfile(argv[0]);
if (!file.isValid())
{
Console.Error.WriteLine("Error number: {0}", file.getLastError());
Console.Error.WriteLine("Error string: {0}", file.getLastErrorString());
return;
}
int n = file.getNumberOfInstruments();
Console.WriteLine("{0} instruments are configured:", n);
for (int i = 0; i < n; i++)
{
Console.WriteLine(file.getInstrumentName(i));
}
ms_fragmentationrules instrument = file.getInstrumentByName("ESI-QUAD-TOF");
instrument.setSeriesUsed(23, true);
file.updateInstrumentByName("ESI-QUAD-TOF", instrument);
file.deleteInstrumentByName("MALDI-QIT-TOF");
if (argv[0].ToLower().StartsWith("http"))
{
file.setFileName("copy_enzymes.new");
}
else
{
file.setFileName(argv[0] + ".new");
}
file.save_file();
Console.WriteLine("There are now {0} instruments configured. The updated configuration file was saved to {1}",
file.getNumberOfInstruments(),
Path.GetFullPath(file.getFileName()));
}
}
}