Matrix Science header

resfile_input.py

Example program for retrieving input spectrum data.

#!/usr/bin/python
##############################################################################
# file: resfile_input.py                                                     #
# 'msparser' toolkit                                                         #
# Test harness / example code                                                #
##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 1998-2010 Matrix Science Limited  All Rights Reserved.           #
#                                                                            #
##############################################################################
#     $Source: /vol/cvsroot/parser/examples/test_python/resfile_input.py,v $ #
#     $Author: neilr $ #
#       $Date: 2016/03/18 16:29:18 $ #
#   $Revision: 1.2 $ #
# $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() :
        inputData(resfile)


def inputData(resfile) :
    # display input data via inputquery get functions
    for i in range(1, 2) :
        # replace range with (1, 1 + resfile.getNumQueries()) to get all input
        # data.

        print("Input data for query number %d" % i)
        print("=========================================")

        q = msparser.ms_inputquery(resfile, i)
        fmt = "    %-16s: %s"

        print(fmt % ("title"       , q.getStringTitle(1)))
        print(fmt % ("mass_min"    , q.getMassMin()))
        print(fmt % ("mass_max"    , q.getMassMax()))
        print(fmt % ("int_min"     , q.getIntMin()))
        print(fmt % ("int_max"     , q.getIntMax()))
        print(fmt % ("num_vals"    , q.getNumVals()))
        print(fmt % ("num_used1"   , q.getNumUsed()))
        print(fmt % ("ions1"       , q.getStringIons1()))
        print(fmt % ("ions2"       , q.getStringIons2()))
        print(fmt % ("ions3"       , q.getStringIons3()))
        print(fmt % ("peptol"      , q.getPepTol()))
        print(fmt % ("peptol units", q.getPepTolUnits()))
        print(fmt % ("peptol str"  , q.getPepTolString()))
        print(fmt % ("repeat srch" , resfile.getRepeatSearchString(i)))

        num_peaks = q.getNumberOfPeaks(1)
        for j in range (1, 1+ num_peaks) :
            print("%f, %f" % (q.getPeakMass(1, j), q.getPeakIntensity(1, j)))
                
    print(" ")



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


"""

Running the program as

python resfile_input.pl F981123.dat

will give the following output under Mascot Server 2.3:


Input data for query number  1
=========================================
    title           : 
    mass_min        : 72.09
    mass_max        : 1711.52
    int_min         : 1.103
    int_max         : 80.7
    num_vals        : 425
    num_used1       : 0
    ions1           : 157.096962:23.72,185.160000:26.69,286.134951:80.7,385.210000:13.49,480.270000:4.363,129.102412:18.84,187.070000:22.51,354.189124:13.57,399.246727:9.489,482.140542:3.205,130.110251:9.257,258.132661:15.93,357.210000:13.57,443.810000:6.256,481.210000:3.182,136.070000:7.387,213.139215:13.84,371.204929:11.24,459.280000:6.216,489.233770:3.157,147.117662:6.333,229.120000:9.72,326.133204:5.268,423.125582:4.262,483.115000:2.205,159.080000:5.222,240.130000:7.562,298.110000:5.231,444.168974:3.247,474.300000:1.103,158.090000:4.301,270.180000:7.432,324.170000:5.17,411.200000:3.23,475.270000:1.103,86.110000:3.276,175.110000:7.308,312.150879:4.235,463.265712:3.205,476.700000:1.103,102.060000:3.276,241.085275:5.361,293.110000:4.178,445.810000:3.182,478.180000:1.103,115.088725:3.255,243.139772:4.378,353.155308:4.149,401.150000:3.138,486.880000:1.103,72.090000:2.174,76.400000:1.103,84.075000:2.111,87.110000:1.103,88.100000:1.103,98.060000:1.103,103.060000:1.103,105.070000:1.103,116.070000:1.103,117.110000:1.103,118.400000:1.103,120.090000:2.205,126.070000:1.103,127.090000:1.103,128.090000:2.103,131.085000:2.118,132.090000:1.103,135.800000:1.103,137.080000:1.103,138.070000:1.103,139.090000:1.103,140.150000:2.174,141.060000:2.174,143.120000:2.174,146.080000:1.103,152.060000:1.103,155.070000:2.205,156.100000:1.103,159.450000:1.103,165.080000:2.136,166.110000:1.103,167.110000:1.103,169.710000:1.103,170.450000:1.103,171.090000:1.103,173.120000:2.174,177.090000:1.103,178.080000:1.103,181.160000:1.103,182.030000:1.103,183.110000:2.174,183.930000:1.103,186.131024:4.374,188.070000:1.103,188.760000:1.103,189.070000:1.103,190.065000:2.103,191.300000:1.103,197.130000:1.103,199.180000:1.103,200.080000:1.103,201.100000:3.138,202.110000:2.091,203.080000:2.174,203.610000:1.103,211.140000:4.189,212.115000:2.103,212.490000:1.103,214.985000:2.205,216.110000:2.103,217.100000:1.103,218.080000:1.103,219.090000:2.103,223.090000:3.154,224.130000:1.103,225.130000:1.103,227.170000:1.103,227.880000:1.103,228.170000:2.136,229.760000:1.103,231.950000:1.103,233.130000:1.103,234.430000:1.103,235.080000:2.103,236.590000:1.103,238.080000:4.332,239.139997:3.131,242.170000:2.205,244.090000:2.136,244.430000:2.091,245.165685:3.205,246.160000:2.197,247.110000:2.102,248.145000:2.118,249.110000:2.136,250.080000:1.103,251.160000:1.103,253.100000:1.103,254.130000:1.103,255.165000:2.22,256.170000:1.103,257.060000:1.103,259.150000:2.197,260.000000:1.103,260.490000:1.103,262.110000:1.103,265.120000:1.103,266.130000:2.159,266.950000:1.103,267.210000:1.103,268.120000:3.214,269.090000:1.103,271.150000:2.136,272.170000:2.103,274.120000:1.103,275.030000:1.103,276.175000:2.22,278.190000:1.103,279.720000:2.205,281.120000:1.103,283.070000:1.103,284.110000:1.103,285.070000:1.103,287.140000:3.296,287.780000:1.103,288.090000:2.103,290.130000:1.103,294.110000:2.174,295.150000:3.114,295.730000:1.103,297.180000:2.136,300.160000:3.143,302.070000:1.103,303.160000:1.103,303.590000:1.103,304.600000:1.103,305.130000:1.103,306.140000:3.182,307.050000:1.103,308.150000:2.174,308.490000:1.103,312.610000:1.103,312.880000:1.103,314.120000:1.103,316.085000:2.111,317.150000:3.183,318.140000:1.103,320.140000:1.103,322.149731:3.255,323.034482:3.149,327.020000:1.103,328.020000:1.103,331.140000:2.091,332.165000:2.103,333.140000:1.103,335.500000:1.103,336.190000:1.103,337.030000:2.118,338.620000:1.103,338.940000:1.103,339.200000:3.261,341.210000:2.103,342.180000:1.103,342.800000:1.103,343.225000:2.111,343.800000:1.103,344.150000:2.174,346.010000:1.103,347.660000:1.103,348.200000:2.197,349.800000:1.103,350.110000:2.118,351.130000:3.276,352.130000:2.136,353.910000:1.103,354.470000:1.103,355.193955:3.376,358.200000:1.103,359.210000:2.174,359.910000:1.103,360.470000:1.103,361.080000:1.103,362.190000:1.103,363.040000:1.103,364.080000:1.103,366.120000:1.103,367.150000:1.103,368.330000:1.103,368.730000:1.103,369.230000:3.15,369.820000:1.103,370.177065:3.279,373.130000:2.197,374.055000:2.217,374.510000:2.205,376.040000:1.103,377.040000:1.103,380.160000:2.103,382.180000:3.102,383.115000:2.209,385.890000:2.205,386.370000:1.103,387.170000:3.114,387.680000:2.217,388.050000:1.103,389.620000:1.103,390.190000:1.103,390.610000:1.103,394.260000:1.103,395.180000:1.103,396.140000:2.205,397.980000:1.103,400.165000:2.209,403.210000:1.103,404.150000:1.103,404.470000:1.103,410.165000:2.111,411.550000:1.103,413.240000:1.103,414.080000:1.103,415.000000:1.103,416.190000:1.103,416.830000:1.103,417.230000:1.103,417.760000:1.103,418.285000:2.111,418.680000:1.103,420.650000:1.103,421.170000:2.136,422.580000:1.103,425.215000:2.103,425.690000:1.103,426.220000:3.125,428.140000:2.155,428.650000:1.103,430.260000:1.103,430.995000:2.205,433.200000:1.103,433.690000:1.103,435.000000:1.103,435.260000:1.103,437.180000:1.103,438.710000:2.174,439.230000:1.103,440.210000:1.103,442.190000:1.103,443.120000:1.103,444.680000:1.103,445.120000:1.103,449.110000:1.103,450.710000:1.103,452.150000:2.209,453.240000:3.12,454.200000:1.103,454.700000:1.103,458.310000:1.103,460.290000:1.103,461.250000:1.103,461.830000:1.103,462.195000:2.103,463.850000:1.103,464.250000:1.103,467.180000:2.174,470.210000:1.103,471.120000:1.103,489.700000:1.103,493.200000:1.103,494.200000:1.103,505.200000:1.103,508.170000:2.197,508.840000:1.103,509.200000:2.103,511.450000:1.103,522.170000:2.197,523.190000:1.103,524.150000:2.174,527.160000:1.103,528.410000:2.19,529.280000:1.103,530.230000:1.103,531.250000:1.103,533.130000:1.103,533.670000:1.103,536.720000:1.103,537.240000:1.103,538.080000:1.103,538.450000:1.103,540.220000:1.103,545.210000:2.174,545.490000:1.103,546.250000:1.103,547.350000:1.103,550.750000:2.205,558.070000:1.103,561.360000:1.103,562.200000:1.103,563.330000:1.103,568.230000:1.103,571.290000:3.136,573.010000:1.103,575.410000:1.103,580.240000:1.103,581.260000:1.103,585.160000:1.103,588.380000:1.103,590.120000:1.103,599.450000:1.103,605.210000:2.197,607.285000:4.499,608.270000:3.143,613.330000:2.103,614.330000:1.103,617.320000:1.103,621.230000:1.103,622.310000:1.103,625.320000:3.23,626.210000:1.103,633.275000:2.205,640.350000:1.103,642.220000:1.103,644.280000:1.103,646.250000:1.103,648.390000:1.103,651.335000:2.103,653.360000:2.136,658.300000:1.103,662.320000:1.103,663.800000:1.103,668.275000:2.209,674.370000:1.103,676.090000:1.103,677.350000:1.103,678.070000:1.103,683.370000:1.103,684.920000:1.103,685.380000:2.091,686.390000:1.103,701.410000:1.103,702.380000:7.387,703.420000:3.12,707.360000:1.103,713.340000:1.103,718.370000:2.197,720.400000:1.103,724.180000:1.103,728.390000:1.103,734.380000:1.103,735.430000:1.103,736.360000:1.103,737.310000:1.103,741.070000:1.103,745.480000:1.103,747.290000:1.103,748.320000:1.103,754.358237:6.383,755.370000:2.136,760.490000:1.103,765.360000:1.103,767.500000:1.103,770.370000:1.103,775.230000:1.103,778.490000:1.103,792.360000:1.103,796.420000:1.103,801.380000:1.103,814.390000:2.118,815.390000:1.103,816.410000:1.103,820.470000:1.103,825.350000:1.103,841.510000:1.103,848.450000:1.103,883.450000:1.103,884.470000:1.103,896.410000:1.103,907.420000:1.103,908.430000:1.103,916.380000:1.103,1074.300000:1.103,1092.600000:1.103,1164.300000:1.103,1231.540000:1.103,1397.690000:1.103,1660.400000:1.103,1711.520000:1.103
    ions2           : 
    ions3           : 
    peptol          : 0.0
    peptol units    : 
    peptol str      : 
    repeat srch     : 497.265612 from(498.272888,1+) query(1)
157.096962, 23.720000
185.160000, 26.690000
286.134951, 80.700000
385.210000, 13.490000
480.270000, 4.363000
129.102412, 18.840000
187.070000, 22.510000
354.189124, 13.570000
399.246727, 9.489000
482.140542, 3.205000
130.110251, 9.257000
258.132661, 15.930000
357.210000, 13.570000
443.810000, 6.256000
481.210000, 3.182000
136.070000, 7.387000
213.139215, 13.840000
371.204929, 11.240000
459.280000, 6.216000
489.233770, 3.157000
147.117662, 6.333000
229.120000, 9.720000
326.133204, 5.268000
423.125582, 4.262000
483.115000, 2.205000
159.080000, 5.222000
240.130000, 7.562000
298.110000, 5.231000
444.168974, 3.247000
474.300000, 1.103000
158.090000, 4.301000
270.180000, 7.432000
324.170000, 5.170000
411.200000, 3.230000
475.270000, 1.103000
86.110000, 3.276000
175.110000, 7.308000
312.150879, 4.235000
463.265712, 3.205000
476.700000, 1.103000
102.060000, 3.276000
241.085275, 5.361000
293.110000, 4.178000
445.810000, 3.182000
478.180000, 1.103000
115.088725, 3.255000
243.139772, 4.378000
353.155308, 4.149000
401.150000, 3.138000
486.880000, 1.103000
72.090000, 2.174000
76.400000, 1.103000
84.075000, 2.111000
87.110000, 1.103000
88.100000, 1.103000
98.060000, 1.103000
103.060000, 1.103000
105.070000, 1.103000
116.070000, 1.103000
117.110000, 1.103000
118.400000, 1.103000
120.090000, 2.205000
126.070000, 1.103000
127.090000, 1.103000
128.090000, 2.103000
131.085000, 2.118000
132.090000, 1.103000
135.800000, 1.103000
137.080000, 1.103000
138.070000, 1.103000
139.090000, 1.103000
140.150000, 2.174000
141.060000, 2.174000
143.120000, 2.174000
146.080000, 1.103000
152.060000, 1.103000
155.070000, 2.205000
156.100000, 1.103000
159.450000, 1.103000
165.080000, 2.136000
166.110000, 1.103000
167.110000, 1.103000
169.710000, 1.103000
170.450000, 1.103000
171.090000, 1.103000
173.120000, 2.174000
177.090000, 1.103000
178.080000, 1.103000
181.160000, 1.103000
182.030000, 1.103000
183.110000, 2.174000
183.930000, 1.103000
186.131024, 4.374000
188.070000, 1.103000
188.760000, 1.103000
189.070000, 1.103000
190.065000, 2.103000
191.300000, 1.103000
197.130000, 1.103000
199.180000, 1.103000
200.080000, 1.103000
201.100000, 3.138000
202.110000, 2.091000
203.080000, 2.174000
203.610000, 1.103000
211.140000, 4.189000
212.115000, 2.103000
212.490000, 1.103000
214.985000, 2.205000
216.110000, 2.103000
217.100000, 1.103000
218.080000, 1.103000
219.090000, 2.103000
223.090000, 3.154000
224.130000, 1.103000
225.130000, 1.103000
227.170000, 1.103000
227.880000, 1.103000
228.170000, 2.136000
229.760000, 1.103000
231.950000, 1.103000
233.130000, 1.103000
234.430000, 1.103000
235.080000, 2.103000
236.590000, 1.103000
238.080000, 4.332000
239.139997, 3.131000
242.170000, 2.205000
244.090000, 2.136000
244.430000, 2.091000
245.165685, 3.205000
246.160000, 2.197000
247.110000, 2.102000
248.145000, 2.118000
249.110000, 2.136000
250.080000, 1.103000
251.160000, 1.103000
253.100000, 1.103000
254.130000, 1.103000
255.165000, 2.220000
256.170000, 1.103000
257.060000, 1.103000
259.150000, 2.197000
260.000000, 1.103000
260.490000, 1.103000
262.110000, 1.103000
265.120000, 1.103000
266.130000, 2.159000
266.950000, 1.103000
267.210000, 1.103000
268.120000, 3.214000
269.090000, 1.103000
271.150000, 2.136000
272.170000, 2.103000
274.120000, 1.103000
275.030000, 1.103000
276.175000, 2.220000
278.190000, 1.103000
279.720000, 2.205000
281.120000, 1.103000
283.070000, 1.103000
284.110000, 1.103000
285.070000, 1.103000
287.140000, 3.296000
287.780000, 1.103000
288.090000, 2.103000
290.130000, 1.103000
294.110000, 2.174000
295.150000, 3.114000
295.730000, 1.103000
297.180000, 2.136000
300.160000, 3.143000
302.070000, 1.103000
303.160000, 1.103000
303.590000, 1.103000
304.600000, 1.103000
305.130000, 1.103000
306.140000, 3.182000
307.050000, 1.103000
308.150000, 2.174000
308.490000, 1.103000
312.610000, 1.103000
312.880000, 1.103000
314.120000, 1.103000
316.085000, 2.111000
317.150000, 3.183000
318.140000, 1.103000
320.140000, 1.103000
322.149731, 3.255000
323.034482, 3.149000
327.020000, 1.103000
328.020000, 1.103000
331.140000, 2.091000
332.165000, 2.103000
333.140000, 1.103000
335.500000, 1.103000
336.190000, 1.103000
337.030000, 2.118000
338.620000, 1.103000
338.940000, 1.103000
339.200000, 3.261000
341.210000, 2.103000
342.180000, 1.103000
342.800000, 1.103000
343.225000, 2.111000
343.800000, 1.103000
344.150000, 2.174000
346.010000, 1.103000
347.660000, 1.103000
348.200000, 2.197000
349.800000, 1.103000
350.110000, 2.118000
351.130000, 3.276000
352.130000, 2.136000
353.910000, 1.103000
354.470000, 1.103000
355.193955, 3.376000
358.200000, 1.103000
359.210000, 2.174000
359.910000, 1.103000
360.470000, 1.103000
361.080000, 1.103000
362.190000, 1.103000
363.040000, 1.103000
364.080000, 1.103000
366.120000, 1.103000
367.150000, 1.103000
368.330000, 1.103000
368.730000, 1.103000
369.230000, 3.150000
369.820000, 1.103000
370.177065, 3.279000
373.130000, 2.197000
374.055000, 2.217000
374.510000, 2.205000
376.040000, 1.103000
377.040000, 1.103000
380.160000, 2.103000
382.180000, 3.102000
383.115000, 2.209000
385.890000, 2.205000
386.370000, 1.103000
387.170000, 3.114000
387.680000, 2.217000
388.050000, 1.103000
389.620000, 1.103000
390.190000, 1.103000
390.610000, 1.103000
394.260000, 1.103000
395.180000, 1.103000
396.140000, 2.205000
397.980000, 1.103000
400.165000, 2.209000
403.210000, 1.103000
404.150000, 1.103000
404.470000, 1.103000
410.165000, 2.111000
411.550000, 1.103000
413.240000, 1.103000
414.080000, 1.103000
415.000000, 1.103000
416.190000, 1.103000
416.830000, 1.103000
417.230000, 1.103000
417.760000, 1.103000
418.285000, 2.111000
418.680000, 1.103000
420.650000, 1.103000
421.170000, 2.136000
422.580000, 1.103000
425.215000, 2.103000
425.690000, 1.103000
426.220000, 3.125000
428.140000, 2.155000
428.650000, 1.103000
430.260000, 1.103000
430.995000, 2.205000
433.200000, 1.103000
433.690000, 1.103000
435.000000, 1.103000
435.260000, 1.103000
437.180000, 1.103000
438.710000, 2.174000
439.230000, 1.103000
440.210000, 1.103000
442.190000, 1.103000
443.120000, 1.103000
444.680000, 1.103000
445.120000, 1.103000
449.110000, 1.103000
450.710000, 1.103000
452.150000, 2.209000
453.240000, 3.120000
454.200000, 1.103000
454.700000, 1.103000
458.310000, 1.103000
460.290000, 1.103000
461.250000, 1.103000
461.830000, 1.103000
462.195000, 2.103000
463.850000, 1.103000
464.250000, 1.103000
467.180000, 2.174000
470.210000, 1.103000
471.120000, 1.103000
489.700000, 1.103000
493.200000, 1.103000
494.200000, 1.103000
505.200000, 1.103000
508.170000, 2.197000
508.840000, 1.103000
509.200000, 2.103000
511.450000, 1.103000
522.170000, 2.197000
523.190000, 1.103000
524.150000, 2.174000
527.160000, 1.103000
528.410000, 2.190000
529.280000, 1.103000
530.230000, 1.103000
531.250000, 1.103000
533.130000, 1.103000
533.670000, 1.103000
536.720000, 1.103000
537.240000, 1.103000
538.080000, 1.103000
538.450000, 1.103000
540.220000, 1.103000
545.210000, 2.174000
545.490000, 1.103000
546.250000, 1.103000
547.350000, 1.103000
550.750000, 2.205000
558.070000, 1.103000
561.360000, 1.103000
562.200000, 1.103000
563.330000, 1.103000
568.230000, 1.103000
571.290000, 3.136000
573.010000, 1.103000
575.410000, 1.103000
580.240000, 1.103000
581.260000, 1.103000
585.160000, 1.103000
588.380000, 1.103000
590.120000, 1.103000
599.450000, 1.103000
605.210000, 2.197000
607.285000, 4.499000
608.270000, 3.143000
613.330000, 2.103000
614.330000, 1.103000
617.320000, 1.103000
621.230000, 1.103000
622.310000, 1.103000
625.320000, 3.230000
626.210000, 1.103000
633.275000, 2.205000
640.350000, 1.103000
642.220000, 1.103000
644.280000, 1.103000
646.250000, 1.103000
648.390000, 1.103000
651.335000, 2.103000
653.360000, 2.136000
658.300000, 1.103000
662.320000, 1.103000
663.800000, 1.103000
668.275000, 2.209000
674.370000, 1.103000
676.090000, 1.103000
677.350000, 1.103000
678.070000, 1.103000
683.370000, 1.103000
684.920000, 1.103000
685.380000, 2.091000
686.390000, 1.103000
701.410000, 1.103000
702.380000, 7.387000
703.420000, 3.120000
707.360000, 1.103000
713.340000, 1.103000
718.370000, 2.197000
720.400000, 1.103000
724.180000, 1.103000
728.390000, 1.103000
734.380000, 1.103000
735.430000, 1.103000
736.360000, 1.103000
737.310000, 1.103000
741.070000, 1.103000
745.480000, 1.103000
747.290000, 1.103000
748.320000, 1.103000
754.358237, 6.383000
755.370000, 2.136000
760.490000, 1.103000
765.360000, 1.103000
767.500000, 1.103000
770.370000, 1.103000
775.230000, 1.103000
778.490000, 1.103000
792.360000, 1.103000
796.420000, 1.103000
801.380000, 1.103000
814.390000, 2.118000
815.390000, 1.103000
816.410000, 1.103000
820.470000, 1.103000
825.350000, 1.103000
841.510000, 1.103000
848.450000, 1.103000
883.450000, 1.103000
884.470000, 1.103000
896.410000, 1.103000
907.420000, 1.103000
908.430000, 1.103000
916.380000, 1.103000
1074.300000, 1.103000
1092.600000, 1.103000
1164.300000, 1.103000
1231.540000, 1.103000
1397.690000, 1.103000
1660.400000, 1.103000
1711.520000, 1.103000


"""

Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:50