Matrix Science header

resfile_params.py

Example program for retrieving search parameter data.

#!/usr/bin/perl
##############################################################################
# file: resfile_params.py                                                    #
# 'msparser' toolkit                                                         #
# Test harness / example code                                                #
##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 1998-2010 Matrix Science Limited  All Rights Reserved.           #
#                                                                            #
##############################################################################
#     $Source: parser/examples/test_python/resfile_params.py $ #
#     $Author: villek@matrixscience.com $ #
#       $Date: 2018-07-30 16:23:53 +0100 $ #
#   $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $ #
# $NoKeywords::                                                            $ #
##############################################################################

import msparser
import sys

def main() :
    if len(sys.argv) < 2 :
        print("Must specify results filename as parameter")
        return 1

    resfile = msparser.ms_mascotresfile(sys.argv[1])

    if resfile.isValid() :
        searchParameters(resfile)


def searchParameters(resfile) :
    """
    Display parameters from the ms_searchparams object.
    The values come from the parameters and the masses sections of the file.
    """

    params = resfile.params()
    fmt = "%-20s: %s"

    print("Search parameters from ms_searchparams")
    print("=========================================")
    print(fmt % ("License"             , params.getLICENSE()))
    print(fmt % ("Search title"        , params.getCOM()))
    print(fmt % ("SEG mass"            , params.getSEG()))
    print(fmt % ("Peptide tol"         , params.getTOL()))
    print(fmt % ("Peptide tol units"   , params.getTOLU()))
    print(fmt % ("Fragment tol"        , params.getITOL()))
    print(fmt % ("Fragment tol units"  , params.getITOLU()))
    print(fmt % ("Missed cleavages"    , params.getPFA()))
    print(fmt % ("Database"            , params.getDB()))
    print(fmt % ("Static mods"         , params.getMODS()))
    print(fmt % ("Average/monoisotopic", params.getMASS()))
    print(fmt % ("Enzyme"              , params.getCLE()))
    print(fmt % ("Raw data file name"  , params.getFILENAME()))
    print(fmt % ("Input data"          , params.getQUE()))
    print(fmt % ("Type of search"      , params.getSEARCH()))
    print(fmt % ("User name"           , params.getUSERNAME()))
    print(fmt % ("User email"          , params.getUSEREMAIL()))
    print(fmt % ("Charge state"        , params.getCHARGE()))
    print(fmt % ("Repeat search file"  , params.getINTERMEDIATE()))
    print(fmt % ("Num hits to display" , params.getREPORT()))
    print(fmt % ("Show overview"       , params.getOVERVIEW()))
    print(fmt % ("Data file format"    , params.getFORMAT()))
    print(fmt % ("Form version"        , params.getFORMVER()))
    print(fmt % ("Variable mods"       , params.getIT_MODS()))

    for i in range(12) :
        print(fmt % ( "User%02d" % i, params.getUSERField(i)))
    
    print(fmt % ("Precursor mass"      , params.getPRECURSOR()))
    print(fmt % ("Taxonomy filter"     , params.getTAXONOMY()))
    print(fmt % ("Type of report"      , params.getREPTYPE()))
    print(fmt % ("Accessions to search", params.getACCESSION()))
    print(fmt % ("Subcluster used"     , params.getSUBCLUSTER()))
    print(fmt % ("ICAT search?"        , params.getICAT()))
    print(fmt % ("Instrument type"     , params.getINSTRUMENT()))
    print(fmt % ("Error tolerant?"     , params.getERRORTOLERANT()))
    print(fmt % ("Rules (ions series)" , params.getRULES()))

    for ch in range(ord('A'), 1 + ord('Z')) :
        print(fmt % ("Residue " + chr(ch), params.getResidueMass(chr(ch))))
    
    print(fmt % ("C terminus mass" , params.getCTermMass()))
    print(fmt % ("N terminus mass" , params.getNTermMass()))
    print(fmt % ("Mass of hydrogen", params.getHydrogenMass()))
    print(fmt % ("Mass of oxygen"  , params.getOxygenMass()))
    print(fmt % ("Mass of carbon"  , params.getCarbonMass()))
    print(fmt % ("Mass of nitrogen", params.getNitrogenMass()))
    print(fmt % ("Mass of electron", params.getElectronMass()))

    i = 1
    while params.getVarModsName(i) :
        print(fmt % ("Variable mod name"   , params.getVarModsName(i)))
        print(fmt % ("Variable mod delta"  , params.getVarModsDelta(i)))
        print(fmt % ("Variable mod neutral", params.getVarModsNeutralLoss(i)))
        i += 1

    print(" ")


if __name__ == "__main__" :
    sys.exit(main())


"""

Running the program as

python resfile_params.pl F981123.dat

will give the following output under Mascot Server 2.3:


Search parameters from ms_searchparams
=========================================
License             : Licensed to: Matrix Science Internal use only - Frill, (4 processors).
Search title        : MS/MS Example
SEG mass            : -1
Peptide tol         : 0.2
Peptide tol units   : Da
Fragment tol        : 0.2
Fragment tol units  : Da
Missed cleavages    : 1
Database            : SwissProt
Static mods         : 
Average/monoisotopic: Monoisotopic
Enzyme              : Trypsin
Raw data file name  : C:\Auto MSMS output\Sample 1.pkl
Input data          : 
Type of search      : MIS
User name           : 
User email          : 
Charge state        : 2+
Repeat search file  : ../data/F981123.dat
Num hits to display : 0
Show overview       : False
Data file format    : Mascot generic
Form version        : 1.01
Variable mods       : Oxidation (M)
User00              : 
User01              : 
User02              : 
User03              : 
User04              : 
User05              : 
User06              : 
User07              : 
User08              : 
User09              : 
User10              : 
User11              : 
Precursor mass      : 0.0
Taxonomy filter     : All entries
Type of report      : Peptide
Accessions to search: 
Subcluster used     : -1
ICAT search?        : False
Instrument type     : ESI-QUAD-TOF
Error tolerant?     : False
Rules (ions series) : 1,2,8,9,10,13,14,15
Residue A           : 71.037114
Residue B           : 114.53494
Residue C           : 103.009185
Residue D           : 115.026943
Residue E           : 129.042593
Residue F           : 147.068414
Residue G           : 57.021464
Residue H           : 137.058912
Residue I           : 113.084064
Residue J           : 0.0
Residue K           : 128.094963
Residue L           : 113.084064
Residue M           : 131.040485
Residue N           : 114.042927
Residue O           : 0.0
Residue P           : 97.052764
Residue Q           : 128.058578
Residue R           : 156.101111
Residue S           : 87.032028
Residue T           : 101.047679
Residue U           : 150.95363
Residue V           : 99.068414
Residue W           : 186.079313
Residue X           : 111.0
Residue Y           : 163.063329
Residue Z           : 128.55059
C terminus mass     : 17.00274
N terminus mass     : 1.007825
Mass of hydrogen    : 1.007825
Mass of oxygen      : 15.994915
Mass of carbon      : 12.0
Mass of nitrogen    : 14.003074
Mass of electron    : 0.000549
Variable mod name   : Oxidation (M)
Variable mod delta  : 15.994919
Variable mod neutral: 0.0


"""


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