Example program for retrieving general search information.
#!/usr/bin/python ############################################################################## # file: resfile_info.py # # 'msparser' toolkit # # Test harness / example code # ############################################################################## # COPYRIGHT NOTICE # # Copyright 1998-2010 Matrix Science Limited All Rights Reserved. # # # ############################################################################## # $Source: parser/examples/test_python/resfile_info.py $ # # $Author: villek@matrixscience.com $ # # $Date: 2018-07-30 16:23:53 +0100 $ # # $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $ # # $NoKeywords:: $ # ############################################################################## import sys import time import msparser def main() : if len(sys.argv) < 2 : print("Must specify results filename as parameter") return 1 file = msparser.ms_mascotresfile(sys.argv[1]) if file.isValid() : searchInformation(file) return 0 print("Failure") return -1 def searchInformation(resfile) : """ Display parameters from the ms_mascotresfile object. The functions anyPMF, anyMSMS, anySQ should normally be used in preference to isPMF etc because some people submit MSMS though the sequence query window etc. """ fmt = "%-20s: %s" print("Search information from ms_mascotresfile") print("========================================") print(fmt % ("Number of queries" , resfile.getNumQueries())) print(fmt % ("Number of hits" , resfile.getNumHits())) print(fmt % ("Number of sequences" , resfile.getNumSeqs())) print(fmt % ("Sequences after tax" , resfile.getNumSeqsAfterTax())) print(fmt % ("Number of residues" , resfile.getNumResidues())) print(fmt % ("Execution time" , resfile.getExecTime())) print(fmt % ("Date (seconds)" , resfile.getDate())) date = time.localtime(resfile.getDate()) Wdays = "Mon Tue Wed Thu Fri Sat Sun".split(" ") Mons = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ") print(fmt %( "Date", "%s %s %d %02d:%02d:%02d %d" % ( Wdays[date.tm_wday], Mons[date.tm_mon - 1], date.tm_mday, date.tm_hour, date.tm_min, date.tm_sec, date.tm_year ))) print(fmt % ("Mascot version" , resfile.getMascotVer())) print(fmt % ("Fasta version" , resfile.getFastaVer())) print(fmt % ("Is PMF?" , resfile.isPMF())) print(fmt % ("Is MSMS?" , resfile.isMSMS())) print(fmt % ("Is SQ?" , resfile.isSQ())) print(fmt % ("Is Error tolerant" , resfile.isErrorTolerant())) print(fmt % ("Any PMF?" , resfile.anyPMF())) print(fmt % ("Any MSMS?" , resfile.anyMSMS())) print(fmt % ("Any SQ?" , resfile.anySQ())) print(fmt % ("Any peptides section" , resfile.doesSectionExist(msparser.ms_mascotresfile.SEC_PEPTIDES))) print(fmt % ("Any peptide matches" , resfile.anyPeptideSummaryMatches())) print(" ") if __name__ == "__main__": sys.exit(main()) """ Running the program as python resfile_info.py F981123.dat will give the following output under Mascot Server 2.3: Search information from ms_mascotresfile ======================================== Number of queries : 67 Number of hits : 50 Number of sequences : 257964 Sequences after tax : 257964 Number of residues : 93947433.0 Execution time : 6 Date (seconds) : 1171894187 Date : Mon Feb 19 14:09:47 2007 Mascot version : 2.1.119 Fasta version : SwissProt_51.6.fasta Is PMF? : False Is MSMS? : True Is SQ? : False Is Error tolerant : False Any PMF? : False Any MSMS? : True Any SQ? : False Any peptides section: True Any peptide matches : True """
Copyright © 2022 Matrix Science Ltd. All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29 |