Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
resfile_info.py

Example program for retrieving general search information.

1#!/usr/bin/python
2
17
18import sys
19import time
20import msparser
21
22def main() :
23 if len(sys.argv) < 2 :
24 print("Must specify results filename as parameter")
25 return 1
26
27 file = msparser.ms_mascotresfilebase.createResfile(sys.argv[1])
28
29 if file.isValid() :
30 searchInformation(file)
31 return 0
32
33 print("Failure")
34 return -1
35
36
37def searchInformation(resfile) :
38 """
39 Display parameters from the ms_mascotresfilebase object. The functions
40 anyPMF, anyMSMS, anySQ should normally be used in preference to isPMF etc
41 because some people submit MSMS though the sequence query window etc.
42 """
43
44 fmt = "%-20s: %s"
45
46 print("Search information from ms_mascotresfilebase")
47 print("========================================")
48 print(fmt % ("Number of queries" , resfile.getNumQueries()))
49 print(fmt % ("Number of sequences" , resfile.getNumSeqs()))
50 print(fmt % ("Sequences after tax" , resfile.getNumSeqsAfterTax()))
51 print(fmt % ("Number of residues" , resfile.getNumResidues()))
52 print(fmt % ("Execution time" , resfile.getExecTime()))
53 print(fmt % ("Date (seconds)" , resfile.getDate()))
54
55 date = time.localtime(resfile.getDate())
56 Wdays = "Mon Tue Wed Thu Fri Sat Sun".split(" ")
57 Mons = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")
58
59 print(fmt %( "Date", "%s %s %d %02d:%02d:%02d %d" % (
60 Wdays[date.tm_wday],
61 Mons[date.tm_mon - 1],
62 date.tm_mday,
63 date.tm_hour,
64 date.tm_min,
65 date.tm_sec,
66 date.tm_year
67 )))
68
69 print(fmt % ("Mascot version" , resfile.getMascotVer()))
70 print(fmt % ("Fasta version" , resfile.getFastaVer()))
71 print(fmt % ("Is PMF?" , resfile.isPMF()))
72 print(fmt % ("Is MSMS?" , resfile.isMSMS()))
73 print(fmt % ("Is SQ?" , resfile.isSQ()))
74 print(fmt % ("Is Error tolerant" , resfile.isErrorTolerant()))
75 print(fmt % ("Any PMF?" , resfile.anyPMF()))
76 print(fmt % ("Any MSMS?" , resfile.anyMSMS()))
77 print(fmt % ("Any SQ?" , resfile.anySQ()))
78 print(fmt % ("Any peptide matches" , resfile.anyFastaMatches()))
79
80 print(" ")
81
82
83if __name__ == "__main__":
84 sys.exit(main())
85
86
87""" Running the program as
88
89python resfile_info.py F981123.dat
90
91will give the following output under Mascot Server 2.3:
92
93Search information from ms_mascotresfilebase
94========================================
95Number of queries : 67
96Number of hits : 50
97Number of sequences : 257964
98Sequences after tax : 257964
99Number of residues : 93947433.0
100Execution time : 6
101Date (seconds) : 1171894187
102Date : Mon Feb 19 14:09:47 2007
103Mascot version : 2.1.119
104Fasta version : SwissProt_51.6.fasta
105Is PMF? : False
106Is MSMS? : True
107Is SQ? : False
108Is Error tolerant : False
109Any PMF? : False
110Any MSMS? : True
111Any SQ? : False
112Any peptide matches : True
113
114
115"""
116