Read in the modifications file - modfile.
using System;
using matrix_science.msparser;
namespace MsParserExamples
{
public class config_modfile
{
public static void Main(string[] argv)
{
if (argv.Length < 1)
{
Console.WriteLine(@"The location of the mod_file has to be specified as a parameter
The location should either be the full path to the mod file
or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi.
A Mascot security sessionID can optionally be passed as a second
parameter");
return;
}
ms_masses massesFile = new ms_masses();
ms_modfile 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_modfile(argv[0], massesFile, false, cs);
}
else
{
file = new ms_modfile(argv[0], massesFile, false);
}
if (!file.isValid())
{
Console.WriteLine("There are errors. Cannot continue. The last error description:");
Console.WriteLine(file.getLastErrorString());
return;
}
int n = file.getNumberOfModifications();
Console.WriteLine("There are {0} modifications configured:", n);
for (int i = 0; i < n; i++)
{
Console.WriteLine(file.getModificationByNumber(i).getTitle());
}
ms_modification mod = file.getModificationByName("Acetyl (K)");
mod.setHidden(true);
file.updateModificationByName("Acetyl (K)", mod);
file.deleteModificationByName("Methyl (R)");
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 " + file.getNumberOfModifications() + " modifications configured.");
}
}
}