Matrix Science header

Configuration files
[Mascot configuration files module]

Mascot configuration files are represented by library classes and can be dealt with programmatically from programs written in the supported languages.

Configuration file classes

The following configuration files are supported:

mascot.dat

Main configuration file represented by the ms_datfile class and divided into several sections. Each section is, in turn, represented by a corresponding class.

enzymes

List of available enzymes. The corresponding class is ms_enzymefile.

fragmentation_rules

Information about available instruments for MS/MS searches; represented by ms_fragrulesfile.

mascot.license

Software license file that can only be local read-only file. The corresponding class ms_license allows checking the validity of the license and to obtain some additional information. Please note the ms_license class will only work with license files from Mascot release 2.3 or earlier.

masses

Chemical elements and amino acid masses. Can be read/written with ms_masses.

mod_file and substitutions

Modifications for regular and error-tolerant searches, respectively. The single class ms_modfile can process both of them.

unimod.xml

Protein modifications; can be accessed in read-only mode on http://www.unimod.org using either ms_modfile or ms_umod_configfile.

quantitation.xml
Configuration parameters for quantitation experiments; represented by ms_quant_configfile.

One additional class, ms_processors, doesn't correspond to any file but can be used to obtain information about available CPUs in the system.

All files except for mascot.license and unimod.xml can be read and written locally in text format. ms_modfile can import the unimod.xml file and then store all configuration information in a local text file, but not vice versa. ms_umod_configfile allows changing the content and saving unimod.xml in XML-format locally.

Each configuration file class provides a range of get/set methods for accessing individual properties. Instances of the classes can be used even without accessing a physical or remote file; default values are provided where appropriate. However, classes that represent configuration files with many entries (enzymes, instruments, modifications, etc.) will by default contain empty lists of entries.

In general, all files except for mascot.license can be accessed remotely via Internet, altered and then stored locally (if needed). These operations are described in more detail below.

Reading from and writing to configuration files

Reading from a configuration file can be done in two ways. The easiest way is to use an immediate-action constructor that accepts a string file name as a parameter:

C++
    matrix_science::ms_datfile datFile("../config/mascot.dat");

    if ( datFile.isValid() )
    { 
        // extract some properties here 
        // ... 
    } 

Perl
    my $datFile = msparser::ms_datfile->new("../config/mascot.dat");

    if ($datFile->isValid()) { 
        # extract some properties here 
        # ... 
    } 

Java and C#
    ms_datfile datFile = new ms_datfile("../config/mascot.dat");

    if (datFile.isValid())
    { 
        // extract some properties here 
        // ... 
    } 

Python
    ms_datfile = msparser.ms_datfile("../config/mascot.dat")

    if datFile.isValid() :
        # extract some properties here 
        # ... 

As shown in the last example, an object has to be tested for the presence of any fatal errors before continuing any work with it. Possible errors include a missing or inaccessible file as well as wrong file format or inconsistent values. Every class representing a configuration file is derived from ms_errors; please refer to Error Handling for details.

Another way to read from a file is to create an instance of representing class, set a file name and call the read_file() method:

C++
    ms_enzymefile enzFile();
    enzFile.setFileName("../config/enzymes");
    enzFile.read_file();

    if (enzFile.isValid()) 
    {
        // obtain information here
        // ...
    }

Perl
    my $enzFile = new msparser::ms_enzymefile();
    $enzFile->setFileName("../config/enzymes");
    $enzFile->read_file();

    if ($enzFile->isValid()) {
        # obtain information here
        # ...
    }

Java and C#
    ms_enzymefile enzFile = new ms_enzymefile();
    enzFile.setFileName("../config/enzymes");
    enzFile.read_file();

    if (enzFile.isValid()) 
    {
        // obtain information here
        // ...
    }

Python
    enzFile = msparser.ms_enzymefile()
    enzFile.setFileName("../config/enzymes")
    enzFile.read_file()

    if enzFile.isValid() :
        # obtain information here
        # ...

One exception to these examples is ms_quant_configfile, which requires a local path to an XML schema file in addition to the quantitation.xml file name and path. You can submit the schema path to either the constructor or by using the setSchemaFileName() method:

C++
    // Here we access the file remotely (see below for more information), but
    // a local file name can also be used. However, the schema file should be
    // stored locally.
    ms_quant_configfile quantFile("http://localhost/mascot/cgi", "C:\quantitation_1.xsd"); 

    if (quantFile.isValid()) {
        // obtain information here 
        // ... 
    }

Perl
    # Here we access the file remotely (see below for more information), but
    # a local file name can also be used. However, the schema file should be
    # stored locally.
    my $quantFile = new msparser::ms_quant_configfile(
        "http://localhost/mascot/cgi", "C:\quantitation_1.xsd"
    ); 

    if ($quantFile->isValid()) {
        # obtain information here 
        # ... 
    }

Java and C#
    // Here we access the file remotely (see below for more information), but
    // a local file name can also be used. However, the schema file should be
    // stored locally.
    ms_quant_configfile quantFile = new ms_quant_configfile(
        "http://localhost/mascot/cgi", "C:\quantitation_1.xsd"
    ); 

    if (quantFile.isValid()) {
        // obtain information here 
        // ... 
    }

Python
    # Here we access the file remotely (see below for more information), but
    # a local file name can also be used. However, the schema file should be
    # stored locally.
    quantFile = msparser.ms_quant_configfile(
        "http://localhost/mascot/cgi", "C:\quantitation_1.xsd"
        ) 

    if quantFile.isValid() :
        # obtain information here 
        # ... 

The quantitation schema file is distributed as part of Mascot Parser and should not be changed to avoid parsing problems.

Writing to files is only allowed on local files (on a hard disc or in a local network). Writing can be done via using the save_file() method. You can use setFileName() to change the file name and path if you need to save the file in a new location.

XML-format configuration files

unimod.xml can be opened with ms_modfile; supply it with the full file name (absolute or relative) that has a proper extension '.xml'. Files with any other extension will be treated as being in a text format.

ms_modfile cannot be used to save data in unimod.xml. If the content is initially imported from it, then it can only be stored as a new text file with a different name. One of the reasons for this restriction lies in inevitable loss of information while importing Unimod files. ms_umod_configfile was designed to overcome this limitation.

Remote file location

All configuration files except for mascot.license can be accessed remotely in the same way as they are read from local files. The mandatory prefix http:// has to be used to indicate the remote location. Configuration files are accessed though the get_params.pl script on Mascot Server, which is in the mascot/cgi directory. Example URL:

   http://your-server/mascot/cgi 

The configuration file class adds /get_params.pl?Show=xxxx to the end of the URL.

The Unimod file can only be accessed at an explicit location (usually http://www.unimod.org/xml/unimod.xml).

A proxy server may have to be defined before downloading files from the Intranet/Internet. This can be done in one of two possible ways:

C++
    // Setting the proxy server explicitly:
    ms_datfile::setProxyServer("proxy_server_name"); 
    ms_datfile::setProxyUsername("user_name"); 
    ms_datfile::setProxyPassword("user_password"); 
    // Now we can download safely.
    ms_fragrulesfile fragRules("http://host_name/mascot/cgi"); 

    // Retrieving proxy settings from mascot.dat:
    ms_datfile datFile("../config/mascot.dat");
    // Now we can download safely.
    ms_umod_configfile unimodFile("http://www.unimod.org/xml/unimod.xml");

Perl
    # Setting the proxy server explicitly:
    msparser::ms_datfile::setProxyServer("proxy_server_name"); 
    msparser::ms_datfile::setProxyUsername("user_name"); 
    msparser::ms_datfile::setProxyPassword("user_password"); 
    # Now we can download safely.
    my $fragRules = msparser::ms_fragrulesfile->new("http://host_name/mascot/cgi"); 

    # Retrieving proxy settings from mascot.dat:
    my $datFile = msparser::ms_datfile->new("../config/mascot.dat");
    # Now we can download safely.
    my $unimodFile = msparser::ms_umod_configfile->new("http://www.unimod.org/xml/unimod.xml");

Java and C#
    // Setting the proxy server explicitly:
    ms_datfile.setProxyServer("proxy_server_name"); 
    ms_datfile.setProxyUsername("user_name"); 
    ms_datfile.setProxyPassword("user_password"); 
    // Now we can download safely.
    ms_fragrulesfile fragRules = new ms_fragrulesfile("http://host_name/mascot/cgi"); 

    // Retrieving proxy settings from mascot.dat:
    ms_datfile datFile = new ms_datfile("../config/mascot.dat");
    // Now we can download safely.
    ms_umod_configfile unimodFile = new ms_umod_configfile("http://www.unimod.org/xml/unimod.xml");

Python
    # Setting the proxy server explicitly:
    msparser.ms_datfile.setProxyServer("proxy_server_name")
    msparser.ms_datfile.setProxyUsername("user_name")
    msparser.ms_datfile.setProxyPassword("user_password")
    # Now we can download safely.
    fragRules = msparser.ms_fragrulesfile("http://host_name/mascot/cgi")

    # Retrieving proxy settings from mascot.dat:
    datFile = msparser.ms_datfile("../config/mascot.dat")
    # Now we can download safely.
    unimodFile = msparser.ms_umod_configfile("http://www.unimod.org/xml/unimod.xml")
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51