Matrix Science header

Python toolkit installation
[Installing Mascot Parser]

To use the toolkit, a Python interpreter must be installed.

In Windows, the supported versions of Python are 2.7, 3.4, 3.6, 3.7, 3.8 and 3.9. Only 64-bit versions are supported. Both official Python (CPython) from https://python.org and ActiveState ActivePython from https://www.activestate.com/ are supported.

On Linux systems, the supported versions of Python are 2.7, 3.4, 3.6, 3.7, 3.8 and 3.9. Only 64-bit versions are supported. Python can be installed from the package repository of most Linux distributions, and it can also be downloaded and compiled from source from from https://python.org/.

Please contact us if you require Mascot Parser for a different version of Python.

Note:
Mascot Parser Python modules are not Unicode-aware. Make sure that any string objects you pass as parameters to Mascot Parser functions are non-Unicode string objects.

To use Mascot Parser in your program, the files msparser.py and _msparser.pyd (_msparser.so on Linux) must either be in the same directory as your program, or in a directory searched by the Python interpreter. In the latter case, there are three alternatives.

Define or modify PYTHONPATH:

You can define the PYTHONPATH environment variable to point to the directory where Mascot Parser Python files are located.

Use sys.path.append():

You can use sys.path.append() in your program to add the directory where Mascot Parser files are located to the module search path. This is equivalent to modifying PYTHONPATH, except that the path is hardcoded in your program.

Global installation:

You can copy the Mascot Parser Python files to the site-packages directory of your Python installation.

  • In Windows, assuming CPython 3.6 or ActivePython 3.6, this is C:\Python36\Lib\site-packages.
  • In Linux, this is similar to /usr/local/lib/python3.6/site-packages, assuming Python 3.6. The exact path depends on how the Python version has been configured.

Visual C++ Redistributable Package (Windows)

You may also need to install the Microsoft Visual C++ 2015 (or later) Redistributable Package
To check if you need this:

  1. Download and run depends.exe from http://www.dependencywalker.com/ or Dependencies program from https://github.com/lucasg/Dependencies
  2. Open msparser.dll in the program.
  3. If it reports that the dependent MSVCR140.dll and MSVCP140.dll are missing, download the Visual C++ 2015 (or later) redistributable package from the Microsoft Download Center: https://support.microsoft.com/en-us/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0
  4. Choose vc_redist.x86.exe for 32-bit and vc_redist.x64.exe for 64-bit

Running a Python example on Windows

Open a command prompt, and change to the example_python directory. To run, say, resfile_error.py:

    python.exe resfile_error.py C:\Inetpub\mascot\data\F981119.dat

If python.exe is not in PATH%, prefix the command with the absolute path to python.exe.

Running a Python example on Linux

Open a terminal window, and change to the example_python directory. To run, say, resfile_error.py:

    ./resfile_error.py /usr/local/mascot/data/F981119.dat

This only works if resfile_error.py has the executable bit set, and if the script has the correct "shebang" line. The "shebang" line is the first line of the script, and gives the location of the Python interpreter:

    #!/usr/bin/python

You can use the Python interpreter directly:

    python resfile_error.py /usr/local/mascot/data/F981119.dat

Using the Python toolkit

Reasonable proficiency in Python programming will be required. Please see Quickstart: how to open a results file and Examples for the results file module.


Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:30