diff modify_mqpar.py @ 3:2d67fb758956 draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
author galaxyp
date Sat, 11 Apr 2020 11:50:09 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modify_mqpar.py	Sat Apr 11 11:50:09 2020 -0400
@@ -0,0 +1,34 @@
+"Modify a given mqpar.xml to run Galaxy MaxQuant with it."
+
+import argparse
+import os
+
+from mqparam import MQParam
+
+parser = argparse.ArgumentParser()
+
+arguments = ('--infiles',
+             '--version',
+             '--num_threads',
+             '--substitution_rx',
+             '--fasta_files',
+             '--description_parse_rule',
+             '--identifier_parse_rule',
+             'mqpar')
+
+for arg in arguments:
+    parser.add_argument(arg)
+
+args = parser.parse_args()
+
+mqpar_out = os.path.join(os.getcwd(), 'mqpar.xml')
+infiles = [os.path.join(os.getcwd(), f) for f in args.infiles.split(',')]
+mqparam = MQParam(args.mqpar, None, substitution_rx=args.substitution_rx)
+if mqparam.version != args.version:
+    raise Exception('mqpar version is ' + mqparam.version + '. Tool uses version {}.'.format(args.version))
+mqparam.translate(infiles)
+mqparam.add_fasta_files(args.fasta_files.split(','),
+                        {'identifierParseRule': args.identifier_parse_rule,
+                         'descriptionParseRule': args.description_parse_rule})
+mqparam.set_simple_param('numThreads', args.num_threads)
+mqparam.write('mqpar.xml')