Read in the mascot.dat file.
using System;
using matrix_science.msparser;
namespace MsParserExamples
{
public class config_mascotdat
{
public static void Main(string[] argv)
{
if (argv.Length < 1)
{
Console.Error.WriteLine(@"The location of the mascot.dat has to be specified as a parameter
The location should either be the full path to the mascot.dat 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_datfile 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_datfile(argv[0], 0, cs);
} else file = new ms_datfile(argv[0]);
if (!file.isValid())
{
Console.Error.WriteLine("There are errors. Cannot continue. The last error description:");
Console.Error.WriteLine(file.getLastErrorString());
return;
}
ms_databases dbs = file.getDatabases();
if (dbs.isSectionAvailable())
{
int n = dbs.getNumberOfDatabases();
Console.WriteLine("There are {0} databases configured:", n);
for (int i = 0; i < n; i++)
{
Console.WriteLine("{0} : {1}", dbs.getDatabase(i).getName(), dbs.getDatabase(i).isActive() ? "active" : "inactive");
}
}
else
{
Console.WriteLine("Databases-section is missing");
}
Console.WriteLine();
ms_parseoptions parseOptions = file.getParseOptions();
if (parseOptions.isSectionAvailable())
{
int n = parseOptions.getNumberOfParseRules();
Console.WriteLine("Parse rules configured:");
for (int i = 0; i < n; i++)
{
if (parseOptions.getParseRule(i).isAvailable())
{
Console.WriteLine("Rule_{0} : {1}", i, parseOptions.getParseRule(i).getRuleStr());
}
}
}
else
{
Console.WriteLine("Parse-section is missing");
}
Console.WriteLine();
ms_wwwoptions wwwOptions = file.getWWWOptions();
if (wwwOptions.isSectionAvailable())
{
int n = wwwOptions.getNumberOfEntries();
Console.WriteLine("There are {0} sequence report sources configured:", n);
for (int i = 0; i < n; i++)
{
Console.WriteLine("{0}_{1}", wwwOptions.getEntry(i).getName(),
wwwOptions.getEntry(i).getType() == WWW_TYPE.WWW_SEQ ? "SEQ" : "REP");
}
}
else
{
Console.WriteLine("WWW-section is missing");
}
Console.WriteLine();
Console.WriteLine("Available taxonomy sources:");
int maxTax = file.getMaxTaxonomyRules();
for (int taxInd = 1; taxInd <= maxTax; taxInd++)
{
if (file.getTaxonomyRules(taxInd) != null)
{
Console.WriteLine("TAXONOMY_{0} {1}", taxInd, file.getTaxonomyRules(taxInd).getIdentifier());
}
}
Console.WriteLine();
ms_clusterparams clusterParams = file.getClusterParams();
if (clusterParams.isSectionAvailable())
{
Console.WriteLine("Cluster mode : {0}", clusterParams.isEnabled() ? "enabled" : "disabled");
}
else
{
Console.WriteLine("Cluster-section is missing");
}
Console.WriteLine();
ms_processoroptions procOptions = file.getProcessors();
if (procOptions.isSectionAvailable())
{
Console.WriteLine("{0} CPU(s) configured", procOptions.getNumberOfProcessors());
}
else
{
Console.WriteLine("Processor-section is missing");
}
Console.WriteLine();
ms_mascotoptions mascotOptions = file.getMascotOptions();
if (mascotOptions.isSectionAvailable())
{
Console.WriteLine("MascotCmdLine : {0}", mascotOptions.getMascotCmdLine());
}
else
{
Console.WriteLine("Options-section is missing");
}
Console.WriteLine();
ms_cronoptions cronOptions = file.getCronOptions();
if (cronOptions.isCronEnabled())
{
int n = cronOptions.getNumberOfCronJobs();
Console.WriteLine("There are {0} cron-jobs configured:", n);
for (int i = 0; i < n; i++)
{
Console.WriteLine(cronOptions.getCronJob(i).getCommandStr());
}
}
else
{
Console.WriteLine("Cron functionality is disabled");
}
Console.WriteLine();
}
}
}