annotate modify_mqpar.py @ 14:1a3782e58489 draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
author galaxyp
date Wed, 11 Aug 2021 09:23:24 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
1 "Modify a given mqpar.xml to run Galaxy MaxQuant with it."
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
2
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
3 import argparse
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
4 import os
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
5
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
6 from mqparam import MQParam
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
7
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
8 parser = argparse.ArgumentParser()
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
9
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
10 arguments = ('--infiles',
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
11 '--version',
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
12 '--num_threads',
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
13 '--substitution_rx',
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
14 '--fasta_files',
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
15 '--description_parse_rule',
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
16 '--identifier_parse_rule',
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
17 'mqpar')
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
18
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
19 for arg in arguments:
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
20 parser.add_argument(arg)
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
21
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
22 args = parser.parse_args()
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
23
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
24 mqpar_out = os.path.join(os.getcwd(), 'mqpar.xml')
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
25 infiles = [os.path.join(os.getcwd(), f) for f in args.infiles.split(',')]
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
26 mqparam = MQParam(args.mqpar, None, substitution_rx=args.substitution_rx)
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
27 if mqparam.version != args.version:
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
28 raise Exception('mqpar version is ' + mqparam.version + '. Tool uses version {}.'.format(args.version))
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
29 mqparam.translate(infiles)
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
30 mqparam.add_fasta_files(args.fasta_files.split(','),
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
31 {'identifierParseRule': args.identifier_parse_rule,
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
32 'descriptionParseRule': args.description_parse_rule})
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
33 mqparam.set_simple_param('numThreads', args.num_threads)
1a3782e58489 "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
34 mqparam.write('mqpar.xml')