Read in the mascot.dat file.
import java.util.Date;
import matrix_science.msparser.*;
public class config_mascotdat {
static {
try {
System.loadLibrary("msparserj");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. "
+ "Is msparserj.dll on the path?\n" + e);
System.exit(0);
}
}
public static void main(String argv[])
{
if(argv.length < 1) {
System.err.println("Location of mascot.dat has to be specified as a parameter");
System.err.println("The location should either be the full path to the enzymes file");
System.err.println("or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi");
System.exit(0);
}
ms_datfile file;
if (argv.length > 1)
{
ms_connection_settings cs = new ms_connection_settings();
cs.setSessionID(argv[1]);
file = new ms_datfile(argv[0], 0, cs);
}
else
{
file = new ms_datfile(argv[0]);
}
if (!file.isValid())
{
System.err.println("There are errors. Cannot continue. The last error description:");
System.err.println(file.getLastErrorString());
System.exit(0);
}
ms_databases dbs = file.getDatabases();
if (dbs.isSectionAvailable())
{
int n = dbs.getNumberOfDatabases();
System.out.println("There are " + n + " databases configured:");
for(int i=0; i < n; i++)
{
System.out.print(dbs.getDatabase(i).getName() + " : ");
if (dbs.getDatabase(i).isActive())
{
System.out.println("active");
}
else
{
System.out.println("inactive");
}
}
}
else
{
System.out.println("Databases-section is missing");
}
System.out.println("");
ms_parseoptions parseOptions = file.getParseOptions();
if (parseOptions.isSectionAvailable())
{
int n = parseOptions.getNumberOfParseRules();
System.out.println("Parse rules configured:");
for (int i=0; i < n; i++)
{
if (parseOptions.getParseRule(i).isAvailable())
{
System.out.print("Rule_" + i + " : ");
System.out.println(parseOptions.getParseRule(i).getRuleStr());
}
}
}
else
{
System.out.println("Parse-section is missing");
}
System.out.println();
ms_wwwoptions wwwOptions = file.getWWWOptions();
if (wwwOptions.isSectionAvailable())
{
int n = wwwOptions.getNumberOfEntries();
System.out.println("There are " + n + " sequence report sources configured:");
for(int i=0; i < n; i++)
{
System.out.print(wwwOptions.getEntry(i).getName() + "_");
if (wwwOptions.getEntry(i).getType() == msparser.WWW_SEQ)
{
System.out.println("SEQ");
}
else
{
System.out.println("REP");
}
}
}
else
{
System.out.println("WWW-section is missing");
}
System.out.println();
System.out.println("Available taxonomy sources:");
int maxtax = file.getMaxTaxonomyRules();
for (int taxind = 1; taxind <= maxtax; taxind++)
{
if (file.getTaxonomyRules(taxind) != null)
{
System.out.print("TAXONOMY_" + taxind + " ");
System.out.println(file.getTaxonomyRules(taxind).getIdentifier());
}
}
System.out.println();
ms_clusterparams clusterParams = file.getClusterParams();
if (clusterParams.isSectionAvailable())
{
System.out.print("Cluster mode : ");
if (clusterParams.isEnabled())
{
System.out.println("enabled");
}
else
{
System.out.println("disabled");
}
}
else
{
System.out.println("Cluster-section is missing");
}
System.out.println();
ms_processoroptions procOptions = file.getProcessors();
if (procOptions.isSectionAvailable())
{
System.out.println(procOptions.getNumberOfProcessors() + " CPU(s) configured");
}
else
{
System.out.println("Processor-section is missing");
}
System.out.println();
ms_mascotoptions mascotOptions = file.getMascotOptions();
if (mascotOptions.isSectionAvailable())
{
System.out.print("MascotCmdLine : ");
System.out.println(mascotOptions.getMascotCmdLine());
}
else
{
System.out.println("Options-section is missing");
}
System.out.println();
ms_cronoptions cronOptions = file.getCronOptions();
if (cronOptions.isSectionAvailable())
{
if (cronOptions.isCronEnabled())
{
int n = cronOptions.getNumberOfCronJobs();
System.out.println("There are " + n + " cron-jobs configured:");
for (int i=0; i < n; i++)
{
System.out.println(cronOptions.getCronJob(i).getCommandStr());
}
}
else
{
System.out.println("Cron functionality is disabled");
}
}
else
{
System.out.println("Cron-section is missing");
}
System.out.println();
}
}