Read in the mascot.dat file.
#include "msparser.hpp"
#include <iostream>
using namespace matrix_science;
int main(int argc, char * argv[])
{
if ( argc < 2 )
{
std::cout << "The location of mascot.dat file has to be specified as a parameter" << std::endl;
std::cout << "The location should either be the full path to the mascot.dat 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_datfile file(argv[1], 0, &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;
}
const ms_databases* dbs = file.getDatabases();
if ( dbs->isSectionAvailable() )
{
int n = dbs->getNumberOfDatabases();
std::cout << "There are " << n << " databases configured:" << std::endl;
int i;
for(i=0; i < n; i++)
{
std::cout << dbs->getDatabase(i)->getName() << " : ";
std::cout << (dbs->getDatabase(i)->isActive() ? "active" : "inactive");
std::cout << std::endl;
}
}
else
{
std::cout << "Databases-section is missing" << std::endl;
}
std::cout << std::endl;
const ms_parseoptions* parseOptions = file.getParseOptions();
if ( parseOptions->isSectionAvailable() )
{
int n = parseOptions->getNumberOfParseRules();
std::cout << "Parse rules configured:" << std::endl;
int i;
for(i=0; i < n; i++)
{
if ( parseOptions->getParseRule(i)->isAvailable() )
{
std::cout << "Rule_" << i << " : ";
std::cout << parseOptions->getParseRule(i)->getRuleStr();
std::cout << std::endl;
}
}
}
else
{
std::cout << "Parse-section is missing" << std::endl;
}
std::cout << std::endl;
const ms_wwwoptions* wwwOptions = file.getWWWOptions();
if ( wwwOptions->isSectionAvailable() )
{
int n = wwwOptions->getNumberOfEntries();
std::cout << "There are " << n << " sequence report sources configured:" << std::endl;
int i;
for(i=0; i < n; i++)
{
std::cout << wwwOptions->getEntry(i)->getName() << "_";
std::cout << ((wwwOptions->getEntry(i)->getType() == WWW_SEQ) ? "SEQ" : "REP");
std::cout << std::endl;
}
}
else
{
std::cout << "WWW-section is missing" << std::endl;
}
std::cout << std::endl;
std::cout << "Available taxonomy sources:" << std::endl;
int maxtax = file.getMaxTaxonomyRules();
int taxind;
for(taxind = 1; taxind <= maxtax; taxind++)
{
if ( file.getTaxonomyRules(taxind) != NULL )
{
std::cout << "TAXONOMY_" << taxind;
std::cout << file.getTaxonomyRules(taxind)->getIdentifier();
std::cout << std::endl;
}
}
std::cout << std::endl;
const ms_clusterparams* clusterParams = file.getClusterParams();
if ( clusterParams->isSectionAvailable() )
{
std::cout << "Cluster mode : ";
std::cout << (clusterParams->isEnabled() ? "enabled" : "disabled");
std::cout << std::endl;
}
else
{
std::cout << "Cluster-section is missing" << std::endl;
}
std::cout << std::endl;
const ms_processoroptions* procOptions = file.getProcessors();
if ( procOptions->isSectionAvailable() )
{
std::cout << procOptions->getNumberOfProcessors() << " CPU(s) configured";
std::cout << std::endl;
}
else
{
std::cout << "Processor-section is missing" << std::endl;
}
std::cout << std::endl;
const ms_mascotoptions* mascotOptions = file.getMascotOptions();
if ( mascotOptions->isSectionAvailable() )
{
std::cout << "MascotCmdLine : ";
std::cout << mascotOptions->getMascotCmdLine();
std::cout << std::endl;
}
else
{
std::cout << "Options-section is missing" << std::endl;
}
std::cout << std::endl;
const ms_cronoptions* cronOptions = file.getCronOptions();
if ( cronOptions->isSectionAvailable() )
{
if ( cronOptions->isCronEnabled() )
{
int n = cronOptions->getNumberOfCronJobs();
std::cout << "There are " << n << " cron-jobs configured:" << std::endl;
int i;
for(i=0; i < n; i++)
{
std::cout << cronOptions->getCronJob(i).getCommandStr() << std::endl;
}
}
else
{
std::cout << "Cron functionality is disabled" << std::endl;
}
}
else
{
std::cout << "Cron-section is missing" << std::endl;
}
std::cout << std::endl;
return 0;
}