Example program for reading and manipulating the quantitation.xml file.
import msparser
import sys
if len(sys.argv) < 2 :
print("""
The location of quantitation.xml file has to be specified as a parameter.
The location should either be the full path to the quantitation.xml file
or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi
""")
sys.exit(1)
if len(sys.argv) < 3 :
print("""
The location of schema file quantitation_XXX.xsd has to be specified as the
second parameter. The location should only be a full or relative path to the
quantitation_XXX.xsd file.
""")
sys.exit(1)
if len(sys.argv) > 3 :
cs = msparser.ms_connection_settings()
cs.setSessionID(sys.argv[3])
file = msparser.ms_quant_configfile(sys.argv[1], sys.argv[2], cs)
else :
file = msparser.ms_quant_configfile(sys.argv[1], sys.argv[2])
if not file.isValid() :
print("There are errors. Cannot continue. The last error description:")
print(file.getLastErrorString())
sys.exit(1)
n = file.getNumberOfMethods()
print("There are %d quantitation methods available:" % n)
for i in range(n) :
print(file.getMethodByNumber(i).getName())
errs = file.validateDocument()
if errs :
print("Initial document validation errors: %s" % errs)
schemaFile = msparser.ms_xml_schema()
schemaFile.setFileName(sys.argv[2])
schemaFile.read_file()
if not schemaFile.isValid() :
print("Errors while reading schema-file. The last error description: %s" % schemaFile.getLastErrorString())
sys.exit(1)
for i in range(n) :
pMethod = file.getMethodByNumber(i)
errs = pMethod.validateShallow(schemaFile)
if errs :
print("Shallow validation errors (method %s): %s" % (pMethod.getName(), errs))
errs = pMethod.validateDeep(schemaFile)
if errs :
print("Deep validation errors (method %s): %s" % (pMethod.getName(), errs))
myMethodInvalid = msparser.ms_quant_method(file.getMethodByNumber(0))
myMethodInvalid.setName("")
errs = myMethodInvalid.validateShallow(schemaFile)
if errs :
print("Shallow validation of a method: %s" % errs)
errs = myMethodInvalid.validateDeep(schemaFile)
if errs :
print("Deep validation of a method: %s" % errs)
errs = schemaFile.validateComplexObject(myMethodInvalid, 1)
if errs :
print("Deep validation using schema-object: %s" % errs)
errs = schemaFile.validateSimpleString(myMethodInvalid.getName(), myMethodInvalid.getNameSchemaType())
if errs :
print("Attribute validation: %s" % errs)
configFileInvalid = msparser.ms_quant_configfile()
configFileInvalid.appendMethod(myMethodInvalid)
errs = configFileInvalid.validateDocument()
if errs :
print("Document validation errors: %s" % errs)
if not configFileInvalid.isValid() :
print("Errors in config file object. The last error description: %s" % configFileInvalid.getLastErrorString())
configFileInvalid.setFileName("quantitation_temp.xml")
configFileInvalid.save_file()
if not configFileInvalid.isValid() :
print("Failed to save: %s" % configFileInvalid.getLastErrorString())
"""
Running the program as
python config_quantitation.pl /usr/local/mascot/config/quantitation.xml /usr/local/mascot/html/xmlns/schema/quantitation_2/quantitation_2.xsd
will give the following output under Mascot Server 2.3 (depending on how
quantitation methods have been configured):
There are 26 quantitation methods available:
None
iTRAQ 4plex
iTRAQ 8plex
TMT 6plex
TMT 2plex
18O multiplex
SILAC K+6 R+6 multiplex
IPTL (Succinyl and IMID) multiplex
ICPL duplex pre-digest [MD]
ICPL duplex post-digest [MD]
ICPL triplex pre-digest [MD]
18O corrected [MD]
15N Metabolic [MD]
15N + 13C Metabolic [MD]
SILAC K+6 R+10 [MD]
SILAC K+6 R+10 Arg-Pro [MD]
SILAC K+6 R+6 [MD]
SILAC R+6 R+10 [MD]
SILAC K+8 R+10 [MD]
SILAC K+4 K+8 R+6 R+10 [MD]
ICAT ABI Cleavable [MD]
ICAT D8 [MD]
Dimethylation [MD]
NBS Shimadzu [MD]
Label-free [MD]
Average [MD]
Deep validation of a method: Attribute 'name' -> String is shorter than minLength-limit
Deep validation using schema-object: Attribute 'name' -> String is shorter than minLength-limit
Attribute validation: String is shorter than minLength-limit
"""