Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_datfile Class Reference

Encapsulates the mascot.dat file that contains the most important parameters. More...

#include <ms_datfile.hpp>

Inheritance diagram for ms_datfile:
Collaboration diagram for ms_datfile:

Public Types

enum  INST_FLAGS {
  IFLG_UPDATETAXONOMY = 0x00000001 ,
  IFLG_UPDATEPARSERULES = 0x00000002 ,
  IFLG_UPDATESWISSPROT = 0x00000004 ,
  IFLG_UPDATECLUSTER = 0x00000008 ,
  IFLG_UPDATEESTTAX = 0x00000010 ,
  IFLG_ADDMISSINGOPTIONS = 0x00000020 ,
  IFLG_ADDREPORTAUTO = 0x00000040 ,
  IFLG_UPDATEAPACHEFORKOPT = 0x00000080 ,
  IFLG_ADDPERCOLATOROPT = 0x00000100 ,
  IFLG_UPDATENCBIHTTPS = 0x00000200 ,
  IFLG_UPDATEPRIDECONTAMINANTS = 0x00000400 ,
  IFLG_UPDATEDBMANAGERPERLPATH = 0x00000800 ,
  IFLG_UPDATEMSPEPSEARCHOPTS = 0x00001000 ,
  IFLG_UPDATEEXECAFTERSEARCH = 0x00002000 ,
  IFLG_UPDATEPERCOLATORFEATS = 0x00004000 ,
  IFLG_UPDATEPROTFAMILYSWITCH = 0x00008000 ,
  IFLG_UPDATEPERCOLATORUSERT = 0x00010000 ,
  IFLG_UPDATESPLITNUMOFQUERIES = 0x00020000 ,
  IFLG_UPDATESPLITDATAFILESIZE = 0x00040000 ,
  IFLG_UPDATERESULTSCACHE = 0x00080000 ,
  IFLG_DEFAULTNEWINSTALL ,
  IFLG_DEFAULTUPGRADE
}
 Flags for the updateForInstaller() function. More...
 
enum  SEQDB_INSTALL {
  SEQDB_INSTALL_SHOULD_QUERY_USER = 0x0000FFFF ,
  SEQDB_INSTALL_CUSTOMISED = 0x00000001 ,
  SEQDB_INSTALL_INACTIVE = 0x00000002 ,
  SEQDB_INSTALL_INVALID_CONFIG = 0x00000004 ,
  SEQDB_INSTALL_EXISTING_LARGER = 0x00000010 ,
  SEQDB_INSTALL_INVALID_DBNAME = 0x00000000 ,
  SEQDB_INSTALL_MUST_UPDATE_CFG = 0x000F000F ,
  SEQDB_INSTALL_MISSING_CONFIG = 0x00010000 ,
  SEQDB_INSTALL_OLD_RULES = 0x00020000 ,
  SEQDB_INSTALL_WRONG_WILDCARD = 0x00040000 ,
  SEQDB_INSTALL_CURRENT_RULES = 0x01000000
}
 Flags for checkSeqDBInstallRequest(). More...
 
enum  WST {
  WST_APACHE =0 ,
  WST_IIS =1
}
 Web server type for the updateForInstaller() function. More...
 

Public Member Functions

 ms_datfile ()
 Default constructor.
 
 ms_datfile (const char *filename, const int timeoutSec=0, const matrix_science::ms_connection_settings *cs=0)
 Immediate action constructor.
 
 ms_datfile (const ms_datfile &src)
 Copying constructor.
 
 ~ms_datfile ()
 Destructor.
 
void appendErrors (const ms_errors &src)
 Copies all errors from another instance and appends them at the end of own list.
 
unsigned int checkSeqDBInstallRequest (const std::string &dbName, const double newFastaSize) const
 Utility function for the installation program.
 
void clearAllErrors ()
 Remove all errors from the current list of errors.
 
void copyFrom (const ms_datfile *right)
 Use this member to make a copy of another instance.
 
void copyFrom (const ms_errors *right)
 Use this member to make a copy of another instance.
 
void defaultValues ()
 Can be used for initialising an instance with default values.
 
bool editedByDatabaseManager () const
 This function returns true if Database Manager has edited the mascot.dat file.
 
const ms_clusterparamsgetClusterParams () const
 Returns an instance of the class representing the Cluster section.
 
matrix_science::ms_connection_settings getConnectionSettings () const
 Returns the sessionID and proxy server for use with an HTTP transfer.
 
const ms_cronoptionsgetCronOptions () const
 Returns an instance of the class representing the Cron section.
 
const ms_databasesgetDatabases () const
 Returns an instance of the class representing the Databases section.
 
const ms_errsgetErrorHandler () const
 Retrive the error object using this function to get access to all errors and error parameters.
 
std::string getFileName () const
 Returns a path to the file that was set explicitly or the default file name.
 
int getFindFileTimeout () const
 Returns current time out value in seconds for open file operation.
 
std::string getHeaderComments () const
 Returns comment lines at the start of mascot.dat.
 
int getLastError () const
 Return the error description of the last error that occurred.
 
std::string getLastErrorString () const
 Return the error description of the last error that occurred.
 
const ms_libraryoptionsgetLibraryOptions () const
 Returns an instance of the class representing the LibraryOptions section.
 
const ms_mascotfilesgetMascotFiles () const
 Returns an instance of the class containing location of other configuration files.
 
const ms_mascotoptionsgetMascotOptions () const
 Returns an instance of the class representing the Options section.
 
int getMaxTaxonomyRules () const
 Returns a maximum possible Taxonomy section number that can be used to retrieve/set the section content.
 
const ms_parseoptionsgetParseOptions () const
 Returns an instance of the class representing the PARSE section.
 
const ms_processoroptionsgetProcessors () const
 Returns an instance of the class representing the Processors section.
 
const ms_taxonomyrulesgetTaxonomyRules (const int idx) const
 Returns an instance of the class representing one of the Taxonomy_XXX sections.
 
const ms_unigeneoptionsgetUniGeneOptions () const
 Returns an instance of the class representing the UniGene section.
 
const ms_wwwoptionsgetWWWOptions () const
 Returns an instance of the class representing the WWW section.
 
bool isValid () const
 Call this function to determine if there have been any errors.
 
ms_datfileoperator= (const ms_datfile &right)
 C++ style assignment operator.
 
void read_file ()
 Call this method in order to read the configuration information from the file.
 
void save_file ()
 Saves the content in the file.
 
void setClusterParams (const ms_clusterparams *params)
 Update the content of the Cluster section.
 
void setConnectionSettings (const matrix_science::ms_connection_settings &cs)
 Sets the sessionID and proxy server for use with an HTTP transfer.
 
void setCronOptions (const ms_cronoptions *options)
 Update the content of the Cron section.
 
void setDatabases (const ms_databases *dbs)
 Update the content of the Databases section.
 
void setFileName (const char *name)
 Set the file name explicitly, before saving or loading.
 
void setFindFileTimeout (const int seconds)
 Sets the time out for local file search.
 
void setHeaderComments (const std::string headerComments)
 Sets comment lines at the start of mascot.dat.
 
void setLibraryOptions (const ms_libraryoptions *spectralLibraryOptions)
 Update the content of the LibraryOptions section.
 
void setMascotFiles (const ms_mascotfiles *src)
 Update the location of other configuration files.
 
void setMascotOptions (const ms_mascotoptions *opt)
 Update the content of the Options section.
 
void setParseOptions (const ms_parseoptions *rules)
 Update the content of the PARSE section.
 
void setProcessors (const ms_processoroptions *info)
 Update the content of the Processors section.
 
void setTaxonomyRules (const int idx, const ms_taxonomyrules *rules)
 Update or create an existing the Taxonomy_XXX section.
 
void setUniGeneOptions (const ms_unigeneoptions *uoptions)
 Update the content of the UniGene section.
 
void setWWWOptions (const ms_wwwoptions *www)
 Update the content of the WWW section.
 
bool updateForInstaller (ms_errs &log, const char *not_mascot_dat_path, const char *mascot_dat_path, const char *licenseFilePath, const char *pathToMascot, const char *mascotURL, const char *sequenceDatabases, const bool clusterEnable, const WST wst, const char *NTGuestName, const char *NTAdminName, const unsigned int flags)
 Creates and updates mascot.dat for the Mascot Installation programs.
 

Detailed Description

Encapsulates the mascot.dat file that contains the most important parameters.

The file is divided into several sections. Each section has corresponding accessor methods (getXXX/setXXX).

The path to mascot.dat can be specified explicitly. However, several default locations will be tried if the object is used without setting a file name. Before obtaining any section content check the object for any errors that might occur using isValid() method.

Examples
common_error.cpp, config_mascotdat.cpp, and resfile_summary.cpp.

Member Enumeration Documentation

◆ INST_FLAGS

enum INST_FLAGS

Flags for the updateForInstaller() function.

See Using enumerated values and static const ints in Perl, Java, Python and C#.

Enumerator
IFLG_UPDATETAXONOMY 

Inserts missing taxonomy sections.

IFLG_UPDATEPARSERULES 

Inserts missing parse rules.

IFLG_UPDATESWISSPROT 

Add an entry for SwissProt if it doesn't exist, or update it if parse rules are wrong.

IFLG_UPDATECLUSTER 

Update the cluster section.

IFLG_UPDATEESTTAX 

Update EST_human, EST_mouse if very old taxonomy.

IFLG_ADDMISSINGOPTIONS 

Add entries missing options from the default values in not.mascot.dat.

IFLG_ADDREPORTAUTO 

Add AUTO to the list in ReportNumberChoices if it isn't already present.

IFLG_UPDATEAPACHEFORKOPT 

Update ForkForUnixApache using the value specified by the wst parameter. From Parser 2.5.2 onwards, under Windows, the value in wst is ignored and it is assumed to be WST_IIS.

IFLG_ADDPERCOLATOROPT 

Add -U to the flags in PercolatorExeFlags if it doesn't already exist.

IFLG_UPDATENCBIHTTPS 

Change TaxBrowserUrl http://www.ncbi... to TaxBrowserUrl https://www.ncbi...

IFLG_UPDATEPRIDECONTAMINANTS 

Add an entry for PRIDE_Contaminants if it doesn't exist, or update it if parse rules are wrong.

IFLG_UPDATEDBMANAGERPERLPATH 

If the path to perl for the dbman_process_tasks.pl script in the cron section is missing, or wrong, then insert ot replace.

IFLG_UPDATEMSPEPSEARCHOPTS 

If the LibrarySearch line in the Options section of mascot.dat contains ' m G ' then change this to ' m a P '. Also, if it contains " /HITS 100 " change this to " /HITS 10 ".

IFLG_UPDATEEXECAFTERSEARCH 

Update ExecAfterSearch_* lines and remove ms-createpip.exe from it.

IFLG_UPDATEPERCOLATORFEATS 

Update Percolator features set.

IFLG_UPDATEPROTFAMILYSWITCH 

Update ProteinFamilySwitch.

IFLG_UPDATEPERCOLATORUSERT 

Update PercolatorUseRT.

IFLG_UPDATESPLITNUMOFQUERIES 

Update SplitNumberOfQueries.

IFLG_UPDATESPLITDATAFILESIZE 

Update SplitDataFileSize.

IFLG_DEFAULTNEWINSTALL 

Default flags for a new installation. Just the IFLG_UPDATECLUSTER and IFLG_UPDATEAPACHEFORKOPT flag.

IFLG_DEFAULTUPGRADE 

Default flags for an upgrade. All flags except IFLG_UPDATECLUSTER, IFLG_UPDATESWISSPROT and IFLG_UPDATEPRIDECONTAMINANTS.

◆ SEQDB_INSTALL

Flags for checkSeqDBInstallRequest().

See Using enumerated values and static const ints in Perl, Java, Python and C#.

These values may be bitwise 'ORd' together.

Enumerator
SEQDB_INSTALL_SHOULD_QUERY_USER 

Bitwise 'and' the return value from checkSeqDBInstallRequest() with this value to determine if an update of the fasta files may be unwise.

SEQDB_INSTALL_CUSTOMISED 

User has an unrecognised configuration, possibly with a customised SwissProt, so installing an update may be unwise.

SEQDB_INSTALL_INACTIVE 

User has an existing configuration, but it is disabled.

SEQDB_INSTALL_INVALID_CONFIG 

User has an invalid configuration. For example, missing parse rules or specifying to use accession from the fasta and ID from the .dat.

SEQDB_INSTALL_EXISTING_LARGER 

User has an existing fasta file larger (and presumably later) than the one on the installer CD.

SEQDB_INSTALL_INVALID_DBNAME 

An unsupported dbName was passed to the function.

SEQDB_INSTALL_MUST_UPDATE_CFG 

The configuration must be updated if the newer fasta files are to be installed.

SEQDB_INSTALL_MISSING_CONFIG 

There is no configuration for the database. Installing should not give any conflict.

SEQDB_INSTALL_OLD_RULES 

For example, the rules for SwissProt are for version 51 to version 55.

SEQDB_INSTALL_WRONG_WILDCARD 

For example, could be Sprot_*.fasta rather than SwissProt_*.fasta.

SEQDB_INSTALL_CURRENT_RULES 

Currently set if the rules for SwissProt are for version 56 to version ...

◆ WST

enum WST

Web server type for the updateForInstaller() function.

See Using enumerated values and static const ints in Perl, Java, Python and C#.

Enumerator
WST_APACHE 

Apache. From Parser 2.5.2 onwards, under Windows, this value is ignored when setting ForkForUnixApache and it is assumed to be WST_IIS.

WST_IIS 

Microsoft IIS (Internet Information Services)

Constructor & Destructor Documentation

◆ ms_datfile() [1/3]

Default constructor.

The default constructor can be used to create a new ms_datfile programmatically.

◆ ms_datfile() [2/3]

ms_datfile ( const ms_datfile src)

Copying constructor.

Note
Do not use this constructor in programming languages other than C++.

Create a new copy of the object from an existing one.

Parameters
srcis the datfile to copy from.

◆ ms_datfile() [3/3]

ms_datfile ( const char *  filename,
const int  timeoutSec = 0,
const matrix_science::ms_connection_settings cs = 0 
)

Immediate action constructor.

Parameters
filenameThe file name parameter can be either a local file path or a Mascot server URL. It cannot be an empty string or NULL pointer. If it is a URL it should be of the form http://your-server/mascot/cgi.
timeoutSectimeout for open operation. For more information, see setFindFileTimeout().
csis a pointer to the connection settings. This should contain a sessionID and optionally the proxy server settings.

◆ ~ms_datfile()

~ms_datfile ( )

Destructor.

Releases all memory. Called automatically from all supported languages.

Member Function Documentation

◆ appendErrors()

void appendErrors ( const ms_errors src)
inherited

Copies all errors from another instance and appends them at the end of own list.

Parameters
srcThe object to copy the errors across from. See Maintaining object references: two rules of thumb.

◆ checkSeqDBInstallRequest()

unsigned int checkSeqDBInstallRequest ( const std::string &  dbName,
const double  newFastaSize 
) const

Utility function for the installation program.

This function is called by an installer to determine whether it is 'safe' to update a particular database. The return value is an integer that comprises one or more flags, bitwise ANDed together.

After calling this function, any errors can be found by calling isValid() and getLastErrorString().

The return value should be OR'd with ms_datfile::SEQDB_INSTALL_SHOULD_QUERY_USER to determine whether to ask the end user to confirm that they wish to continue with the installation/update of the specified database.

Parameters
dbNameCurrently only "SwissProt" and "PRIDE_Contaminants" are supported. Passing any other string will result in ms_datfile::SEQDB_INSTALL_INVALID_DBNAME being returned.
newFastaSizeis the size in bytes of the new fasta file. This is passed as a double because there is no guarantee of 64 bit integer support in Perl.
Returns
One or more ms_datfile::SEQDB_INSTALL values, ORd together.

◆ clearAllErrors()

void clearAllErrors ( )
inherited

Remove all errors from the current list of errors.

The list of 'errors' can include fatal errors, warning messages, information messages and different levels of debugging messages.

All messages are accumulated into a list in this object, until clearAllErrors() is called.

See Error Handling.

See also
isValid(), getLastError(), getLastErrorString(), getErrorHandler()
Examples
common_error.cpp, resfile_error.cpp, and resfile_summary.cpp.

◆ copyFrom() [1/2]

void copyFrom ( const ms_datfile right)

Use this member to make a copy of another instance.

C++: use the copy constructor instead.

Parameters
rightis the object to copy from.

◆ copyFrom() [2/2]

void copyFrom ( const ms_errors right)
inherited

Use this member to make a copy of another instance.

Parameters
rightis the source to initialise from

◆ defaultValues()

void defaultValues ( )

Can be used for initialising an instance with default values.

All existing settings, apart from the filename, are lost.

◆ editedByDatabaseManager()

bool editedByDatabaseManager ( ) const

This function returns true if Database Manager has edited the mascot.dat file.

If Database Manager is being used, then most sections of the file should not be edited in a text editor or by using this Mascot Parser class. See comments at the top of the mascot.dat file for further information.

Returns
true if the line
#  WARNING: Do not edit this file to make changes to        # 
is found near the top of the file

◆ getClusterParams()

const ms_clusterparams * getClusterParams ( ) const

Returns an instance of the class representing the Cluster section.

This function returns a pointer to the object held internally in the ms_datfile object. A pointer, rather than a copy of the object is returned for performance reasons.

C++: The pointer returned is 'const' so the contents cannot be altered by a C++ application. To update a mascot.dat file, create a copy of the object returned from this function using the supplied copy constructor, make the modifications and then call setClusterParams().

Other languages: Any change to the parameters returned by this function will be 'global' to the ms_datfile object.

Returns
a const pointer to the ms_clusterparams object held internally in the ms_datfile object. See Maintaining object references: two rules of thumb.
Examples
config_mascotdat.cpp.

◆ getCronOptions()

const ms_cronoptions * getCronOptions ( ) const

Returns an instance of the class representing the Cron section.

This function returns a pointer to the object held internally in the ms_datfile object. A pointer, rather than a copy of the object is returned for performance reasons.

C++: The pointer returned is 'const' so the contents cannot be altered by a C++ application. To update a mascot.dat file, create a copy of the object returned from this function using the supplied copy constructor, make the modifications and then call setCronOptions().

Other languages: Any change to the parameters returned by this function will be 'global' to the ms_datfile object.

Returns
a const pointer to the ms_cronoptions object held internally in the ms_datfile object. See Maintaining object references: two rules of thumb.
Examples
config_mascotdat.cpp.

◆ getDatabases()

const ms_databases * getDatabases ( ) const

Returns an instance of the class representing the Databases section.

This function returns a pointer to the object held internally in the ms_datfile object. A pointer, rather than a copy of the object is returned for performance reasons.

C++: The pointer returned is 'const' so the contents cannot be altered by a C++ application. To update a mascot.dat file, create a copy of the object returned from this function using the supplied copy constructor, make the modifications and then call setDatabases().

Other languages: Any change to the parameters returned by this function will be 'global' to the ms_datfile object.

Returns
a const pointer to the ms_databases object held internally in the ms_datfile object. See Maintaining object references: two rules of thumb.
Examples
config_mascotdat.cpp.

◆ getErrorHandler()

const ms_errs * getErrorHandler ( ) const
inherited

Retrive the error object using this function to get access to all errors and error parameters.

See Error Handling.

Returns
Constant pointer to the error handler
See also
isValid(), getLastError(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Examples
common_error.cpp, and http_helper_getstring.cpp.

◆ getFileName()

std::string getFileName ( ) const

Returns a path to the file that was set explicitly or the default file name.

The filename should include the complete or relative path, or it can be a URL to a Mascot server.

Returns
the current filename for mascot.dat.

◆ getFindFileTimeout()

int getFindFileTimeout ( ) const

Returns current time out value in seconds for open file operation.

This may be useful for the file that is being periodically updated or downloaded by another application. During file-copying operations the file might be inacessible. The library will still try to open it during the specified period of time.

By default, the timeout is set to zero meaning no further attempts are made to find and open the file.

Returns
Time in seconds.

◆ getHeaderComments()

std::string getHeaderComments ( ) const

Returns comment lines at the start of mascot.dat.

Multiple lines are separated by \n

The first section in the mascot.dat file is the Databases section and this must exist.

Comments before sections other than the databases section can be returned using ms_customproperty::getPreceedingComments(). The ms_databases class inherits from ms_customproperty, but due to historical reasons the comments preceding it are stored separately.

Returns
the comment lines at the start of mascot.dat

◆ getLastError()

int getLastError ( ) const
inherited

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

See Error Handling.

See also
isValid(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Returns
the error number of the last error, or 0 if there have been no errors.

◆ getLastErrorString()

std::string getLastErrorString ( ) const
inherited

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

Returns
Most recent error, warning, information or debug message

See Error Handling.

See also
isValid(), getLastError(), clearAllErrors(), getErrorHandler()
Examples
common_error.cpp, config_enzymes.cpp, config_fragrules.cpp, config_license.cpp, config_mascotdat.cpp, config_masses.cpp, config_modfile.cpp, config_procs.cpp, config_quantitation.cpp, config_taxonomy.cpp, http_helper_getstring.cpp, and tools_aahelper.cpp.

◆ getLibraryOptions()

const ms_libraryoptions * getLibraryOptions ( ) const

Returns an instance of the class representing the LibraryOptions section.

Returns
an instance of the class representing the LibraryOptions section.

◆ getMascotFiles()

const ms_mascotfiles * getMascotFiles ( ) const

Returns an instance of the class containing location of other configuration files.

This function returns a pointer to the object held internally in the ms_datfile object. A pointer, rather than a copy of the object is returned for performance reasons.

C++: The pointer returned is 'const' so the contents cannot be altered by a C++ application. To update a mascot.dat file, create a copy of the object returned from this function using the supplied copy constructor, make the modifications and then call setMascotFiles().

Other languages: Any change to the parameters returned by this function will be 'global' to the ms_datfile object.

Returns
a const pointer to the ms_mascotfiles object held internally in the ms_datfile object. See Maintaining object references: two rules of thumb.

◆ getMascotOptions()

const ms_mascotoptions * getMascotOptions ( ) const

Returns an instance of the class representing the Options section.

This function returns a pointer to the object held internally in the ms_datfile object. A pointer, rather than a copy of the object is returned for performance reasons.

C++: The pointer returned is 'const' so the contents cannot be altered by a C++ application. To update a mascot.dat file, create a copy of the object returned from this function using the supplied copy constructor, make the modifications and then call setMascotOptions().

Other languages: Any change to the parameters returned by this function will be 'global' to the ms_datfile object.

Returns
a const pointer to the ms_mascotoptions object held internally in the ms_datfile object. See Maintaining object references: two rules of thumb.
Examples
config_mascotdat.cpp.

◆ getMaxTaxonomyRules()

int getMaxTaxonomyRules ( ) const

Returns a maximum possible Taxonomy section number that can be used to retrieve/set the section content.

There are multiple taxonomy rules sections in mascot.dat: Taxonomy_1, Taxonomy_2, etc. This value is the maximum number that can be used for a taxonomy section.

See also
getTaxonomyRules(), setTaxonomyRules()
Returns
The maximum value for a taxonomy section in mascot.dat.
Examples
config_mascotdat.cpp.

◆ getParseOptions()

const ms_parseoptions * getParseOptions ( ) const

Returns an instance of the class representing the PARSE section.

This function returns a pointer to the object held internally in the ms_datfile object. A pointer, rather than a copy of the object is returned for performance reasons.

C++: The pointer returned is 'const' so the contents cannot be altered by a C++ application. To update a mascot.dat file, create a copy of the object returned from this function using the supplied copy constructor, make the modifications and then call setParseOptions().

Other languages: Any change to the parameters returned by this function will be 'global' to the ms_datfile object.

Returns
a const pointer to the ms_parseoptions object held internally in the ms_datfile object. See Maintaining object references: two rules of thumb.
Examples
config_mascotdat.cpp.

◆ getProcessors()

const ms_processoroptions * getProcessors ( ) const

Returns an instance of the class representing the Processors section.

This function returns a pointer to the object held internally in the ms_datfile object. A pointer, rather than a copy of the object is returned for performance reasons.

C++: The pointer returned is 'const' so the contents cannot be altered by a C++ application. To update a mascot.dat file, create a copy of the object returned from this function using the supplied copy constructor, make the modifications and then call setProcessors().

Other languages: Any change to the parameters returned by this function will be 'global' to the ms_datfile object.

Returns
a const pointer to the ms_processoroptions object held internally in the ms_datfile object. See Maintaining object references: two rules of thumb.
Examples
config_mascotdat.cpp.

◆ getTaxonomyRules()

const ms_taxonomyrules * getTaxonomyRules ( const int  idx) const

Returns an instance of the class representing one of the Taxonomy_XXX sections.

This function returns a pointer to the object held internally in the ms_datfile object. A pointer, rather than a copy of the object is returned for performance reasons.

C++: The pointer returned is 'const' so the contents cannot be altered by a C++ application. To update a mascot.dat file, create a copy of the object returned from this function using the supplied copy constructor, make the modifications and then call setTaxonomyRules().

Other languages: Any change to the parameters returned by this function will be 'global' to the ms_datfile object.

Taxonomy rules sections can be listed in mascot.dat in a random order and with gaps between numbers. Therefore, it is essential that the return value is checked to be not null before accessing its properties. A NULL value indicates 'no such taxonomy section'.

Parameters
idxis the ID of the taxonomy rules section. There are multiple taxonomy rules sections mascot.dat: Taxonomy_1, Taxonomy_2 etc. The value should be in the range 1 to getMaxTaxonomyRules().
Returns
a const pointer to the ms_taxonomyrules object held internally in the ms_datfile object. See Maintaining object references: two rules of thumb.
Examples
config_mascotdat.cpp.

◆ getUniGeneOptions()

const ms_unigeneoptions * getUniGeneOptions ( ) const

Returns an instance of the class representing the UniGene section.

This function returns a pointer to the object held internally in the ms_datfile object. A pointer, rather than a copy of the object is returned for performance reasons.

C++: The pointer returned is 'const' so the contents cannot be altered by a C++ application. To update a mascot.dat file, create a copy of the object returned from this function using the supplied copy constructor, make the modifications and then call setUniGeneOptions().

Other languages: Any change to the parameters returned by this function will be 'global' to the ms_datfile object.

Returns
a const pointer to the ms_unigeneoptions object held internally in the ms_datfile object. See Maintaining object references: two rules of thumb.

◆ getWWWOptions()

const ms_wwwoptions * getWWWOptions ( ) const

Returns an instance of the class representing the WWW section.

This function returns a pointer to the object held internally in the ms_datfile object. A pointer, rather than a copy of the object is returned for performance reasons.

C++: The pointer returned is 'const' so the contents cannot be altered by a C++ application. To update a mascot.dat file, create a copy of the object returned from this function using the supplied copy constructor, make the modifications and then call setWWWOptions().

Other languages: Any change to the parameters returned by this function will be 'global' to the ms_datfile object.

Returns
a const pointer to the ms_wwwoptions object held internally in the ms_datfile object. See Maintaining object references: two rules of thumb.
Examples
config_mascotdat.cpp.

◆ isValid()

bool isValid ( ) const
inherited

◆ operator=()

ms_datfile & operator= ( const ms_datfile right)

C++ style assignment operator.

Note
This operator can only be used in C++.
Parameters
rightis the object to copy from.
Returns
a reference to 'this'.

◆ read_file()

void read_file ( )

Call this method in order to read the configuration information from the file.

It shouldn't normally be necessary to call this function as it will be called automatically from the constructor. See ms_datfile::ms_datfile for further information.

Examples
common_error.cpp.

◆ save_file()

void save_file ( )

Saves the content in the file.

Saves the file using the current filename. Can only be saved as a local file.

◆ setClusterParams()

void setClusterParams ( const ms_clusterparams params)

Update the content of the Cluster section.

The ms_datfile object is updated with a copy of the data passed.

See also
getClusterParams()
Parameters
paramsis a pointer to the new ms_clusterparams.

◆ setConnectionSettings()

void setConnectionSettings ( const matrix_science::ms_connection_settings cs)

Sets the sessionID and proxy server for use with an HTTP transfer.

This value would normally be passed in the constructor.

Parameters
csis the new connection settings.

◆ setCronOptions()

void setCronOptions ( const ms_cronoptions options)

Update the content of the Cron section.

The ms_datfile object is updated with a copy of the data passed.

See also
getCronOptions()
Parameters
optionsis a pointer to the new ms_cronoptions.

◆ setDatabases()

void setDatabases ( const ms_databases dbs)

Update the content of the Databases section.

The ms_datfile object is updated with a copy of the data passed.

See also
getDatabases()
Parameters
dbsis a pointer to the new ms_databases.

◆ setFileName()

void setFileName ( const char *  name)

Set the file name explicitly, before saving or loading.

The filename should include the complete or relative path, or it can be a URL to a Mascot server.

Parameters
nameis the new filename for mascot.dat.
Examples
common_error.cpp.

◆ setFindFileTimeout()

void setFindFileTimeout ( const int  seconds)

Sets the time out for local file search.

This may be useful for the file that is being periodically updated or downloaded by another application. During file-copying operations the file might be inacessible. The library will still try to open it during the specified period of time.

By default, the timeout is set to zero meaning no further attempts are made to find and open the file.

Parameters
secondsis the time in seconds.

◆ setHeaderComments()

void setHeaderComments ( const std::string  headerComments)

Sets comment lines at the start of mascot.dat.

Multiple lines are separated by \n

The first section in the mascot.dat file is the Databases section and this must exist.

Comments before sections other than the databases section can be set using ms_customproperty::setPreceedingComments(). The ms_databases class inherits from ms_customproperty, but due to historical reasons the comments preceding it are stored separately.

Parameters
headerCommentsare new comments to replace the old ones.

◆ setLibraryOptions()

void setLibraryOptions ( const ms_libraryoptions spectralLibraryOptions)

Update the content of the LibraryOptions section.

call ms_datfile::save_file() after calling this function.

Parameters
spectralLibraryOptionsis the new LibraryOptions section.

◆ setMascotFiles()

void setMascotFiles ( const ms_mascotfiles src)

Update the location of other configuration files.

The ms_datfile object is updated with a copy of the data passed.

See also
getMascotFiles()
Parameters
srcis a pointer to the new ms_mascotfiles.

◆ setMascotOptions()

void setMascotOptions ( const ms_mascotoptions opt)

Update the content of the Options section.

The ms_datfile object is updated with a copy of the data passed.

See also
getMascotOptions()
Parameters
optis a pointer to the new ms_mascotoptions.

◆ setParseOptions()

void setParseOptions ( const ms_parseoptions rules)

Update the content of the PARSE section.

The ms_datfile object is updated with a copy of the data passed.

See also
getParseOptions()
Parameters
rulesis a pointer to the new ms_parseoptions.

◆ setProcessors()

void setProcessors ( const ms_processoroptions info)

Update the content of the Processors section.

The ms_datfile object is updated with a copy of the data passed.

See also
getProcessors()
Parameters
infois a pointer to the new ms_processoroptions.

◆ setTaxonomyRules()

void setTaxonomyRules ( const int  idx,
const ms_taxonomyrules rules 
)

Update or create an existing the Taxonomy_XXX section.

The ms_datfile object is updated with a copy of the data passed.

See also
getTaxonomyRules()
Parameters
idxis the ID of the taxonomy rules section. There are multiple taxonomy rules sections in mascot.dat: Taxonomy_1, Taxonomy_2 etc. The value should be in the range 1 to getMaxTaxonomyRules().
rulesis a pointer to the new ms_taxonomyrules. In order to erase an existing section submit NULL as this parameter.

◆ setUniGeneOptions()

void setUniGeneOptions ( const ms_unigeneoptions uoptions)

Update the content of the UniGene section.

The ms_datfile object is updated with a copy of the data passed.

See also
getUniGeneOptions()
Parameters
uoptionsis a pointer to the new ms_unigeneoptions.

◆ setWWWOptions()

void setWWWOptions ( const ms_wwwoptions www)

Update the content of the WWW section.

The ms_datfile object is updated with a copy of the data passed.

See also
getWWWOptions()
Parameters
wwwis a pointer to the new ms_wwwoptions.

◆ updateForInstaller()

bool updateForInstaller ( ms_errs log,
const char *  not_mascot_dat_path,
const char *  mascot_dat_path,
const char *  licenseFilePath,
const char *  pathToMascot,
const char *  mascotURL,
const char *  sequenceDatabasePath,
const bool  clusterEnable,
const WST  wst,
const char *  NTGuestName,
const char *  NTAdminName,
const unsigned int  flags 
)

Creates and updates mascot.dat for the Mascot Installation programs.

To use, first create a new ms_datfile using the default constructor. Then, create an ms_errs object and call ms_errs::setLoggingLevel() to set the severity level to ms_errs::sev_info. After calling updateForInstaller(), call isValid() on the passed ms_errs object, to check for any errors. If there are no errors, then call setFileName() followed by save_file(). Finally, call the isValid() function (on this object) to check that the file has been saved without error.

For a new installation, the passed mascot_dat_path must be null/empty.

The following actions are performed for both installation and upgrades:

  • The not.mascot.dat file is read.
  • In the options section, NTIUserGroup is changed to the passed value. If null or an empty string is passed, then the setting is not changed.
  • In the options section, NTIMonitorGroup is changed to the passed value. If null or an empty string is passed, then the setting is not changed.
  • In the databases section, ###ROOT###/sequence is replaced with the value passed in sequenceDatabasePath.
  • Other occurrences of ###ROOT### are replaced with pathToMascot.
  • ###HOSTNAME### is replaced with the computer hostname.
  • ###URL### is replaced with mascotURL.

The following actions are performed for a new install:

The following actions are performed for an upgrade:

  • The contents of mascot.dat are loaded into this instance of ms_datfile.

The following actions are performed depending on the passed flags:

  • ms_datfile::IFLG_UPDATETAXONOMY: Any missing taxonomy sections are added.
  • ms_datfile::IFLG_UPDATEPARSERULES: Any missing parse rules are added. For example, if there is no RULE_32 in mascot.dat, but there is a RULE_32 in not.mascot.dat, then RULE_32 is added. From version 2.5.1 onwards, this flag is ignored if the file has been editedByDatabaseManager() because database manager will add extra parse rules when required and it gets upset if the parse rules in the mascot.dat file aren't the same as those in its 'source' xml file.
  • ms_datfile::IFLG_UPDATECLUSTER: The clusterEnable flag is used to enable or disable cluster mode.
    • If there are no SubClusterSet lines, then a single SubClusterSet 0 line is added with the number of processors set to: ms_clusterparams::NUM_PROCESSORS_AUTO_DETECT.
    • If the DefaultNodeOS value is not correct, then this is set correctly and the DefaultNodeHomeDir is set to either "C:/MascotNode" or "/usr/local/mascotnode"
    • For Windows, if DefaultNodeHomeDirFromMaster is commented, then it is uncommented.
    • For Windows, if MascotNodeScript is uncommented, then it is commented.
    • For Linux, if DefaultNodeHomeDirFromMaster is uncommented, then it is commented.
    • For Linux, if MascotNodeScript is commented, then it is uncommented.
  • ms_datfile::IFLG_UPDATESWISSPROT: The following actions are only performed if the return value of checkSeqDBInstallRequest() has the ms_datfile::SEQDB_INSTALL_MUST_UPDATE_CFG bits set.
    • The three parse rules required for SwissProt are added if necessary. This may require that new rules are added with different numbers.
    • If there is no entry for the SwissProt database, then add the relevant lines from not.mascot.dat, changing ###ROOT###/sequence with the value passed in sequenceDatabasePath, and possibly changing the rule numbers as appropriate.
    • The wildcard part of the path is set to SwissProt_*.fasta.
  • ms_datfile::IFLG_UPDATEPRIDECONTAMINANTS: The following actions are only performed if the return value of checkSeqDBInstallRequest() has the ms_datfile::SEQDB_INSTALL_MUST_UPDATE_CFG bits set.
    • The three parse rules required for PRIDE_Contaminants are added if necessary. This may require that new rules are added with different numbers.
    • If there is no entry for the PRIDE_Contaminants database, then add the relevant lines from not.mascot.dat, changing ###ROOT###/sequence with the value passed in sequenceDatabasePath, and possibly changing the rule numbers as appropriate.
    • The wildcard part of the path is set to PRIDE_Contaminants_*.msp.
  • ms_datfile::IFLG_UPDATEESTTAX: If the EST_human database has taxonomy rule 0, and a Taxonomy_10 section was added, then change the rule to Taxonomy_10.
  • ms_datfile::IFLG_UPDATEESTTAX: If the EST_mouse database has taxonomy rule 0, and a Taxonomy_11 section was added, then change the rule to Taxonomy_11.
  • ms_datfile::IFLG_ADDMISSINGOPTIONS: Add entries missing in the options section from the default values in not.mascot.dat.
  • ms_datfile::IFLG_ADDMISSINGOPTIONS: If an upgrade, the config/db_manager/global.conf file is read if it exists, and proxy settings copied over. If mascot.dat already contains proxy settings, the global.conf file is ignored.
  • ms_datfile::IFLG_ADDREPORTAUTO: If there is no AUTO in ReportNumberChoices, then this is added.
  • ms_datfile::IFLG_ADDPERCOLATOROPT: If there is no -U in PercolatorExeFlags, then this is added.
  • ms_datfile::IFLG_UPDATENCBIHTTPS:
  • ms_datfile::IFLG_UPDATEMSPEPSEARCHOPTS:
    • If LibrarySearch contains " m G " (the 2.6 option) then replace this with " m a P ". See ms_mascotoptions::getPepSearchTool for further details.
    • If LibrarySearch contains " /HITS 100 " (the 2.6 option) then replace this with " /HITS 10 ".

Possible error messages:

  • Any read/parse errors for mascot.dat or not.mascot.dat will be reported.
  • ms_errs::ERR_MSP_INST_FAILADDPARSERULE will be reported if all 255 available parse rules have been used, and the rules required for SwissProt cannot be added.

All other issues are treated as warnings.

Parameters
logis used to collect errors and information messages.
not_mascot_dat_pathThe file must exist or an error will be reported.
mascot_dat_pathmay be null (or an empty string) for a clean installation where there is no existing mascot.dat If specified, the file must exist.
licenseFilePathnot used in Parser version 2.4.1 and later. The number of threads to use for each database is set to an 'auto' value in Mascot 2.4 and later.
pathToMascotis used for when mascot_dat_path is null, and is used to replace ###ROOT###. Any backslashes will be replaced with forward slashes. The caller is responsible for ensuring that the string doesn't contain any spaces.
mascotURLis used to replace ###URL###. It doesn't matter if the URL ends with a '/' or not. This parameter is also used to explicitly update ResultsFullURL to mascotURL/cgi/master_results.pl unless a null pointer or an empty string is passed. It is not used to update ResultsFullURL_2 because this may have been manually set to master_results.pl because a user does not like the family reports.
sequenceDatabasePathis used to replace ###ROOT###/sequence. Any backslashes will be replaced with forward slashes. The caller is responsible for ensuring that the string doesn't contain any spaces.
clusterEnableshould be set to true to enable cluster mode. If IFLG_UPDATECLUSTER is not set, this flag is ignored.
wstShould be set to WST_APACHE or WST_IIS.
NTGuestNameShould be set to the guest group name (Windows only). Should only be passed for a new installation.
NTAdminNameShould be set to Administrators group name (Windows only). Should only be passed for a new installation.
flagsSpecifies which actions to take. See ms_datfile::INST_FLAGS for further information. Most common values to use are ms_datfile::IFLG_DEFAULTNEWINSTALL or ms_datfile::IFLG_DEFAULTUPGRADE.
Returns
false if the hostname is missing, or if not.mascot.dat or the result file is not valid, true otherwise

The documentation for this class was generated from the following files: