Read in the enzymes file.
#!/usr/bin/python ############################################################################## # file: config_enzymes.py # # 'msparser' toolkit example code # ############################################################################## # COPYRIGHT NOTICE # # Copyright 1998-2010 Matrix Science Limited All Rights Reserved. # # # ############################################################################## # $Source: parser/examples/test_python/config_enzymes.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 if len(sys.argv) < 2 : print(""" The location of enzymes file has to be specified as a parameter. The location should either be the full path to the enzymes file or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi """) sys.exit(1) # A sessionID can optionally be passed as the second parameter. # This will only be required if the 'file' is a URL. if len(sys.argv) > 2 : cs = msparser.ms_connection_settings() cs.setSessionID(sys.argv[2]) file = msparser.ms_enzymefile(sys.argv[1], cs) else : file = msparser.ms_enzymefile(sys.argv[1]) if not file.isValid() : print("There are errors. Cannot continue. The last error description:") print(file.getLastErrorString()) sys.exit(1) n = file.getNumberOfEnzymes() print("There are " + str(n) + " enzyme definitions available") for i in range(n) : enzyme = file.getEnzymeByNumber(i) defs = [] for c in range(enzyme.getNumberOfCutters()) : if enzyme.getCutterType(c) == msparser.ms_enzyme.NTERM_CUTTER : term = "nTerm" else : term = "cTerm" defs.append("%s - %s!%s" % (term, enzyme.getCleave(c), enzyme.getRestrict(c))) print("%s: %s" % (enzyme.getTitle(), "; ".join(defs))) # Now try updating the first one in the list to semi-specific. enzyme = file.getEnzymeByNumber(0) enzyme.setSemiSpecific(1) file.updateEnzymeByNumber(0, enzyme) # And delete V8-DE. file.deleteEnzymeByName("V8-DE") # Finally, save the file under a new name. file.setFileName(sys.argv[1] + ".new") file.save_file() if not file.isValid() : print("Failed to save: %s" % file.getLastErrorString()) else : print("%s.new now has %d enzyme definitions available" % (sys.argv[1], file.getNumberOfEnzymes())) """ Running the program as python config_enzymes.pl /usr/local/mascot/config/enzymes will give the following output under Mascot Server 2.3 There are 21 enzyme definitions available Trypsin: cTerm - KR!P Trypsin/P: cTerm - KR! Arg-C: cTerm - R!P Asp-N: nTerm - BD! Asp-N_ambic: nTerm - DE! Chymotrypsin: cTerm - FLWY!P CNBr: cTerm - M! CNBr+Trypsin: cTerm - M!; cTerm - KR!P Formic_acid: nTerm - D!; cTerm - D! Lys-C: cTerm - K!P Lys-C/P: cTerm - K! LysC+AspN: nTerm - BD!; cTerm - K!P Lys-N: nTerm - K! PepsinA: cTerm - FL! semiTrypsin: cTerm - KR!P TrypChymo: cTerm - FKLRWY!P TrypsinMSIPI: nTerm - J!; cTerm - KR!P; cTerm - J! TrypsinMSIPI/P: nTerm - J!; cTerm - JKR! V8-DE: cTerm - BDEZ!P V8-E: cTerm - EZ!P None: cTerm - KR!P /usr/local/mascot/config/enzymes.new now has 20 enzyme definitions available """
Copyright © 2022 Matrix Science Ltd. All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29 |